From be49186bdb19411f969cf8cd14f09ea7e765c34d Mon Sep 17 00:00:00 2001 From: Jake Ororke Date: Fri, 6 Dec 2024 17:37:22 -0800 Subject: [PATCH] Updating ChipDeviceCtrl and TC_CADMIN_1_3_4 modules: - 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() --- src/controller/python/chip/ChipDeviceCtrl.py | 12 ++---------- src/python_testing/TC_CADMIN_1_3_4.py | 10 ++++++---- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index 7aee0710f9b070..92842c50361655 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -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: @@ -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: diff --git a/src/python_testing/TC_CADMIN_1_3_4.py b/src/python_testing/TC_CADMIN_1_3_4.py index 10a12897ab89a6..9748c42b22cf8c 100644 --- a/src/python_testing/TC_CADMIN_1_3_4.py +++ b/src/python_testing/TC_CADMIN_1_3_4.py @@ -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] @@ -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]