Skip to content

Commit e09abae

Browse files
authored
Do not use reverse commissioning to pair test server (#36490)
1 parent b8898ab commit e09abae

File tree

1 file changed

+35
-60
lines changed

1 file changed

+35
-60
lines changed

src/python_testing/TC_MCORE_FS_1_3.py

Lines changed: 35 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# --commissioning-method on-network
3535
# --discriminator 1234
3636
# --passcode 20202021
37-
# --string-arg th_server_no_uid_app_path:${LIGHTING_APP_NO_UNIQUE_ID}
37+
# --string-arg th_server_no_uid_app_path:${LIGHTING_APP_NO_UNIQUE_ID} dut_fsa_stdin_pipe:dut-fsa-stdin
3838
# --trace-to json:${TRACE_TEST_JSON}.json
3939
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
4040
# factory-reset: true
@@ -81,6 +81,13 @@ def setup_class(self):
8181
self.storage = tempfile.TemporaryDirectory(prefix=self.__class__.__name__)
8282
logging.info("Temporary storage directory: %s", self.storage.name)
8383

84+
if self.is_pics_sdk_ci_only:
85+
# Get the named pipe path for the DUT_FSA app input from the user params.
86+
dut_fsa_stdin_pipe = self.user_params.get("dut_fsa_stdin_pipe")
87+
if not dut_fsa_stdin_pipe:
88+
asserts.fail("CI setup requires --string-arg dut_fsa_stdin_pipe:<path_to_pipe>")
89+
self.dut_fsa_stdin = open(dut_fsa_stdin_pipe, "w")
90+
8491
self.th_server_port = 5544
8592
self.th_server_discriminator = random.randint(0, 4095)
8693
self.th_server_passcode = 20202021
@@ -111,60 +118,6 @@ def steps_TC_MCORE_FS_1_3(self) -> list[TestStep]:
111118
"TH verifies a value is visible for the UniqueID from the DUT_FSA's Bridged Device Basic Information Cluster."),
112119
]
113120

114-
async def commission_via_commissioner_control(self, controller_node_id: int, device_node_id: int, endpoint_id: int):
115-
"""Commission device_node_id to controller_node_id using CommissionerControl cluster."""
116-
117-
request_id = random.randint(0, 0xFFFFFFFFFFFFFFFF)
118-
119-
vendor_id = await self.read_single_attribute_check_success(
120-
node_id=device_node_id,
121-
cluster=Clusters.BasicInformation,
122-
attribute=Clusters.BasicInformation.Attributes.VendorID,
123-
)
124-
125-
product_id = await self.read_single_attribute_check_success(
126-
node_id=device_node_id,
127-
cluster=Clusters.BasicInformation,
128-
attribute=Clusters.BasicInformation.Attributes.ProductID,
129-
)
130-
131-
await self.send_single_cmd(
132-
node_id=controller_node_id,
133-
endpoint=endpoint_id,
134-
cmd=Clusters.CommissionerControl.Commands.RequestCommissioningApproval(
135-
requestID=request_id,
136-
vendorID=vendor_id,
137-
productID=product_id,
138-
),
139-
)
140-
141-
if not self.is_pics_sdk_ci_only:
142-
self.wait_for_user_input("Approve Commissioning Approval Request on DUT using manufacturer specified mechanism")
143-
144-
resp = await self.send_single_cmd(
145-
node_id=controller_node_id,
146-
endpoint=endpoint_id,
147-
cmd=Clusters.CommissionerControl.Commands.CommissionNode(
148-
requestID=request_id,
149-
responseTimeoutSeconds=30,
150-
),
151-
)
152-
153-
asserts.assert_equal(type(resp), Clusters.CommissionerControl.Commands.ReverseOpenCommissioningWindow,
154-
"Incorrect response type")
155-
156-
await self.send_single_cmd(
157-
node_id=device_node_id,
158-
cmd=Clusters.AdministratorCommissioning.Commands.OpenCommissioningWindow(
159-
commissioningTimeout=3*60,
160-
PAKEPasscodeVerifier=resp.PAKEPasscodeVerifier,
161-
discriminator=resp.discriminator,
162-
iterations=resp.iterations,
163-
salt=resp.salt,
164-
),
165-
timedRequestTimeoutMs=5000,
166-
)
167-
168121
@async_test_body
169122
async def test_TC_MCORE_FS_1_3(self):
170123

@@ -218,13 +171,35 @@ async def test_TC_MCORE_FS_1_3(self):
218171

219172
asserts.assert_not_equal(aggregator_endpoint, 0, "Invalid aggregator endpoint. Cannot proceed with commissioning.")
220173

221-
await self.commission_via_commissioner_control(
222-
controller_node_id=self.dut_node_id,
223-
device_node_id=th_server_th_node_id,
224-
endpoint_id=aggregator_endpoint)
174+
# Open commissioning window on TH_SERVER_NO_UID.
175+
discriminator = random.randint(0, 4095)
176+
params = await self.default_controller.OpenCommissioningWindow(
177+
nodeid=th_server_th_node_id,
178+
option=self.default_controller.CommissioningWindowPasscode.kTokenWithRandomPin,
179+
discriminator=discriminator,
180+
iteration=10000,
181+
timeout=600)
182+
183+
# Commissioning TH_SERVER_NO_UID to DUT_FSA fabric.
184+
if not self.is_pics_sdk_ci_only:
185+
self.wait_for_user_input(
186+
f"Commission TH_SERVER_NO_UID on DUT using manufacturer specified mechanism.\n"
187+
f"Use the following parameters:\n"
188+
f"- discriminator: {discriminator}\n"
189+
f"- setupPinCode: {params.setupPinCode}\n"
190+
f"- setupQRCode: {params.setupQRCode}\n"
191+
f"- setupManualCode: {params.setupManualCode}\n"
192+
f"If using FabricSync Admin, you may type:\n"
193+
f">>> pairing onnetwork <desired_node_id> {params.setupPinCode}")
194+
else:
195+
self.dut_fsa_stdin.write(
196+
f"pairing onnetwork 10 {params.setupPinCode}\n")
197+
self.dut_fsa_stdin.flush()
198+
# Wait for the commissioning to complete.
199+
await asyncio.sleep(5)
225200

226201
# Wait for the device to appear on the DUT_FSA_BRIDGE.
227-
await asyncio.sleep(2 if self.is_pics_sdk_ci_only else 30)
202+
await asyncio.sleep(1)
228203

229204
# Get the list of endpoints on the DUT_FSA_BRIDGE after adding the TH_SERVER_NO_UID.
230205
dut_fsa_bridge_endpoints_new = set(await self.read_single_attribute_check_success(

0 commit comments

Comments
 (0)