Skip to content

Commit 7f21c79

Browse files
committedSep 4, 2024·
Change function name to more generic

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed
 

‎src/python_testing/TC_DeviceConformance.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,14 @@ def _get_device_type_id(self, device_type_name: str) -> int:
5656
self.fail_current_test(f"Unable to find {device_type_name} device type")
5757
return id[0]
5858

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

146148
if f not in self.xml_clusters[cluster_id].features.keys():

‎src/python_testing/TestConformanceTest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ async def test_macl_handling(self):
211211
root = self._create_minimal_dt(device_type_id=root_node_id)
212212
nim = self._create_minimal_dt(device_type_id=nim_id)
213213
self.endpoints_tlv = {0: root, 1: nim}
214-
asserts.assert_true(self._has_nim(), "Did not find NIM in generated device")
214+
asserts.assert_true(self._has_device_type_supporting_macl(), "Did not find supported device in generated device")
215215

216216
success, problems = self.check_conformance(ignore_in_progress=False, is_ci=False, allow_provisional=True)
217217
self.problems.extend(problems)

0 commit comments

Comments
 (0)
Please sign in to comment.