Skip to content

Commit

Permalink
Check fabric-sync application with ECOINFO tests on CI (project-chip#…
Browse files Browse the repository at this point in the history
…36733)

* Build fabric-sync for testing

* Test TC_ECOINFO test with new fabric-sync-app on CI

* Restyled by isort

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
arkq and restyled-commits authored Dec 5, 2024
1 parent 5bd336f commit 6063e23
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 14 deletions.
37 changes: 30 additions & 7 deletions src/python_testing/TC_ECOINFO_2_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,25 @@
# --commissioning-method on-network
# --discriminator 1234
# --passcode 20202021
# --string-arg th_server_app_path:${ALL_CLUSTERS_APP} dut_fsa_stdin_pipe:dut-fsa-stdin
# --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
# 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
Expand All @@ -48,7 +66,8 @@
from chip.clusters.Types import NullValue
from chip.interaction_model import Status
from chip.testing.apps import AppServerSubprocess
from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, type_matches
from chip.testing.matter_testing import (MatterBaseTest, SetupParameters, TestStep, async_test_body, default_matter_test_main,
type_matches)
from chip.tlv import uint
from mobly import asserts

Expand Down Expand Up @@ -92,22 +111,26 @@ async def _setup_ci_prerequisites(self):
logging.info("Temporary storage directory: %s", self.storage.name)

self.th_server_port = 5544
self.th_server_discriminator = random.randint(0, 4095)
self.th_server_passcode = 20202021
self.th_server_setup_params = SetupParameters(
discriminator=random.randint(0, 4095),
passcode=20202021)

# Start the server app.
self.th_server = AppServerSubprocess(
th_server_app,
storage_dir=self.storage.name,
port=self.th_server_port,
discriminator=self.th_server_discriminator,
passcode=self.th_server_passcode)
discriminator=self.th_server_setup_params.discriminator,
passcode=self.th_server_setup_params.passcode)
self.th_server.start(
expected_output="Server initialization complete",
timeout=30)

# Add some server to the DUT_FSA's Aggregator/Bridge.
self.dut_fsa_stdin.write(f"pairing onnetwork 2 {self.th_server_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)
Expand Down
40 changes: 33 additions & 7 deletions src/python_testing/TC_ECOINFO_2_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,25 @@
# --commissioning-method on-network
# --discriminator 1234
# --passcode 20202021
# --string-arg th_server_app_path:${ALL_CLUSTERS_APP} dut_fsa_stdin_pipe:dut-fsa-stdin
# --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
# 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
Expand All @@ -47,7 +65,7 @@
import chip.clusters as Clusters
from chip.interaction_model import Status
from chip.testing.apps import AppServerSubprocess
from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from chip.testing.matter_testing import MatterBaseTest, SetupParameters, TestStep, async_test_body, default_matter_test_main
from mobly import asserts

_DEVICE_TYPE_AGGREGATOR = 0x000E
Expand Down Expand Up @@ -91,16 +109,18 @@ def _setup_ci_prerequisites(self):
logging.info("Temporary storage directory: %s", self.storage.name)

self.th_server_port = 5544
self.th_server_discriminator = random.randint(0, 4095)
self.th_server_setup_params = SetupParameters(
discriminator=random.randint(0, 4095),
passcode=20202021)
self.th_server_passcode = 20202021

# Start the server app.
self.th_server = AppServerSubprocess(
th_server_app,
storage_dir=self.storage.name,
port=self.th_server_port,
discriminator=self.th_server_discriminator,
passcode=self.th_server_passcode)
discriminator=self.th_server_setup_params.discriminator,
passcode=self.th_server_setup_params.passcode)
self.th_server.start(
expected_output="Server initialization complete",
timeout=30)
Expand Down Expand Up @@ -161,7 +181,10 @@ async def test_TC_ECOINFO_2_2(self):
self.wait_for_user_input("Add a bridged device using method indicated by the manufacturer")
else:
# Add some server to the DUT_FSA's Aggregator/Bridge.
self.dut_fsa_stdin.write(f"pairing onnetwork 2 {self.th_server_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)
Expand Down Expand Up @@ -200,7 +223,10 @@ async def test_TC_ECOINFO_2_2(self):
self.wait_for_user_input("Removed bridged device added in step 2a using method indicated by the manufacturer")
else:
# Remove previously added server from the DUT_FSA's Aggregator/Bridge.
self.dut_fsa_stdin.write("pairing unpair 2\n")
if self.user_params.get("unified_fabric_sync_app"):
self.dut_fsa_stdin.write("app remove-device 2\n")
else:
self.dut_fsa_stdin.write("pairing unpair 2\n")
self.dut_fsa_stdin.flush()
# Wait for the command to complete.
await asyncio.sleep(2)
Expand Down

0 comments on commit 6063e23

Please sign in to comment.