From a0e247de45e4e43485f8e76aa3e72ed8de1711dc Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Fri, 6 Dec 2024 12:11:50 +0100 Subject: [PATCH 1/3] Check fabric-sync application with MCORE-FS tests on CI --- src/python_testing/TC_MCORE_FS_1_1.py | 15 +++++++++++++ src/python_testing/TC_MCORE_FS_1_2.py | 25 ++++++++++++++++++--- src/python_testing/TC_MCORE_FS_1_3.py | 23 +++++++++++++++++-- src/python_testing/TC_MCORE_FS_1_4.py | 32 ++++++++++++++++++++++++--- 4 files changed, 87 insertions(+), 8 deletions(-) diff --git a/src/python_testing/TC_MCORE_FS_1_1.py b/src/python_testing/TC_MCORE_FS_1_1.py index 8428a998782601..61c5e6a4d505dd 100755 --- a/src/python_testing/TC_MCORE_FS_1_1.py +++ b/src/python_testing/TC_MCORE_FS_1_1.py @@ -38,6 +38,21 @@ # --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto # factory-reset: true # quiet: true +# run2: +# app: ${FABRIC_SYNC_APP} +# app-args: --discriminator=1234 +# app-stdin-pipe: dut-fsa-stdin +# script-args: > +# --PICS src/app/tests/suites/certification/ci-pics-values +# --storage-path admin_storage.json +# --commissioning-method on-network +# --discriminator 1234 +# --passcode 20202021 +# --string-arg th_server_app_path:${ALL_CLUSTERS_APP} +# --trace-to json:${TRACE_TEST_JSON}.json +# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# factory-reset: true +# quiet: true # === END CI TEST ARGUMENTS === import logging diff --git a/src/python_testing/TC_MCORE_FS_1_2.py b/src/python_testing/TC_MCORE_FS_1_2.py index 8fd9c38c2dd6cf..8db130cd6f633d 100644 --- a/src/python_testing/TC_MCORE_FS_1_2.py +++ b/src/python_testing/TC_MCORE_FS_1_2.py @@ -36,6 +36,23 @@ # --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto # factory-reset: true # quiet: true +# run2: +# app: ${FABRIC_SYNC_APP} +# app-args: --discriminator=1234 +# app-stdin-pipe: dut-fsa-stdin +# script-args: > +# --PICS src/app/tests/suites/certification/ci-pics-values +# --storage-path admin_storage.json +# --commissioning-method on-network +# --discriminator 1234 +# --passcode 20202021 +# --bool-arg unified_fabric_sync_app:true +# --string-arg th_server_app_path:${ALL_CLUSTERS_APP} +# --string-arg dut_fsa_stdin_pipe:dut-fsa-stdin +# --trace-to json:${TRACE_TEST_JSON}.json +# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# factory-reset: true +# quiet: true # === END CI TEST ARGUMENTS === import asyncio @@ -182,8 +199,10 @@ async def test_TC_MCORE_FS_1_2(self): if not self.is_pics_sdk_ci_only: self._ask_for_vendor_commissioning_ux_operation(self.th_server_setup_params) else: - self.dut_fsa_stdin.write( - f"pairing onnetwork 2 {self.th_server_setup_params.passcode}\n") + if self.user_params.get("unified_fabric_sync_app"): + self.dut_fsa_stdin.write(f"app pair-device 2 {self.th_server_setup_params.qr_code}\n") + else: + self.dut_fsa_stdin.write(f"pairing onnetwork 2 {self.th_server_setup_params.passcode}\n") self.dut_fsa_stdin.flush() # Wait for the commissioning to complete. await asyncio.sleep(5) @@ -250,7 +269,7 @@ async def test_TC_MCORE_FS_1_2(self): bridged_info_for_th_server = dut_read[newly_added_endpoint][Clusters.BridgedDeviceBasicInformation] basic_info_attr = Clusters.BasicInformation.Attributes bridged_device_info_attr = Clusters.BridgedDeviceBasicInformation.Attributes - Clusters.BasicInformation.Attributes + asserts.assert_equal(th_server_basic_info[basic_info_attr.VendorName], bridged_info_for_th_server[bridged_device_info_attr.VendorName], "VendorName incorrectly reported by DUT") asserts.assert_equal(th_server_basic_info[basic_info_attr.VendorID], diff --git a/src/python_testing/TC_MCORE_FS_1_3.py b/src/python_testing/TC_MCORE_FS_1_3.py index b4685f175d0fe5..6338d969471fa1 100644 --- a/src/python_testing/TC_MCORE_FS_1_3.py +++ b/src/python_testing/TC_MCORE_FS_1_3.py @@ -40,6 +40,23 @@ # --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto # factory-reset: true # quiet: true +# run2: +# app: ${FABRIC_SYNC_APP} +# app-args: --discriminator=1234 +# app-stdin-pipe: dut-fsa-stdin +# script-args: > +# --PICS src/app/tests/suites/certification/ci-pics-values +# --storage-path admin_storage.json +# --commissioning-method on-network +# --discriminator 1234 +# --passcode 20202021 +# --bool-arg unified_fabric_sync_app:true +# --string-arg th_server_no_uid_app_path:${LIGHTING_APP_NO_UNIQUE_ID} +# --string-arg dut_fsa_stdin_pipe:dut-fsa-stdin +# --trace-to json:${TRACE_TEST_JSON}.json +# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# factory-reset: true +# quiet: true # === END CI TEST ARGUMENTS === import asyncio @@ -193,8 +210,10 @@ async def test_TC_MCORE_FS_1_3(self): f"If using FabricSync Admin, you may type:\n" f">>> pairing onnetwork {params.setupPinCode}") else: - self.dut_fsa_stdin.write( - f"pairing onnetwork 10 {params.setupPinCode}\n") + if self.user_params.get("unified_fabric_sync_app"): + self.dut_fsa_stdin.write(f"app pair-device 10 {params.setupQRCode}\n") + else: + self.dut_fsa_stdin.write(f"pairing onnetwork 10 {params.setupPinCode}\n") self.dut_fsa_stdin.flush() # Wait for the commissioning to complete. await asyncio.sleep(5) diff --git a/src/python_testing/TC_MCORE_FS_1_4.py b/src/python_testing/TC_MCORE_FS_1_4.py index fb64378750cbf1..e866533f15c36f 100644 --- a/src/python_testing/TC_MCORE_FS_1_4.py +++ b/src/python_testing/TC_MCORE_FS_1_4.py @@ -39,6 +39,25 @@ # --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto # factory-reset: true # quiet: true +# run2: +# app: ${FABRIC_SYNC_APP} +# app-args: --discriminator=1234 +# app-stdin-pipe: dut-fsa-stdin +# script-args: > +# --PICS src/app/tests/suites/certification/ci-pics-values +# --storage-path admin_storage.json +# --commissioning-method on-network +# --discriminator 1234 --passcode 20202021 +# --bool-arg unified_fabric_sync_app:true +# --string-arg th_fsa_app_path:examples/fabric-admin/scripts/fabric-sync-app.py +# --string-arg th_fsa_admin_path:${FABRIC_ADMIN_APP} +# --string-arg th_fsa_bridge_path:${FABRIC_BRIDGE_APP} +# --string-arg th_server_no_uid_app_path:${LIGHTING_APP_NO_UNIQUE_ID} +# --string-arg dut_fsa_stdin_pipe:dut-fsa-stdin +# --trace-to json:${TRACE_TEST_JSON}.json +# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# factory-reset: true +# quiet: true # === END CI TEST ARGUMENTS === import asyncio @@ -322,8 +341,12 @@ async def test_TC_MCORE_FS_1_4(self): f"If using FabricSync Admin, you may type:\n" f">>> fabricsync add-bridge {params.setupPinCode} {self.th_fsa_bridge_port}") else: - self.dut_fsa_stdin.write( - f"fabricsync add-bridge 10 {params.setupPinCode} {self.th_fsa_bridge_address} {self.th_fsa_bridge_port}\n") + if self.user_params.get("unified_fabric_sync_app"): + self.dut_fsa_stdin.write( + f"app add-bridge 10 {params.setupPinCode} {self.th_fsa_bridge_address} {self.th_fsa_bridge_port}\n") + else: + self.dut_fsa_stdin.write( + f"fabricsync add-bridge 10 {params.setupPinCode} {self.th_fsa_bridge_address} {self.th_fsa_bridge_port}\n") self.dut_fsa_stdin.flush() # Wait for the commissioning to complete. await asyncio.sleep(5) @@ -347,7 +370,10 @@ async def test_TC_MCORE_FS_1_4(self): f"If using FabricSync Admin, you may type:\n" f">>> fabricsync sync-device {th_fsa_bridge_th_server_endpoint}") else: - self.dut_fsa_stdin.write(f"fabricsync sync-device {th_fsa_bridge_th_server_endpoint}\n") + if self.user_params.get("unified_fabric_sync_app"): + self.dut_fsa_stdin.write(f"app sync-device {th_fsa_bridge_th_server_endpoint}\n") + else: + self.dut_fsa_stdin.write(f"fabricsync sync-device {th_fsa_bridge_th_server_endpoint}\n") self.dut_fsa_stdin.flush() # Wait for the synchronization to complete. await asyncio.sleep(5) From a9ea9467c7561d7d2ef9a44771611adc264c595b Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Mon, 9 Dec 2024 19:59:12 +0100 Subject: [PATCH 2/3] Add test with new fabric-sync for MCORE-FS-1.5 --- src/python_testing/TC_MCORE_FS_1_5.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/python_testing/TC_MCORE_FS_1_5.py b/src/python_testing/TC_MCORE_FS_1_5.py index 2cfcd3ecbfd21e..c678f1bf41ca35 100755 --- a/src/python_testing/TC_MCORE_FS_1_5.py +++ b/src/python_testing/TC_MCORE_FS_1_5.py @@ -36,6 +36,23 @@ # --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto # factory-reset: true # quiet: true +# run2: +# app: ${FABRIC_SYNC_APP} +# app-args: --discriminator=1234 +# app-stdin-pipe: dut-fsa-stdin +# script-args: > +# --PICS src/app/tests/suites/certification/ci-pics-values +# --storage-path admin_storage.json +# --commissioning-method on-network +# --discriminator 1234 +# --passcode 20202021 +# --bool-arg unified_fabric_sync_app:true +# --string-arg th_server_app_path:${ALL_CLUSTERS_APP} +# --string-arg dut_fsa_stdin_pipe:dut-fsa-stdin +# --trace-to json:${TRACE_TEST_JSON}.json +# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# factory-reset: true +# quiet: true # === END CI TEST ARGUMENTS === import asyncio @@ -189,8 +206,10 @@ async def test_TC_MCORE_FS_1_5(self): if not self.is_pics_sdk_ci_only: self._ask_for_vendor_commissioning_ux_operation(self.th_server_setup_params) else: - self.dut_fsa_stdin.write( - f"pairing onnetwork 2 {self.th_server_setup_params.passcode}\n") + if self.user_params.get("unified_fabric_sync_app"): + self.dut_fsa_stdin.write(f"app pair-device 2 {self.th_server_setup_params.qr_code}\n") + else: + self.dut_fsa_stdin.write(f"pairing onnetwork 2 {self.th_server_setup_params.passcode}\n") self.dut_fsa_stdin.flush() # Wait for the commissioning to complete. await asyncio.sleep(5) From 07cd4d3c954392ae88ed9f1bc6f9d6087731fbe2 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Wed, 11 Dec 2024 11:57:51 +0100 Subject: [PATCH 3/3] Use async-friendly sleep --- src/python_testing/TC_MCORE_FS_1_5.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/python_testing/TC_MCORE_FS_1_5.py b/src/python_testing/TC_MCORE_FS_1_5.py index c678f1bf41ca35..80760913e6fe65 100755 --- a/src/python_testing/TC_MCORE_FS_1_5.py +++ b/src/python_testing/TC_MCORE_FS_1_5.py @@ -156,17 +156,18 @@ def _ask_for_vendor_commissioning_ux_operation(self, setup_params: SetupParamete f">>> pairing onnetwork 111 {setup_params.passcode}") def steps_TC_MCORE_FS_1_5(self) -> list[TestStep]: - steps = [TestStep(1, "TH subscribes to PartsList attribute of the Descriptor cluster of DUT_FSA endpoint 0."), - TestStep(2, "Follow manufacturer provided instructions to have DUT_FSA commission TH_SERVER"), - TestStep(3, "TH waits up to 30 seconds for subscription report from the PartsList attribute of the Descriptor to contain new endpoint"), - TestStep(4, "TH uses DUT to open commissioning window to TH_SERVER"), - TestStep(5, "TH commissions TH_SERVER"), - TestStep(6, "TH subscribes to AdministratorCommissioning attributes on DUT_FSA for the newly added endpoint identified in step 3"), - TestStep(7, "TH opens commissioning window to TH_SERVER directly (not using DUT)"), - TestStep(8, "TH reads CurrentFabricIndex attributes on OperationalCredentials cluster from TH_SERVER directly (not using DUT_FSA)"), - TestStep(9, "TH reads AdministratorCommissioning from TH_SERVER directly (not using DUT)"), - TestStep(10, "TH waits up to 10 seconds for subscription report from the AdministratorCommissioning attribute (from step 6) to reflect values from previous step")] - return steps + return [ + TestStep(1, "TH subscribes to PartsList attribute of the Descriptor cluster of DUT_FSA endpoint 0."), + TestStep(2, "Follow manufacturer provided instructions to have DUT_FSA commission TH_SERVER"), + TestStep(3, "TH waits up to 30 seconds for subscription report from the PartsList attribute of the Descriptor to contain new endpoint"), + TestStep(4, "TH uses DUT to open commissioning window to TH_SERVER"), + TestStep(5, "TH commissions TH_SERVER"), + TestStep(6, "TH subscribes to AdministratorCommissioning attributes on DUT_FSA for the newly added endpoint identified in step 3"), + TestStep(7, "TH opens commissioning window to TH_SERVER directly (not using DUT)"), + TestStep(8, "TH reads CurrentFabricIndex attributes on OperationalCredentials cluster from TH_SERVER directly (not using DUT_FSA)"), + TestStep(9, "TH reads AdministratorCommissioning from TH_SERVER directly (not using DUT)"), + TestStep(10, "TH waits up to 10 seconds for subscription report from the AdministratorCommissioning attribute (from step 6) to reflect values from previous step"), + ] # This test has some manual steps, so we need a longer timeout. Test typically runs under 1 mins so 3 mins should # be enough time for test to run @@ -284,7 +285,7 @@ async def test_TC_MCORE_FS_1_5(self): cadmin_attribute_handler = AttributeChangeAccumulator( name=self.default_controller.name, expected_attribute=Clusters.AdministratorCommissioning.Attributes.WindowStatus, output=cadmin_queue) self._cadmin_subscription.SetAttributeUpdateCallback(cadmin_attribute_handler) - time.sleep(1) + await asyncio.sleep(1) self.step(7) await self.default_controller.OpenCommissioningWindow(nodeid=self.th_server_local_nodeid, timeout=180, iteration=1000, discriminator=3840, option=1)