Skip to content

Commit 114c6ff

Browse files
committed
Created possible fix for issue #229:
- Removed PICS if statements from TC_PWRTL_2_1 test module - Added if statements to check if attribute ID's for available and active endpoints gathered from DUT's are contained in attribute list - Updated method from NullValue to also include checking for empty lists from DUT's for available and active endpoints
1 parent 2908685 commit 114c6ff

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

src/python_testing/TC_PWRTL_2_1.py

+21-22
Original file line numberDiff line numberDiff line change
@@ -40,36 +40,35 @@ async def test_TC_PWRTL_2_1(self):
4040

4141
attributes = Clusters.PowerTopology.Attributes
4242

43-
endpoint = self.user_params.get("endpoint", 1)
43+
endpoint = 1
44+
45+
powertop_attr_list = Clusters.Objects.PowerTopology.Attributes.AttributeList
46+
powertop_cluster = Clusters.Objects.PowerTopology
47+
attribute_list = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=powertop_cluster, attribute=powertop_attr_list)
48+
avail_endpoints_attr_id = Clusters.Objects.PowerTopology.Attributes.ActiveEndpoints.attribute_id
49+
act_endpoints_attr_id = Clusters.Objects.PowerTopology.Attributes.AvailableEndpoints.attribute_id
4450

4551
self.print_step(1, "Commissioning, already done")
4652

47-
if not self.check_pics("PWRTL.S.A0000"):
48-
logging.info("Test skipped because PICS PWRTL.S.A0000 is not set")
49-
return
50-
5153
self.print_step(2, "Read AvailableAttributes attribute")
52-
available_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology, attribute=attributes.AvailableEndpoints)
53-
54-
if available_endpoints == NullValue:
55-
logging.info("AvailableEndpoints is null")
56-
else:
57-
logging.info("AvailableEndpoints: %s" % (available_endpoints))
58-
59-
asserts.assert_less_equal(len(available_endpoints), 21,
60-
"AvailableEndpoints length %d must be less than 21!" % len(available_endpoints))
54+
if avail_endpoints_attr_id in attribute_list:
55+
available_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology, attribute=attributes.AvailableEndpoints)
6156

62-
if not self.check_pics("PWRTL.S.A0001"):
63-
logging.info("Test skipped because PICS PWRTL.S.A0001 is not set")
64-
return
57+
if available_endpoints == NullValue or available_endpoints == []:
58+
logging.info("AvailableEndpoints is null or an empty list")
59+
else:
60+
logging.info("AvailableEndpoints: %s" % (available_endpoints))
61+
asserts.assert_less_equal(len(available_endpoints), 21,
62+
"AvailableEndpoints length %d must be less than 21!" % len(available_endpoints))
6563

6664
self.print_step(3, "Read ActiveEndpoints attribute")
67-
active_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology, attribute=attributes.ActiveEndpoints)
68-
logging.info("ActiveEndpoints: %s" % (active_endpoints))
65+
if act_endpoints_attr_id in attribute_list:
66+
active_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology, attribute=attributes.ActiveEndpoints)
67+
logging.info("ActiveEndpoints: %s" % (active_endpoints))
6968

70-
if available_endpoints == NullValue:
71-
asserts.assert_true(active_endpoints == NullValue,
72-
"ActiveEndpoints should be null when AvailableEndpoints is null: %s" % active_endpoints)
69+
if available_endpoints == NullValue or available_endpoints == []:
70+
asserts.assert_true(active_endpoints == NullValue or active_endpoints == [],
71+
"ActiveEndpoints should be null when AvailableEndpoints is null: %s" % active_endpoints)
7372

7473

7574
if __name__ == "__main__":

0 commit comments

Comments
 (0)