Skip to content

Commit 2f27d44

Browse files
committed
TC-SC-3.6: Add precondition to remove extra fabrics (project-chip#33503)
* TC-SC-3.6: Add precondition to remove extra fabrics Before commissioning the other fabrics, remove pre-existing fabrics from the device because the TH does not have the ability to check for subscriptions from them. Note that this change means that any pre-exisiting fabrics on the device WILL NOT BE THERE after this test. This is the same behaviour as in RR-1.1. Test: Tested against all-clusters app. chip-tool pairing onnetwork-long 0x12344321 20202021 3840 chip-tool pairing open-commissioning-window 0x12344321 0 900 10000 3840 python src/python_testing/TC_SC_3_6.py --commissioning-method on-network \ --discriminator 3840 --passcode 20202021 Results (only relevant logs): [MatterTest] 05-17 07:54:32.981 INFO Pre-condition: Remove all pre-existing fabrics on the device that do not belong to the TH ... [MatterTest] 05-17 07:54:32.994 INFO Removing extra fabric at 1 from device. ... INFO:root:Final result: PASS ! * add missing import
1 parent 46e1ad8 commit 2f27d44

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/python_testing/TC_SC_3_6.py

+19
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import queue
2121
import time
2222
from threading import Event
23+
from typing import List
2324

2425
import chip.clusters as Clusters
2526
from chip.clusters import ClusterObjects as ClustersObjects
@@ -123,6 +124,24 @@ async def test_TC_SC_3_6(self):
123124
)
124125
asserts.assert_greater_equal(capability_minima.caseSessionsPerFabric, 3)
125126

127+
logging.info("Pre-condition: Remove all pre-existing fabrics on the device that do not belong to the TH")
128+
commissioned_fabric_count: int = await self.read_single_attribute(
129+
dev_ctrl, node_id=self.dut_node_id,
130+
endpoint=0, attribute=Clusters.OperationalCredentials.Attributes.CommissionedFabrics)
131+
132+
if commissioned_fabric_count > 1:
133+
fabrics: List[Clusters.OperationalCredentials.Structs.FabricDescriptorStruct] = await self.read_single_attribute(
134+
dev_ctrl, node_id=self.dut_node_id, endpoint=0,
135+
attribute=Clusters.OperationalCredentials.Attributes.Fabrics, fabricFiltered=False)
136+
current_fabric_index = await self.read_single_attribute_check_success(cluster=Clusters.OperationalCredentials, attribute=Clusters.OperationalCredentials.Attributes.CurrentFabricIndex)
137+
for fabric in fabrics:
138+
if fabric.fabricIndex == current_fabric_index:
139+
continue
140+
# This is not the test client's fabric, so remove it.
141+
logging.info(f"Removing extra fabric at {fabric.fabricIndex} from device.")
142+
await dev_ctrl.SendCommand(
143+
self.dut_node_id, 0, Clusters.OperationalCredentials.Commands.RemoveFabric(fabricIndex=fabric.fabricIndex))
144+
126145
logging.info("Pre-conditions: use existing fabric to configure new fabrics so that total is %d fabrics" %
127146
num_fabrics_to_commission)
128147

0 commit comments

Comments
 (0)