Skip to content

Commit

Permalink
Updating ChipDeviceCtrl and TC_CADMIN_1_3_4 modules:
Browse files Browse the repository at this point in the history
- Moved get_rcac() to a standalone function that can be called after commissioning is completed in ChipDeviceCtrl module
- Updated TC_CADMIN_1_3_4 test module to using the new standalone function self.th.get_rcac()
  • Loading branch information
j-ororke committed Dec 7, 2024
1 parent b217ca3 commit be49186
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
12 changes: 2 additions & 10 deletions src/controller/python/chip/ChipDeviceCtrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2224,7 +2224,7 @@ async def get_commissioning_rcac_data_async(self):

async def CommissionOnNetwork(self, nodeId: int, setupPinCode: int,
filterType: DiscoveryFilterType = DiscoveryFilterType.NONE, filter: typing.Any = None,
discoveryTimeoutMsec: int = 30000, get_rcac: bool = False) -> int:
discoveryTimeoutMsec: int = 30000) -> int:
'''
Does the routine for OnNetworkCommissioning, with a filter for mDNS discovery.
Supported filters are:
Expand Down Expand Up @@ -2259,15 +2259,7 @@ async def CommissionOnNetwork(self, nodeId: int, setupPinCode: int,
self.devCtrl, self.pairingDelegate, nodeId, setupPinCode, int(filterType), str(filter).encode("utf-8") if filter is not None else None, discoveryTimeoutMsec)
)

res = await asyncio.futures.wrap_future(ctx.future)

# If RCAC data is wanted, attempt to pull the result
if get_rcac:
rcac_bytes = self.get_rcac()
return (res, rcac_bytes)

else:
return res
return await asyncio.futures.wrap_future(ctx.future)

def get_rcac(self):
try:
Expand Down
10 changes: 6 additions & 4 deletions src/python_testing/TC_CADMIN_1_3_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,10 @@ async def test_TC_CADMIN_1_3(self):
th2_certificate_authority = self.certificate_authority_manager.NewCertificateAuthority()
th2_fabric_admin = th2_certificate_authority.NewFabricAdmin(vendorId=0xFFF1, fabricId=self.th1.fabricId + 1)
self.th2 = th2_fabric_admin.NewController(nodeId=2, useTestCommissioner=True)
_, rcac = await self.th2.CommissionOnNetwork(
await self.th2.CommissionOnNetwork(
nodeId=self.dut_node_id, setupPinCode=params.setupPinCode,
filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=1234, get_rcac=True)
filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=1234)
rcac = self.th2.get_rcac()

th2_rcac_decoded = TLVReader(rcac).get()["Any"][9]

Expand Down Expand Up @@ -324,9 +325,10 @@ async def test_TC_CADMIN_1_4(self):
th2_certificate_authority = self.certificate_authority_manager.NewCertificateAuthority()
th2_fabric_admin = th2_certificate_authority.NewFabricAdmin(vendorId=0xFFF1, fabricId=self.th1.fabricId + 1)
self.th2 = th2_fabric_admin.NewController(nodeId=2, useTestCommissioner=True)
_, rcac = await self.th2.CommissionOnNetwork(
await self.th2.CommissionOnNetwork(
nodeId=self.dut_node_id, setupPinCode=setupPayloadInfo[0].passcode,
filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=setupPayloadInfo[0].filter_value, get_rcac=True)
filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=setupPayloadInfo[0].filter_value)
rcac = self.th2.get_rcac()

th2_rcac_decoded = TLVReader(rcac).get()["Any"][9]

Expand Down

0 comments on commit be49186

Please sign in to comment.