diff --git a/src/tools/PICS-generator/PICSGenerator.py b/src/tools/PICS-generator/PICSGenerator.py index 6cfb95803af52b..3e2bbe52a18c31 100644 --- a/src/tools/PICS-generator/PICSGenerator.py +++ b/src/tools/PICS-generator/PICSGenerator.py @@ -20,6 +20,7 @@ import pathlib import sys import xml.etree.ElementTree as ET +from pathlib import Path import chip.clusters as Clusters from pics_generator_support import map_cluster_name_to_pics_xml, pics_xml_file_list_loader @@ -28,7 +29,7 @@ # Add the path to python_testing folder, in order to be able to import from chip.testing.matter_testing sys.path.append(os.path.abspath(sys.path[0] + "/../../python_testing")) from chip.testing.matter_testing import MatterBaseTest, async_test_body, default_matter_test_main # noqa: E402 -from chip.testing.spec_parsing import build_xml_clusters # noqa: E402 +from chip.testing.spec_parsing import PrebuiltDataModelDirectory, build_xml_clusters # noqa: E402 console = None xml_clusters = None @@ -360,6 +361,7 @@ def cleanDirectory(pathToClean): parser = argparse.ArgumentParser() parser.add_argument('--pics-template', required=True) parser.add_argument('--pics-output', required=True) +parser.add_argument('--dm-xml') args, unknown = parser.parse_known_args() xmlTemplatePathStr = args.pics_template @@ -414,7 +416,10 @@ async def test_device_mapping(self): console = Console() global xml_clusters - xml_clusters, problems = build_xml_clusters() + if args.dm_xml: + xml_clusters, problems = build_xml_clusters(Path(f"{args.dm_xml}/clusters")) + else: + xml_clusters, problems = build_xml_clusters(PrebuiltDataModelDirectory.kMaster) # Run device mapping function await DeviceMapping(self.default_controller, self.dut_node_id, outputPathStr) diff --git a/src/tools/PICS-generator/README.md b/src/tools/PICS-generator/README.md index 312d790ca3109b..79579d5be2f4fb 100644 --- a/src/tools/PICS-generator/README.md +++ b/src/tools/PICS-generator/README.md @@ -86,6 +86,15 @@ If a device has already been commissioned, the tool can be executed like this: python3 PICSGenerator.py --pics-template --pics-output ``` +The tool can be used to validate against the available spec versions, this can +be done by providing the following tag in the command, if no path is provided it +will use the current scrape of Master. An example path is +"connectedhomeip/data_model/master". + +``` +python3 PICSGenerator.py --pics-template --dm +``` + # Updates for future releases Given each new release adds PICS files, to ensure the tool is able to map the @@ -102,3 +111,12 @@ To run the XMLPICSValidator, the following command can be used: ``` python3 XMLPICSValidator.py --pics-template ``` + +The tool can be used to validate against the available spec versions, this can +be done by providing the following tag in the command, if no path is provided it +will use the current scrape of Master. An example path is +"connectedhomeip/data_model/master". + +``` +python3 XMLPICSValidator.py --pics-template --dm +``` diff --git a/src/tools/PICS-generator/XMLPICSValidator.py b/src/tools/PICS-generator/XMLPICSValidator.py index 5fd170463d3e7a..b3a98d67470a73 100644 --- a/src/tools/PICS-generator/XMLPICSValidator.py +++ b/src/tools/PICS-generator/XMLPICSValidator.py @@ -18,15 +18,17 @@ import argparse import os import sys +from pathlib import Path from pics_generator_support import map_cluster_name_to_pics_xml, pics_xml_file_list_loader # Add the path to python_testing folder, in order to be able to import from matter_testing_support sys.path.append(os.path.abspath(sys.path[0] + "/../../python_testing")) -from chip.testing.spec_parsing import build_xml_clusters # noqa: E402 +from chip.testing.spec_parsing import PrebuiltDataModelDirectory, build_xml_clusters # noqa: E402 parser = argparse.ArgumentParser() parser.add_argument('--pics-template', required=True) +parser.add_argument('--dm-xml') args, unknown = parser.parse_known_args() xml_template_path_str = args.pics_template @@ -35,7 +37,11 @@ pics_xml_file_list = pics_xml_file_list_loader(xml_template_path_str, True) print("Build list of spec XML") -xml_clusters, problems = build_xml_clusters() +if args.dm_xml: + xml_clusters, problems = build_xml_clusters(Path(f"{args.dm_xml}/clusters")) +else: + xml_clusters, problems = build_xml_clusters(PrebuiltDataModelDirectory.kMaster) + for cluster in xml_clusters: pics_xml_file_name = map_cluster_name_to_pics_xml(xml_clusters[cluster].name, pics_xml_file_list) diff --git a/src/tools/PICS-generator/pics_generator_support.py b/src/tools/PICS-generator/pics_generator_support.py index 53e0248842ff64..af585118eecedd 100644 --- a/src/tools/PICS-generator/pics_generator_support.py +++ b/src/tools/PICS-generator/pics_generator_support.py @@ -24,6 +24,7 @@ "OTA Software Update Requestor": "OTA Software Update", "On/Off": "On-Off", "GroupKeyManagement": "Group Communication", + "Wake On LAN": "Media Cluster", "Wake on LAN": "Media Cluster", "Low Power": "Media Cluster", "Keypad Input": "Media Cluster",