21
21
from matter_testing_support import MatterBaseTest , async_test_body , default_matter_test_main
22
22
from mobly import asserts
23
23
24
+
24
25
class TC_IDM_2_2 (MatterBaseTest ):
25
26
26
27
ROOT_NODE_ENDPOINT_ID = 0
@@ -37,9 +38,9 @@ def get_typed_attribute_path(attribute, ep=ROOT_NODE_ENDPOINT_ID):
37
38
@async_test_body
38
39
async def test_TC_IDM_2_2 (self ):
39
40
# Test Setup
40
- cluster_rev_attr = Clusters .BasicInformation .Attributes .ClusterRevision # Global attribute
41
+ cluster_rev_attr = Clusters .BasicInformation .Attributes .ClusterRevision # Global attribute
41
42
cluster_rev_attr_path = [(cluster_rev_attr )]
42
- node_label_attr = Clusters .BasicInformation .Attributes .NodeLabel # Borrowed from TC_IDM_4_2
43
+ node_label_attr = Clusters .BasicInformation .Attributes .NodeLabel # Borrowed from TC_IDM_4_2
43
44
node_label_attr_path = [(0 , node_label_attr )]
44
45
node_label_attr_all = Clusters .BasicInformation
45
46
node_label_attr_all_path = [(0 , node_label_attr_all )]
@@ -57,82 +58,89 @@ async def test_TC_IDM_2_2(self):
57
58
# AttributePath = [[Endpoint = Specific Endpoint, Cluster = Specific ClusterID, Attribute = Specific Attribute]]
58
59
# On receipt of this message, DUT should send a report data action with the attribute value to the DUT
59
60
60
- read_request_1 = await self .default_controller .ReadAttribute (self .dut_node_id , node_label_attr_path ) # [(0, Clusters.BasicInformation.Attributes.NodeLabel)]
61
+ # [(0, Clusters.BasicInformation.Attributes.NodeLabel)]
62
+ read_request_1 = await self .default_controller .ReadAttribute (self .dut_node_id , node_label_attr_path )
61
63
attributes = read_request_1 [0 ]
62
64
basic_information = attributes [basic_info_attr ]
63
65
64
66
asserts .assert_in (node_label_attr , basic_information , "NodeLabel not in BasicInformation" )
65
67
asserts .assert_in (data_version_attr , basic_information , "DataVersion not in BasicInformation" )
66
68
67
- ### TH sends the Read Request Message to the DUT to read all attributes on a given cluster and Endpoint
68
- ### AttributePath = [[Endpoint = Specific Endpoint, Cluster = Specific ClusterID]]
69
- ### On receipt of this message, DUT should send a report data action with the attribute value to the DUT.
69
+ # TH sends the Read Request Message to the DUT to read all attributes on a given cluster and Endpoint
70
+ # AttributePath = [[Endpoint = Specific Endpoint, Cluster = Specific ClusterID]]
71
+ # On receipt of this message, DUT should send a report data action with the attribute value to the DUT.
70
72
71
73
self .print_step (2 , "Send Request Message to read all attributes on a given cluster and endpoint" )
72
74
asserts .assert_in (node_label_attr , basic_information , "AttributeList not in attributes" )
73
- read_request_2 = await self .default_controller .ReadAttribute (self .dut_node_id , node_label_attr_all_path ) # [(0, Clusters.BasicInformation)]
75
+ # [(0, Clusters.BasicInformation)]
76
+ read_request_2 = await self .default_controller .ReadAttribute (self .dut_node_id , node_label_attr_all_path )
74
77
attributes = read_request_2 [0 ]
75
78
basic_information = attributes [basic_info_attr ]
76
79
asserts .assert_in (node_label_attr , basic_information , "NodeLabel not in BasicInformation" )
77
80
asserts .assert_in (data_version_attr , basic_information , "DataVersion not in BasicInformation" )
78
81
# The output from this command gets many more values from basic_info_attr compared to the first test -- get attribute list, expand test if needed
79
82
asserts .assert_in (attribute_list_attr , basic_information , "AttributeList not in BasicInformation" )
80
83
81
- ### TH sends the Read Request Message to the DUT to read an attribute from a cluster at all Endpoints
82
- ### AttributePath = [[Cluster = Specific ClusterID, Attribute = Specific Attribute]]
83
- ### On receipt of this message, DUT should send a report data action with the attribute value from all the Endpoints to the DUT.
84
+ # TH sends the Read Request Message to the DUT to read an attribute from a cluster at all Endpoints
85
+ # AttributePath = [[Cluster = Specific ClusterID, Attribute = Specific Attribute]]
86
+ # On receipt of this message, DUT should send a report data action with the attribute value from all the Endpoints to the DUT.
84
87
self .print_step (3 , "Send Request Message to read one attribute on a given cluster at all endpoints" )
85
- read_request_3 = await self .default_controller .ReadAttribute (self .dut_node_id , [node_label_attr ]) # [Clusters.BasicInformation.Attributes.NodeLabel]
88
+ # [Clusters.BasicInformation.Attributes.NodeLabel]
89
+ read_request_3 = await self .default_controller .ReadAttribute (self .dut_node_id , [node_label_attr ])
86
90
attributes = read_request_3 [0 ]
87
91
asserts .assert_in (node_label_attr , basic_information , "NodeLabel not in BasicInformation" )
88
92
89
- ### TH sends the Read Request Message to the DUT to read a global attribute from all clusters at that Endpoint
90
- ### AttributePath = [[Endpoint = Specific Endpoint, Attribute = Specific Global Attribute]]
91
- ### On receipt of this message, DUT should send a report data action with the attribute value from all the clusters to the DUT.
93
+ # TH sends the Read Request Message to the DUT to read a global attribute from all clusters at that Endpoint
94
+ # AttributePath = [[Endpoint = Specific Endpoint, Attribute = Specific Global Attribute]]
95
+ # On receipt of this message, DUT should send a report data action with the attribute value from all the clusters to the DUT.
92
96
self .print_step (4 , "Send Request Message to read one global attribute from all clusters at that endpoint" )
93
97
# The output from this command gets many more values from unit_testing_attr compared to the some other tests
94
- read_request_4 = await self .default_controller .ReadAttribute (self .dut_node_id , cluster_rev_attr_path ) # [(Clusters.BasicInformation.Attributes.ClusterRevision)]
98
+ # [(Clusters.BasicInformation.Attributes.ClusterRevision)]
99
+ read_request_4 = await self .default_controller .ReadAttribute (self .dut_node_id , cluster_rev_attr_path )
95
100
attributes = read_request_4 [0 ]
96
101
basic_information = attributes [basic_info_attr ]
97
102
asserts .assert_true (basic_information [cluster_revision_attr ], 3 )
98
103
99
- ### TH sends the Read Request Message to the DUT to read all attributes from all clusters on all Endpoints
104
+ # TH sends the Read Request Message to the DUT to read all attributes from all clusters on all Endpoints
100
105
### AttributePath = [[]]
101
- ### On receipt of this message, DUT should send a report data action with the attribute value from all the clusters to the DUT.
106
+ # On receipt of this message, DUT should send a report data action with the attribute value from all the clusters to the DUT.
102
107
self .print_step (5 , "Send Request Message to read all attributes from all clusters on all endpoints" )
103
- read_request_5 = await self .default_controller .ReadAttribute (self .dut_node_id , [()]) # This returns a dataclass key of 1, unlike 0 for the earlier ones
108
+ # This returns a dataclass key of 1, unlike 0 for the earlier ones
109
+ read_request_5 = await self .default_controller .ReadAttribute (self .dut_node_id , [()])
104
110
attributes = read_request_5 [1 ]
105
111
unit_testing = attributes [unit_testing_attr ]
106
112
107
113
# asserts.assert_in(node_label_attr, unit_testing, "NodeLabel not in UnitTesting")
108
114
asserts .assert_in (data_version_attr , unit_testing , "DataVersion not in UnitTesting" )
109
- ### TH sends the Read Request Message to the DUT to read a global attribute from all clusters at all Endpoints
110
- ### AttributePath = [[Attribute = Specific Global Attribute]]
111
- ### On receipt of this message, DUT should send a report data action with the attribute value from all the clusters to the DUT.
115
+ # TH sends the Read Request Message to the DUT to read a global attribute from all clusters at all Endpoints
116
+ # AttributePath = [[Attribute = Specific Global Attribute]]
117
+ # On receipt of this message, DUT should send a report data action with the attribute value from all the clusters to the DUT.
112
118
self .print_step (6 , "Send Request Message to read one global attribute from all clusters on all endpoints" )
113
- read_request_6 = await self .default_controller .ReadAttribute (self .dut_node_id , [cluster_rev_attr ]) # Clusters.BasicInformation.Attributes.ClusterRevision
119
+ # Clusters.BasicInformation.Attributes.ClusterRevision
120
+ read_request_6 = await self .default_controller .ReadAttribute (self .dut_node_id , [cluster_rev_attr ])
114
121
115
122
attributes = read_request_6 [0 ]
116
123
basic_information = attributes [basic_info_attr ]
117
124
# asserts.assert_in(node_label_attr, basic_information, "NodeLabel not in BasicInformation")
118
125
asserts .assert_in (data_version_attr , basic_information , "DataVersion not in BasicInformation" )
119
126
asserts .assert_true (basic_information [cluster_revision_attr ], 3 )
120
127
121
- ### TH sends the Read Request Message to the DUT to read all attributes from a cluster at all Endpoints
122
- ### AttributePath = [[Cluster = Specific ClusterID]]
123
- ### On receipt of this message, DUT should send a report data action with the attribute value from all the Endpoints to the DUT.
128
+ # TH sends the Read Request Message to the DUT to read all attributes from a cluster at all Endpoints
129
+ # AttributePath = [[Cluster = Specific ClusterID]]
130
+ # On receipt of this message, DUT should send a report data action with the attribute value from all the Endpoints to the DUT.
124
131
self .print_step (7 , "Send Request Message to read all attributes from one cluster at all endpoints" )
125
- read_request_7 = await self .default_controller .ReadAttribute (self .dut_node_id , [node_label_attr_all ]) # [Clusters.BasicInformation]
132
+ # [Clusters.BasicInformation]
133
+ read_request_7 = await self .default_controller .ReadAttribute (self .dut_node_id , [node_label_attr_all ])
126
134
attributes = read_request_7 [0 ]
127
135
basic_information = attributes [basic_info_attr ]
128
136
asserts .assert_in (node_label_attr , basic_information , "NodeLabel not in BasicInformation" )
129
137
asserts .assert_in (data_version_attr , basic_information , "DataVersion not in BasicInformation" )
130
138
# The output from this command gets many more values from basic_info_attr compared to the first test -- get attribute list, expand test if needed
131
139
asserts .assert_in (attribute_list_attr , basic_information , "AttributeList not in BasicInformation" )
132
140
133
- ### TH sends the Read Request Message to the DUT to read all attributes from all clusters at one Endpoint
134
- ### AttributePath = [[Endpoint = Specific Endpoint]]
135
- ### On receipt of this message, DUT should send a report data action with the attribute value from all the Endpoints to the DUT.
141
+ # TH sends the Read Request Message to the DUT to read all attributes from all clusters at one Endpoint
142
+ # AttributePath = [[Endpoint = Specific Endpoint]]
143
+ # On receipt of this message, DUT should send a report data action with the attribute value from all the Endpoints to the DUT.
136
144
self .print_step (8 , "Send Request Message to read all attributes from all clusters at one endpoint" )
137
145
read_request_8 = await self .default_controller .ReadAttribute (self .dut_node_id , [0 ])
138
146
attributes = read_request_8 [0 ]
@@ -142,5 +150,6 @@ async def test_TC_IDM_2_2(self):
142
150
asserts .assert_in (data_version_attr , network_diagnostics , "DataVersion not in ThreadNetworkDiagnostics" )
143
151
asserts .assert_in (attribute_list_attr , basic_information , "AttributeList not in BasicInformation" )
144
152
153
+
145
154
if __name__ == "__main__" :
146
- default_matter_test_main ()
155
+ default_matter_test_main ()
0 commit comments