@@ -40,36 +40,35 @@ async def test_TC_PWRTL_2_1(self):
40
40
41
41
attributes = Clusters .PowerTopology .Attributes
42
42
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
44
50
45
51
self .print_step (1 , "Commissioning, already done" )
46
52
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
-
51
53
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 )
61
56
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 ))
65
63
66
64
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 ))
69
68
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 )
73
72
74
73
75
74
if __name__ == "__main__" :
0 commit comments