diff --git a/src/tools/PICS-generator/PICSGenerator.py b/src/tools/PICS-generator/PICSGenerator.py index aa774f9cb127e3..2b646623ca1d13 100644 --- a/src/tools/PICS-generator/PICSGenerator.py +++ b/src/tools/PICS-generator/PICSGenerator.py @@ -47,6 +47,10 @@ def GenerateDevicePicsXmlFiles(clusterName, clusterPicsCode, featurePicsList, at nodeOperationalCredentialsCluster = "Node Operational Credentials Cluster" basicInformationCluster = "Basic Information Cluster" networkCommissioningCluster = "Network Commissioning Cluster" + diagnosticLogsCluster = "Diagnostic Logs Cluster" + thermostatUserInterfaceConfigurationCluster = "Thermostat User Interface Configuration Cluster" + wakeOnLANCluster = "Wake On LAN Cluster" + lowPowerCluster = "Low Power Cluster" if otaProviderCluster in clusterName or otaRequestorCluster in clusterName: clusterName = "OTA Software Update" @@ -57,6 +61,15 @@ def GenerateDevicePicsXmlFiles(clusterName, clusterPicsCode, featurePicsList, at elif groupKeyManagementCluster == clusterName: clusterName = "Group Communication" + elif diagnosticLogsCluster == clusterName: + clusterName = "Diagnostics Logs Cluster" + + elif thermostatUserInterfaceConfigurationCluster == clusterName: + clusterName = "Thermostat User Configuration Cluster" + + elif wakeOnLANCluster == clusterName or lowPowerCluster == clusterName: + clusterName = "Media Cluster" + elif nodeOperationalCredentialsCluster == clusterName or basicInformationCluster == clusterName or networkCommissioningCluster == clusterName: clusterName = clusterName.replace("Cluster", "").strip() @@ -255,9 +268,14 @@ async def DeviceMapping(devCtrl, nodeID, outputPathStr): acceptedCommandListPicsList = [] generatedCommandListPicsList = [] - clusterClass = getattr(Clusters, devCtrl.GetClusterHandler().GetClusterInfoById(server)['clusterName']) clusterID = f"0x{server:04x}" + try: + clusterClass = getattr(Clusters, devCtrl.GetClusterHandler().GetClusterInfoById(server)['clusterName']) + except AttributeError: + console.print(f"[red]Cluster class not found for ({clusterID}) not found! ❌") + continue + # Does the clusterInfoDict contain the found cluster ID? if clusterID not in clusterInfoDict: console.print(f"[red]Cluster ID ({clusterID}) not in list! ❌") @@ -372,6 +390,7 @@ def cleanDirectory(pathToClean): baseOutputPathStr = args.pics_output if not baseOutputPathStr.endswith('/'): baseOutputPathStr += '/' +outputPathStr = baseOutputPathStr + "GeneratedPICS/" serverTag = ".S" clientTag = ".C" @@ -421,13 +440,15 @@ def cleanDirectory(pathToClean): xmlFileList = os.listdir(xmlTemplatePathStr) # Setup output path -baseOutputPath = pathlib.Path(baseOutputPathStr) -if not baseOutputPath.exists(): +print(outputPathStr) + +outputPath = pathlib.Path(outputPathStr) +if not outputPath.exists(): print("Create output folder") - baseOutputPath.mkdir() + outputPath.mkdir() else: print("Clean output folder") - cleanDirectory(baseOutputPath) + cleanDirectory(outputPath) class DeviceMappingTest(MatterBaseTest): @@ -439,7 +460,7 @@ async def test_device_mapping(self): console = Console() # Run device mapping function - await DeviceMapping(self.default_controller, self.dut_node_id, baseOutputPathStr) + await DeviceMapping(self.default_controller, self.dut_node_id, outputPathStr) if __name__ == "__main__": diff --git a/src/tools/PICS-generator/README.md b/src/tools/PICS-generator/README.md index 1f5964d80e9b5e..d9a4d56ba037aa 100644 --- a/src/tools/PICS-generator/README.md +++ b/src/tools/PICS-generator/README.md @@ -46,6 +46,12 @@ certification) # How to run +First change the directory to the tool location. + +``` +cd src/tools/PICS-generator/ +``` + The tool does, as mentioned above, have external dependencies, these are provided to the tool using these arguments: @@ -59,7 +65,7 @@ If the device has not been commissioned this can be done by passing in the commissioning information: ``` -python3 'src/python_testing/PICSGenerator.py' --cluster-data --pics-template --pics-output --commissioning-method ble-thread --discriminator --passcode --thread-dataset-hex +python3 PICSGenerator.py --cluster-data --pics-template --pics-output --commissioning-method ble-thread --discriminator --passcode --thread-dataset-hex ``` In case the device uses a development PAA, the following parameter should be @@ -79,5 +85,5 @@ added. If a device has already been commissioned, the tool can be executed like this: ``` -python3 'src/python_testing/PICSGenerator.py' --cluster-data --pics-template --pics-output +python3 PICSGenerator.py --cluster-data --pics-template --pics-output ```