Skip to content

Commit 1b71be4

Browse files
authored
[TC_AccessChecker] Add clearer logs when global attributes are missing. (#42344)
* Add clear logs when global attributes are missing. This is a convenience change: if global attributes are missing, access checker errors are hard to read. this makes them easy to read. * Fix location.
1 parent b4538e3 commit 1b71be4

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/python_testing/TC_AccessChecker.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,23 @@ def _record_errors(self):
167167
attrs[cluster_id] = set()
168168
if cluster_id not in cmds:
169169
cmds[cluster_id] = set()
170-
# discard MEI attributes as we do not have access information for them.
171-
attrs[cluster_id].update(
172-
{id for id in device_cluster_data[GlobalAttributeIds.ATTRIBUTE_LIST_ID] if is_standard_attribute_id(id)})
173-
cmds[cluster_id].update(
174-
{id for id in device_cluster_data[GlobalAttributeIds.ACCEPTED_COMMAND_LIST_ID] if is_standard_command_id(id)})
170+
171+
if GlobalAttributeIds.ATTRIBUTE_LIST_ID not in device_cluster_data:
172+
location = ClusterPathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id)
173+
self.record_error(test_name="Access Checker", location=location,
174+
problem="Cluster does not have the AttributeList attribute")
175+
else:
176+
# discard MEI attributes as we do not have access information for them.
177+
attrs[cluster_id].update(
178+
{id for id in device_cluster_data[GlobalAttributeIds.ATTRIBUTE_LIST_ID] if is_standard_attribute_id(id)})
179+
180+
if GlobalAttributeIds.ACCEPTED_COMMAND_LIST_ID not in device_cluster_data:
181+
location = ClusterPathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id)
182+
self.record_error(test_name="Access Checker", location=location,
183+
problem="Cluster does not have the AcceptedCommandList attribute")
184+
else:
185+
cmds[cluster_id].update(
186+
{id for id in device_cluster_data[GlobalAttributeIds.ACCEPTED_COMMAND_LIST_ID] if is_standard_command_id(id)})
175187

176188
# Remove MEI clusters - we don't have information available to check these.
177189
all_clusters = [id for id in all_clusters if is_standard_cluster_id(id)]

0 commit comments

Comments
 (0)