Skip to content

Commit 6128265

Browse files
Add a step to verify DUT SpecificationVersion before running the new test steps (#71371)
* Add a step to verify DUT SpecificationVersion before running the new test steps for 1.6 and above * Apply suggestion to avoid failure in case SpecificationVersion is not present on DUT with version pre 1.3
1 parent f403ecc commit 6128265

File tree

1 file changed

+35
-32
lines changed

1 file changed

+35
-32
lines changed

src/python_testing/TC_DeviceBasicComposition.py

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -341,39 +341,42 @@ def test_TC_SM_1_1(self):
341341
problem=f'Root node does not contain required cluster {c}', spec_location="Root node device type")
342342
self.fail_current_test()
343343

344-
groupcast_feature_map = 0
345-
if Clusters.Groupcast in root:
346-
groupcast_feature_map = root[Clusters.Groupcast][Clusters.Groupcast.Attributes.FeatureMap]
347-
has_groupcast_listener = bool(groupcast_feature_map & Clusters.Groupcast.Bitmaps.Feature.kListener)
348-
has_groupcast_sender = bool(groupcast_feature_map & Clusters.Groupcast.Bitmaps.Feature.kSender)
349-
350-
self.print_step(6, "Verify GroupcastListenerCond: if any endpoint has Groups server, "
351-
"Groupcast with Listener feature must be on EP0")
352-
has_groups_server = any(
353-
Clusters.Groups in self.endpoints[ep_id]
354-
for ep_id in self.endpoints if ep_id != 0
355-
)
356-
log.info(f"has_groups_server: {has_groups_server}, has_groupcast_listener: {has_groupcast_listener}")
357-
if has_groups_server and not has_groupcast_listener:
358-
self.record_error(self.get_test_name(), location=AttributePathLocation(endpoint_id=0),
359-
problem="Groups server found on an endpoint but Groupcast cluster with Listener "
360-
"feature is not present on the root node (EP0)",
361-
spec_location="Root node device type - GroupcastListenerCond")
362-
self.fail_current_test()
344+
self.print_step(6, "Verify that the specification version is 1.6 or above for the next steps")
345+
specification_version = root[Clusters.BasicInformation].get(Clusters.BasicInformation.Attributes.SpecificationVersion, 0)
346+
if specification_version >= 0x01060000:
347+
groupcast_feature_map = 0
348+
if Clusters.Groupcast in root:
349+
groupcast_feature_map = root[Clusters.Groupcast][Clusters.Groupcast.Attributes.FeatureMap]
350+
has_groupcast_listener = bool(groupcast_feature_map & Clusters.Groupcast.Bitmaps.Feature.kListener)
351+
has_groupcast_sender = bool(groupcast_feature_map & Clusters.Groupcast.Bitmaps.Feature.kSender)
352+
353+
self.print_step(7, "Verify GroupcastListenerCond: if any endpoint has Groups server, "
354+
"Groupcast with Listener feature must be on EP0")
355+
has_groups_server = any(
356+
Clusters.Groups in self.endpoints[ep_id]
357+
for ep_id in self.endpoints if ep_id != 0
358+
)
359+
log.info(f"has_groups_server: {has_groups_server}, has_groupcast_listener: {has_groupcast_listener}")
360+
if has_groups_server and not has_groupcast_listener:
361+
self.record_error(self.get_test_name(), location=AttributePathLocation(endpoint_id=0),
362+
problem="Groups server found on an endpoint but Groupcast cluster with Listener "
363+
"feature is not present on the root node (EP0)",
364+
spec_location="Root node device type - GroupcastListenerCond")
365+
self.fail_current_test()
363366

364-
self.print_step(7, "Verify GroupcastSenderCond: if any endpoint has Binding server, "
365-
"Groupcast with Sender feature must be on EP0")
366-
has_binding_server = any(
367-
Clusters.Binding in self.endpoints[ep_id]
368-
for ep_id in self.endpoints if ep_id != 0
369-
)
370-
log.info(f"has_binding_server: {has_binding_server}, has_groupcast_sender: {has_groupcast_sender}")
371-
if has_binding_server and not has_groupcast_sender:
372-
self.record_error(self.get_test_name(), location=AttributePathLocation(endpoint_id=0),
373-
problem="Binding server found on an endpoint but Groupcast cluster with Sender "
374-
"feature is not present on the root node (EP0)",
375-
spec_location="Root node device type - GroupcastSenderCond")
376-
self.fail_current_test()
367+
self.print_step(8, "Verify GroupcastSenderCond: if any endpoint has Binding server, "
368+
"Groupcast with Sender feature must be on EP0")
369+
has_binding_server = any(
370+
Clusters.Binding in self.endpoints[ep_id]
371+
for ep_id in self.endpoints if ep_id != 0
372+
)
373+
log.info(f"has_binding_server: {has_binding_server}, has_groupcast_sender: {has_groupcast_sender}")
374+
if has_binding_server and not has_groupcast_sender:
375+
self.record_error(self.get_test_name(), location=AttributePathLocation(endpoint_id=0),
376+
problem="Binding server found on an endpoint but Groupcast cluster with Sender "
377+
"feature is not present on the root node (EP0)",
378+
spec_location="Root node device type - GroupcastSenderCond")
379+
self.fail_current_test()
377380

378381
def test_TC_DT_1_1(self):
379382
self.print_step(1, "Perform a wildcard read of attributes on all endpoints - already done")

0 commit comments

Comments
 (0)