From 7f21c79071ee848e63fa9a843845c3e9b272b21c Mon Sep 17 00:00:00 2001 From: cecille Date: Wed, 4 Sep 2024 11:11:50 -0400 Subject: [PATCH] Change function name to more generic --- src/python_testing/TC_DeviceConformance.py | 12 +++++++----- src/python_testing/TestConformanceTest.py | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/python_testing/TC_DeviceConformance.py b/src/python_testing/TC_DeviceConformance.py index 50547a9abdc2ae..a6d6f19bfb53e7 100644 --- a/src/python_testing/TC_DeviceConformance.py +++ b/src/python_testing/TC_DeviceConformance.py @@ -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 @@ -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(): diff --git a/src/python_testing/TestConformanceTest.py b/src/python_testing/TestConformanceTest.py index 25271f7421f19d..5af8d1f639ef0c 100644 --- a/src/python_testing/TestConformanceTest.py +++ b/src/python_testing/TestConformanceTest.py @@ -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)