Skip to content

Commit

Permalink
Change function name to more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
cecille committed Sep 4, 2024
1 parent acb3eb8 commit 7f21c79
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/python_testing/TC_DeviceConformance.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ def _get_device_type_id(self, device_type_name: str) -> int:
self.fail_current_test(f"Unable to find {device_type_name} device type")
return id[0]

def _has_nim(self):
nim_id = self._get_device_type_id('network infrastructure manager')
def _has_device_type_supporting_macl(self):
# Currently this is just NIM. We may later be able to pull this from the device type scrape using the ManagedAclAllowed condition,
# but these are not currently exposed directly by the device.
allowed_ids = [self._get_device_type_id('network infrastructure manager')]
for endpoint in self.endpoints_tlv.values():
desc = Clusters.Descriptor
device_types = [dt.deviceType for dt in endpoint[desc.id][desc.Attributes.DeviceTypeList.attribute_id]]
if nim_id in device_types:
if set(allowed_ids).intersection(set(device_types)):
# TODO: it's unclear if this needs to be present on every endpoint. Right now, this assumes one is sufficient.
return True
return False
Expand Down Expand Up @@ -138,9 +140,9 @@ def record_warning(location, problem):
attribute_id=GlobalAttributeIds.FEATURE_MAP_ID)
if cluster_id == Clusters.AccessControl.id and f == Clusters.AccessControl.Bitmaps.Feature.kManagedDevice:
# Managed ACL is treated as a special case because it is only allowed if other endpoints support NIM and disallowed otherwise.
if not self._has_nim():
if not self._has_device_type_supporting_macl():
record_error(
location=location, problem="MACL feature is disallowed if the Network Infrastructure Manager device type is not present")
location=location, problem="MACL feature is disallowed if the a supported device type is not present")
continue

if f not in self.xml_clusters[cluster_id].features.keys():
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TestConformanceTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ async def test_macl_handling(self):
root = self._create_minimal_dt(device_type_id=root_node_id)
nim = self._create_minimal_dt(device_type_id=nim_id)
self.endpoints_tlv = {0: root, 1: nim}
asserts.assert_true(self._has_nim(), "Did not find NIM in generated device")
asserts.assert_true(self._has_device_type_supporting_macl(), "Did not find supported device in generated device")

success, problems = self.check_conformance(ignore_in_progress=False, is_ci=False, allow_provisional=True)
self.problems.extend(problems)
Expand Down

0 comments on commit 7f21c79

Please sign in to comment.