Skip to content

Commit

Permalink
DM XMLs: rename in-progress directory to 1.4
Browse files Browse the repository at this point in the history
Also flip the default in the spec parsing to use 1.4
  • Loading branch information
cecille committed Sep 30, 2024
1 parent da6df48 commit ccffd58
Show file tree
Hide file tree
Showing 196 changed files with 16 additions and 16 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 11 additions & 11 deletions src/python_testing/TestSpecParsingSupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,21 +259,21 @@ def test_build_xml_override(self):
# checks that the 1.3 spec (default) does not contain in-progress clusters and the TOT does
tot_xml_clusters, problems = build_xml_clusters(PrebuiltDataModelDirectory.kMaster)
one_three_clusters, problems = build_xml_clusters(PrebuiltDataModelDirectory.k1_3)
in_progress, problems = build_xml_clusters(PrebuiltDataModelDirectory.kInProgress)
one_four_clusters, problems = build_xml_clusters(PrebuiltDataModelDirectory.k1_4)
asserts.assert_greater(len(set(tot_xml_clusters.keys()) - set(one_three_clusters.keys())),
0, "Master dir does not contain any clusters not in 1.3")
asserts.assert_greater(len(set(tot_xml_clusters.keys()) - set(in_progress.keys())),
0, "Master dir does not contain any clusters not in in_progress")
asserts.assert_greater(len(set(in_progress.keys()) - set(one_three_clusters.keys())),
0, "in_progress dir does not contain any clusters not in 1.3")
asserts.assert_greater(len(set(tot_xml_clusters.keys()) - set(one_four_clusters.keys())),
0, "Master dir does not contain any clusters not in 1.4")
asserts.assert_greater(len(set(one_four_clusters.keys()) - set(one_three_clusters.keys())),
0, "1.4 dir does not contain any clusters not in 1.3")
# only the pulse width modulation cluster was removed post 1.3
asserts.assert_equal(set(one_three_clusters.keys()) - set(tot_xml_clusters.keys()),
set([Clusters.PulseWidthModulation.id]), "There are some 1.3 clusters that are not included in the TOT spec")
asserts.assert_equal(set(in_progress.keys())-set(tot_xml_clusters.keys()),
set(), "There are some in_progress clusters that are not included in the TOT spec")
asserts.assert_equal(set(one_four_clusters.keys())-set(tot_xml_clusters.keys()),
set(), "There are some 1.4 clusters that are not included in the TOT spec")

str_path = str(os.path.join(os.path.dirname(os.path.realpath(__file__)),
'..', '..', 'data_model', 'in_progress', 'clusters'))
'..', '..', 'data_model', '1.4', 'clusters'))
string_override_check, problems = build_xml_clusters(str_path)
asserts.assert_equal(string_override_check.keys(), self.spec_xml_clusters.keys(), "Mismatched cluster generation")

Expand Down Expand Up @@ -466,18 +466,18 @@ def test_provisional_clusters(self):
def test_atomic_thermostat(self):
tot_xml_clusters, problems = build_xml_clusters(PrebuiltDataModelDirectory.kMaster)
one_three_clusters, problems = build_xml_clusters(PrebuiltDataModelDirectory.k1_3)
in_progress, problems = build_xml_clusters(PrebuiltDataModelDirectory.kInProgress)
one_four_clusters, problems = build_xml_clusters(PrebuiltDataModelDirectory.k1_4)

asserts.assert_in("Atomic Request", tot_xml_clusters[Clusters.Thermostat.id].command_map,
"Atomic request not found on thermostat command map")
request_id = tot_xml_clusters[Clusters.Thermostat.id].command_map["Atomic Request"]
asserts.assert_in(request_id, tot_xml_clusters[Clusters.Thermostat.id].accepted_commands.keys(),
"Atomic request not found in thermostat accepted command list")

asserts.assert_in("Atomic Response", tot_xml_clusters[Clusters.Thermostat.id].command_map,
asserts.assert_in("Atomic Response", one_four_clusters[Clusters.Thermostat.id].command_map,
"Atomic response not found in the thermostat command map")
response_id = tot_xml_clusters[Clusters.Thermostat.id].command_map["Atomic Response"]
asserts.assert_in(response_id, tot_xml_clusters[Clusters.Thermostat.id].generated_commands.keys(),
asserts.assert_in(response_id, one_four_clusters[Clusters.Thermostat.id].generated_commands.keys(),
"Atomic response not found in thermostat generated command list")

asserts.assert_not_in(
Expand Down
10 changes: 5 additions & 5 deletions src/python_testing/spec_parsing_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def check_clusters_for_unknown_commands(clusters: dict[int, XmlCluster], problem

class PrebuiltDataModelDirectory(Enum):
k1_3 = auto()
kInProgress = auto()
k1_4 = auto()
kMaster = auto()


Expand All @@ -521,15 +521,15 @@ class DataModelLevel(str, Enum):
def _get_data_model_directory(data_model_directory: typing.Union[PrebuiltDataModelDirectory, str], data_model_level: DataModelLevel) -> str:
if data_model_directory == PrebuiltDataModelDirectory.k1_3:
return os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'data_model', '1.3', data_model_level)
elif data_model_directory == PrebuiltDataModelDirectory.kInProgress:
return os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'data_model', 'in_progress', data_model_level)
elif data_model_directory == PrebuiltDataModelDirectory.k1_4:
return os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'data_model', '1.4', data_model_level)
elif data_model_directory == PrebuiltDataModelDirectory.kMaster:
return os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'data_model', 'master', data_model_level)
else:
return data_model_directory


def build_xml_clusters(data_model_directory: typing.Union[PrebuiltDataModelDirectory, str] = PrebuiltDataModelDirectory.kInProgress) -> tuple[dict[uint, XmlCluster], list[ProblemNotice]]:
def build_xml_clusters(data_model_directory: typing.Union[PrebuiltDataModelDirectory, str] = PrebuiltDataModelDirectory.k1_4) -> tuple[dict[uint, XmlCluster], list[ProblemNotice]]:
dir = _get_data_model_directory(data_model_directory, DataModelLevel.kCluster)

clusters: dict[int, XmlCluster] = {}
Expand Down Expand Up @@ -776,7 +776,7 @@ def parse_single_device_type(root: ElementTree.Element) -> tuple[list[ProblemNot
return device_types, problems


def build_xml_device_types(data_model_directory: typing.Union[PrebuiltDataModelDirectory, str] = PrebuiltDataModelDirectory.kInProgress) -> tuple[dict[int, XmlDeviceType], list[ProblemNotice]]:
def build_xml_device_types(data_model_directory: typing.Union[PrebuiltDataModelDirectory, str] = PrebuiltDataModelDirectory.k1_4) -> tuple[dict[int, XmlDeviceType], list[ProblemNotice]]:
dir = _get_data_model_directory(data_model_directory, DataModelLevel.kDeviceType)
device_types: dict[int, XmlDeviceType] = {}
problems = []
Expand Down

0 comments on commit ccffd58

Please sign in to comment.