@@ -92,6 +92,7 @@ async def setup_class(self):
9292 #####################################################################################################################################
9393 self .jfadmin_fabric_a_passcode = random .randint (110220011 , 110220999 )
9494 self .jfctrl_fabric_a_vid = random .randint (0x0001 , 0xFFF0 )
95+ self .jfadmin_fabric_a_node_id = 1
9596
9697 # Start Fabric A JF-Administrator App
9798 self .fabric_a_admin = AppServerSubprocess (
@@ -118,8 +119,8 @@ async def setup_class(self):
118119
119120 # Commission JF-ADMIN app with JF-Controller on Fabric A
120121 self .fabric_a_ctrl .send (
121- message = f"pairing onnetwork 1 { self .jfadmin_fabric_a_passcode } --anchor true" ,
122- expected_output = "[JF] Anchor Administrator (nodeId=1 ) commissioned with success" ,
122+ message = f"pairing onnetwork { self . jfadmin_fabric_a_node_id } { self .jfadmin_fabric_a_passcode } --anchor true" ,
123+ expected_output = f "[JF] Anchor Administrator (nodeId={ self . jfadmin_fabric_a_node_id } ) commissioned with success" ,
123124 timeout = 10 )
124125
125126 # Extract the Ecosystem A certificates and inject them in the storage that will be provided to a new Python Controller later
@@ -201,6 +202,9 @@ def steps_TC_JFDS_2_2(self) -> list[TestStep]:
201202 "Verify that the DUT responds with Status code CONSTRAINT_ERROR." ),
202203 ]
203204
205+ def pics_TC_JFDS_2_2 (self ) -> list [str ]:
206+ return ["JFDS.S" ]
207+
204208 @async_test_body
205209 async def test_TC_JFDS_2_2 (self ):
206210 # Creating a Controller for Ecosystem A
@@ -215,11 +219,26 @@ async def test_TC_JFDS_2_2(self):
215219 paaTrustStorePath = str (self .matter_test_config .paa_trust_store_path ),
216220 catTags = [int (self .ecoACATs , 16 )])
217221
222+ # Discover endpoint with JointFabricDatastore cluster via Descriptor
223+ descriptor_response = await self .devCtrlEcoA .ReadAttribute (
224+ nodeId = self .jfadmin_fabric_a_node_id , attributes = [(Clusters .Descriptor )],
225+ returnClusterObject = True )
226+
227+ jfds_endpoint = None
228+ for endpoint_id , endpoint_data in descriptor_response .items ():
229+ if Clusters .JointFabricDatastore .id in endpoint_data [Clusters .Descriptor ].serverList :
230+ jfds_endpoint = endpoint_id
231+ log .info (f"Found JointFabricDatastore cluster on endpoint { jfds_endpoint } " )
232+ break
233+
234+ asserts .assert_is_not_none (jfds_endpoint , "JointFabricDatastore cluster not found on any endpoint" )
235+
218236 self .step ("1" )
219237 response = await self .devCtrlEcoA .ReadAttribute (
220- nodeId = 1 , attributes = [(1 , Clusters .JointFabricDatastore .Attributes .GroupKeySetList )],
238+ nodeId = self .jfadmin_fabric_a_node_id , attributes = [
239+ (jfds_endpoint , Clusters .JointFabricDatastore .Attributes .GroupKeySetList )],
221240 returnClusterObject = True )
222- _groupKeySetList = response [1 ][Clusters .JointFabricDatastore ].groupKeySetList
241+ _groupKeySetList = response [jfds_endpoint ][Clusters .JointFabricDatastore ].groupKeySetList
223242 step1_groupKeySetListLength = len (_groupKeySetList )
224243 asserts .assert_greater_equal (step1_groupKeySetListLength , 1 , "GroupKeySetList must contain at least one entry!" )
225244 _found = False
@@ -240,13 +259,17 @@ async def test_TC_JFDS_2_2(self):
240259 epochKey2 = b'22222222222222222222222222222222' ,
241260 epochStartTime2 = 2220002 )
242261 cmd = Clusters .JointFabricDatastore .Commands .AddKeySet (step2_groupKeySet )
243- await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = 1 , endpoint = 1 )
262+ try :
263+ await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = self .jfadmin_fabric_a_node_id , endpoint = jfds_endpoint )
264+ except InteractionModelError as e :
265+ asserts .fail (f"Unexpected error when adding KeySet: { e } " )
244266
245267 self .step ("3" )
246268 response = await self .devCtrlEcoA .ReadAttribute (
247- nodeId = 1 , attributes = [(1 , Clusters .JointFabricDatastore .Attributes .GroupKeySetList )],
269+ nodeId = self .jfadmin_fabric_a_node_id , attributes = [
270+ (jfds_endpoint , Clusters .JointFabricDatastore .Attributes .GroupKeySetList )],
248271 returnClusterObject = True )
249- _groupKeySetList = response [1 ][Clusters .JointFabricDatastore ].groupKeySetList
272+ _groupKeySetList = response [jfds_endpoint ][Clusters .JointFabricDatastore ].groupKeySetList
250273 asserts .assert_greater (len (_groupKeySetList ), step1_groupKeySetListLength ,
251274 "An new entry was not added in groupKeySetList" )
252275 _found = False
@@ -269,7 +292,7 @@ async def test_TC_JFDS_2_2(self):
269292 cmd = Clusters .JointFabricDatastore .Commands .AddKeySet (step4_groupKeySet )
270293 # Verify that the DUT responds with Status as CONSTRAINT_ERROR
271294 try :
272- await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = 1 , endpoint = 1 )
295+ await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = self . jfadmin_fabric_a_node_id , endpoint = jfds_endpoint )
273296 asserts .fail ("Expected CONSTRAINT_ERROR but command succeeded" )
274297 except InteractionModelError as e :
275298 asserts .assert_equal (e .status , Status .ConstraintError ,
@@ -286,7 +309,10 @@ async def test_TC_JFDS_2_2(self):
286309 epochKey2 = b'99999999999999999999999999999999' ,
287310 epochStartTime2 = 2220003 )
288311 cmd = Clusters .JointFabricDatastore .Commands .UpdateKeySet (step5_groupKeySet )
289- await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = 1 , endpoint = 1 )
312+ try :
313+ await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = self .jfadmin_fabric_a_node_id , endpoint = jfds_endpoint )
314+ except InteractionModelError as e :
315+ asserts .fail (f"Unexpected error when updating KeySet: { e } " )
290316
291317 self .step ("6" )
292318 step6_groupKeySet = Clusters .JointFabricDatastore .Structs .DatastoreGroupKeySetStruct (
@@ -300,17 +326,18 @@ async def test_TC_JFDS_2_2(self):
300326 epochStartTime2 = 2220003 )
301327 cmd = Clusters .JointFabricDatastore .Commands .UpdateKeySet (step6_groupKeySet )
302328 try :
303- await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = 1 , endpoint = 1 )
329+ await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = self . jfadmin_fabric_a_node_id , endpoint = jfds_endpoint )
304330 asserts .fail ("Expected CONSTRAINT_ERROR but command succeeded" )
305331 except InteractionModelError as e :
306332 asserts .assert_equal (e .status , Status .ConstraintError ,
307333 f"Expected CONSTRAINT_ERROR but got { e .status } " )
308334
309335 self .step ("7" )
310336 response = await self .devCtrlEcoA .ReadAttribute (
311- nodeId = 1 , attributes = [(1 , Clusters .JointFabricDatastore .Attributes .GroupKeySetList )],
337+ nodeId = self .jfadmin_fabric_a_node_id , attributes = [
338+ (jfds_endpoint , Clusters .JointFabricDatastore .Attributes .GroupKeySetList )],
312339 returnClusterObject = True )
313- _groupKeySetList = response [1 ][Clusters .JointFabricDatastore ].groupKeySetList
340+ _groupKeySetList = response [jfds_endpoint ][Clusters .JointFabricDatastore ].groupKeySetList
314341
315342 _found = False
316343 for _item in _groupKeySetList :
@@ -331,7 +358,7 @@ async def test_TC_JFDS_2_2(self):
331358 epochStartTime2 = 2220003 )
332359 cmd = Clusters .JointFabricDatastore .Commands .UpdateKeySet (step8_groupKeySet )
333360 try :
334- await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = 1 , endpoint = 1 )
361+ await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = self . jfadmin_fabric_a_node_id , endpoint = jfds_endpoint )
335362 asserts .fail ("Expected NOT_FOUND but command succeeded" )
336363 except InteractionModelError as e :
337364 asserts .assert_equal (e .status , Status .NotFound ,
@@ -340,7 +367,7 @@ async def test_TC_JFDS_2_2(self):
340367 self .step ("9" )
341368 cmd = Clusters .JointFabricDatastore .Commands .RemoveKeySet (0x0fff )
342369 try :
343- await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = 1 , endpoint = 1 )
370+ await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = self . jfadmin_fabric_a_node_id , endpoint = jfds_endpoint )
344371 asserts .fail ("Expected NOT_FOUND but command succeeded" )
345372 except InteractionModelError as e :
346373 asserts .assert_equal (e .status , Status .NotFound ,
@@ -349,21 +376,25 @@ async def test_TC_JFDS_2_2(self):
349376 self .step ("10" )
350377 cmd = Clusters .JointFabricDatastore .Commands .RemoveKeySet (0x0000 )
351378 try :
352- await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = 1 , endpoint = 1 )
379+ await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = self . jfadmin_fabric_a_node_id , endpoint = jfds_endpoint )
353380 asserts .fail ("Expected CONSTRAINT_ERROR but command succeeded" )
354381 except InteractionModelError as e :
355382 asserts .assert_equal (e .status , Status .ConstraintError ,
356383 f"Expected CONSTRAINT_ERROR but got { e .status } " )
357384
358385 self .step ("11" )
359386 cmd = Clusters .JointFabricDatastore .Commands .RemoveKeySet (0x000a )
360- await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = 1 , endpoint = 1 )
387+ try :
388+ await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = self .jfadmin_fabric_a_node_id , endpoint = jfds_endpoint )
389+ except InteractionModelError as e :
390+ asserts .fail (f"Unexpected error when removing KeySet: { e } " )
361391
362392 self .step ("12" )
363393 response = await self .devCtrlEcoA .ReadAttribute (
364- nodeId = 1 , attributes = [(1 , Clusters .JointFabricDatastore .Attributes .GroupKeySetList )],
394+ nodeId = self .jfadmin_fabric_a_node_id , attributes = [
395+ (jfds_endpoint , Clusters .JointFabricDatastore .Attributes .GroupKeySetList )],
365396 returnClusterObject = True )
366- _groupKeySetList = response [1 ][Clusters .JointFabricDatastore ].groupKeySetList
397+ _groupKeySetList = response [jfds_endpoint ][Clusters .JointFabricDatastore ].groupKeySetList
367398 _found = False
368399 for _item in _groupKeySetList :
369400 if _item .groupKeySetID == 0x000a :
@@ -383,7 +414,7 @@ async def test_TC_JFDS_2_2(self):
383414 epochStartTime2 = 2220002 )
384415 cmd = Clusters .JointFabricDatastore .Commands .AddKeySet (_groupKeySet )
385416 try :
386- await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = 1 , endpoint = 1 )
417+ await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = self . jfadmin_fabric_a_node_id , endpoint = jfds_endpoint )
387418 asserts .fail ("Expected CONSTRAINT_ERROR but command succeeded" )
388419 except InteractionModelError as e :
389420 asserts .assert_equal (e .status , Status .ConstraintError ,
@@ -392,7 +423,7 @@ async def test_TC_JFDS_2_2(self):
392423 self .step ("14" )
393424 cmd = Clusters .JointFabricDatastore .Commands .RemoveKeySet (0x0000 )
394425 try :
395- await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = 1 , endpoint = 1 )
426+ await self .send_single_cmd (cmd = cmd , dev_ctrl = self .devCtrlEcoA , node_id = self . jfadmin_fabric_a_node_id , endpoint = jfds_endpoint )
396427 asserts .fail ("Expected CONSTRAINT_ERROR but command succeeded" )
397428 except InteractionModelError as e :
398429 asserts .assert_equal (e .status , Status .ConstraintError ,
0 commit comments