16
16
#
17
17
18
18
from chip .testing .global_attribute_ids import (AttributeIdType , ClusterIdType , CommandIdType , DeviceTypeIdType , attribute_id_type ,
19
- cluster_id_type , command_id_type , device_type_id_type , is_valid_attribute_id ,
20
- is_valid_cluster_id , is_valid_command_id , is_valid_device_type_id )
19
+ cluster_id_type , command_id_type , device_type_id_type , is_standard_attribute_id ,
20
+ is_standard_cluster_id , is_standard_command_id , is_standard_device_type_id ,
21
+ is_valid_attribute_id , is_valid_cluster_id , is_valid_command_id ,
22
+ is_valid_device_type_id )
21
23
from chip .testing .matter_testing import MatterBaseTest , default_matter_test_main
22
24
from mobly import asserts
23
25
@@ -39,29 +41,33 @@ def check_standard(id):
39
41
id_type = device_type_id_type (id )
40
42
msg = f"Incorrect device type range assessment, expecting standard { id :08x} , type = { id_type } "
41
43
asserts .assert_equal (device_type_id_type (id ), DeviceTypeIdType .kStandard , msg )
42
- asserts .assert_true (is_valid_device_type_id (id_type , allow_test = True ), msg )
43
- asserts .assert_true (is_valid_device_type_id (id_type , allow_test = False ), msg )
44
+ asserts .assert_true (is_valid_device_type_id (id , allow_test = True ), msg )
45
+ asserts .assert_true (is_valid_device_type_id (id , allow_test = False ), msg )
46
+ asserts .assert_true (is_standard_device_type_id (id ), msg )
44
47
45
48
def check_manufacturer (id ):
46
49
id_type = device_type_id_type (id )
47
50
msg = f"Incorrect device type range assessment, expecting manufacturer { id :08x} , type = { id_type } "
48
51
asserts .assert_equal (device_type_id_type (id ), DeviceTypeIdType .kManufacturer , msg )
49
- asserts .assert_true (is_valid_device_type_id (id_type , allow_test = True ), msg )
50
- asserts .assert_true (is_valid_device_type_id (id_type , allow_test = False ), msg )
52
+ asserts .assert_true (is_valid_device_type_id (id , allow_test = True ), msg )
53
+ asserts .assert_true (is_valid_device_type_id (id , allow_test = False ), msg )
54
+ asserts .assert_false (is_standard_device_type_id (id ), msg )
51
55
52
56
def check_test (id ):
53
57
id_type = device_type_id_type (id )
54
58
msg = f"Incorrect device type range assessment, expecting test { id :08x} , type = { id_type } "
55
59
asserts .assert_equal (device_type_id_type (id ), DeviceTypeIdType .kTest , msg )
56
- asserts .assert_true (is_valid_device_type_id (id_type , allow_test = True ), msg )
57
- asserts .assert_false (is_valid_device_type_id (id_type , allow_test = False ), msg )
60
+ asserts .assert_true (is_valid_device_type_id (id , allow_test = True ), msg )
61
+ asserts .assert_false (is_valid_device_type_id (id , allow_test = False ), msg )
62
+ asserts .assert_false (is_standard_device_type_id (id ), msg )
58
63
59
64
def check_all_bad (id ):
60
65
id_type = device_type_id_type (id )
61
66
msg = f"Incorrect device type range assessment, expecting invalid { id :08x} , type = { id_type } "
62
67
asserts .assert_equal (device_type_id_type (id ), DeviceTypeIdType .kInvalid , msg )
63
- asserts .assert_false (is_valid_device_type_id (id_type , allow_test = True ), msg )
64
- asserts .assert_false (is_valid_device_type_id (id_type , allow_test = False ), msg )
68
+ asserts .assert_false (is_valid_device_type_id (id , allow_test = True ), msg )
69
+ asserts .assert_false (is_valid_device_type_id (id , allow_test = False ), msg )
70
+ asserts .assert_false (is_standard_device_type_id (id ), msg )
65
71
66
72
for id in standard_good :
67
73
check_standard (id )
@@ -100,29 +106,33 @@ def check_standard(id):
100
106
id_type = cluster_id_type (id )
101
107
msg = f"Incorrect cluster range assessment, expecting standard { id :08x} , type = { id_type } "
102
108
asserts .assert_equal (id_type , ClusterIdType .kStandard , msg )
103
- asserts .assert_true (is_valid_cluster_id (id_type , allow_test = True ), msg )
104
- asserts .assert_true (is_valid_cluster_id (id_type , allow_test = False ), msg )
109
+ asserts .assert_true (is_valid_cluster_id (id , allow_test = True ), msg )
110
+ asserts .assert_true (is_valid_cluster_id (id , allow_test = False ), msg )
111
+ asserts .assert_true (is_standard_cluster_id (id ), msg )
105
112
106
113
def check_manufacturer (id ):
107
114
id_type = cluster_id_type (id )
108
115
msg = f"Incorrect cluster range assessment, expecting manufacturer { id :08x} , type = { id_type } "
109
116
asserts .assert_equal (id_type , ClusterIdType .kManufacturer , msg )
110
- asserts .assert_true (is_valid_cluster_id (id_type , allow_test = True ), msg )
111
- asserts .assert_true (is_valid_cluster_id (id_type , allow_test = False ), msg )
117
+ asserts .assert_true (is_valid_cluster_id (id , allow_test = True ), msg )
118
+ asserts .assert_true (is_valid_cluster_id (id , allow_test = False ), msg )
119
+ asserts .assert_false (is_standard_cluster_id (id ), msg )
112
120
113
121
def check_test (id ):
114
122
id_type = cluster_id_type (id )
115
123
msg = f"Incorrect cluster range assessment, expecting test { id :08x} , type = { id_type } "
116
124
asserts .assert_equal (id_type , ClusterIdType .kTest , msg )
117
- asserts .assert_true (is_valid_cluster_id (id_type , allow_test = True ), msg )
118
- asserts .assert_false (is_valid_cluster_id (id_type , allow_test = False ), msg )
125
+ asserts .assert_true (is_valid_cluster_id (id , allow_test = True ), msg )
126
+ asserts .assert_false (is_valid_cluster_id (id , allow_test = False ), msg )
127
+ asserts .assert_false (is_standard_cluster_id (id ), msg )
119
128
120
129
def check_all_bad (id ):
121
130
id_type = cluster_id_type (id )
122
131
msg = f"Incorrect cluster range assessment, expecting invalid { id :08x} , type = { id_type } "
123
132
asserts .assert_equal (id_type , ClusterIdType .kInvalid , msg )
124
- asserts .assert_false (is_valid_cluster_id (id_type , allow_test = True ), msg )
125
- asserts .assert_false (is_valid_cluster_id (id_type , allow_test = False ), msg )
133
+ asserts .assert_false (is_valid_cluster_id (id , allow_test = True ), msg )
134
+ asserts .assert_false (is_valid_cluster_id (id , allow_test = False ), msg )
135
+ asserts .assert_false (is_standard_cluster_id (id ), msg )
126
136
127
137
for id in standard_good :
128
138
check_standard (id )
@@ -160,36 +170,41 @@ def check_standard_global(id):
160
170
id_type = attribute_id_type (id )
161
171
msg = f"Incorrect attribute range assessment, expecting standard global { id :08x} , type = { id_type } "
162
172
asserts .assert_equal (id_type , AttributeIdType .kStandardGlobal , msg )
163
- asserts .assert_true (is_valid_attribute_id (id_type , allow_test = True ), msg )
164
- asserts .assert_true (is_valid_attribute_id (id_type , allow_test = False ), msg )
173
+ asserts .assert_true (is_valid_attribute_id (id , allow_test = True ), msg )
174
+ asserts .assert_true (is_valid_attribute_id (id , allow_test = False ), msg )
175
+ asserts .assert_true (is_standard_attribute_id (id ), msg )
165
176
166
177
def check_standard_non_global (id ):
167
178
id_type = attribute_id_type (id )
168
179
msg = f"Incorrect attribute range assessment, expecting standard non-global { id :08x} , type = { id_type } "
169
180
asserts .assert_equal (id_type , AttributeIdType .kStandardNonGlobal , msg )
170
- asserts .assert_true (is_valid_attribute_id (id_type , allow_test = True ), msg )
171
- asserts .assert_true (is_valid_attribute_id (id_type , allow_test = False ), msg )
181
+ asserts .assert_true (is_valid_attribute_id (id , allow_test = True ), msg )
182
+ asserts .assert_true (is_valid_attribute_id (id , allow_test = False ), msg )
183
+ asserts .assert_true (is_standard_attribute_id (id ), msg )
172
184
173
185
def check_manufacturer (id ):
174
186
id_type = attribute_id_type (id )
175
187
msg = f"Incorrect attribute range assessment, expecting manufacturer { id :08x} , type = { id_type } "
176
188
asserts .assert_equal (id_type , AttributeIdType .kManufacturer , msg )
177
- asserts .assert_true (is_valid_attribute_id (id_type , allow_test = True ), msg )
178
- asserts .assert_true (is_valid_attribute_id (id_type , allow_test = False ), msg )
189
+ asserts .assert_true (is_valid_attribute_id (id , allow_test = True ), msg )
190
+ asserts .assert_true (is_valid_attribute_id (id , allow_test = False ), msg )
191
+ asserts .assert_false (is_standard_attribute_id (id ), msg )
179
192
180
193
def check_test (id ):
181
194
id_type = attribute_id_type (id )
182
195
msg = f"Incorrect attribute range assessment, expecting test { id :08x} , type = { id_type } "
183
196
asserts .assert_equal (id_type , AttributeIdType .kTest , msg )
184
- asserts .assert_true (is_valid_attribute_id (id_type , allow_test = True ), msg )
185
- asserts .assert_false (is_valid_attribute_id (id_type , allow_test = False ), msg )
197
+ asserts .assert_true (is_valid_attribute_id (id , allow_test = True ), msg )
198
+ asserts .assert_false (is_valid_attribute_id (id , allow_test = False ), msg )
199
+ asserts .assert_false (is_standard_attribute_id (id ), msg )
186
200
187
201
def check_all_bad (id ):
188
202
id_type = attribute_id_type (id )
189
203
msg = f"Incorrect attribute range assessment, expecting invalid { id :08x} , type = { id_type } "
190
204
asserts .assert_equal (id_type , AttributeIdType .kInvalid , msg )
191
- asserts .assert_false (is_valid_attribute_id (id_type , allow_test = True ), msg )
192
- asserts .assert_false (is_valid_attribute_id (id_type , allow_test = False ), msg )
205
+ asserts .assert_false (is_valid_attribute_id (id , allow_test = True ), msg )
206
+ asserts .assert_false (is_valid_attribute_id (id , allow_test = False ), msg )
207
+ asserts .assert_false (is_standard_attribute_id (id ), msg )
193
208
194
209
for id in standard_global_good :
195
210
check_standard_global (id )
@@ -225,36 +240,41 @@ def check_standard_global(id):
225
240
id_type = command_id_type (id )
226
241
msg = f"Incorrect command range assessment, expecting standard global { id :08x} , type = { id_type } "
227
242
asserts .assert_equal (id_type , CommandIdType .kStandardGlobal , msg )
228
- asserts .assert_true (is_valid_command_id (id_type , allow_test = True ), msg )
229
- asserts .assert_true (is_valid_command_id (id_type , allow_test = False ), msg )
243
+ asserts .assert_true (is_valid_command_id (id , allow_test = True ), msg )
244
+ asserts .assert_true (is_valid_command_id (id , allow_test = False ), msg )
245
+ asserts .assert_true (is_standard_command_id (id ), msg )
230
246
231
247
def check_scoped_non_global (id ):
232
248
id_type = command_id_type (id )
233
249
msg = f"Incorrect command range assessment, expecting scoped non-global { id :08x} , type = { id_type } "
234
250
asserts .assert_equal (id_type , CommandIdType .kScopedNonGlobal , msg )
235
- asserts .assert_true (is_valid_command_id (id_type , allow_test = True ), msg )
236
- asserts .assert_true (is_valid_command_id (id_type , allow_test = False ), msg )
251
+ asserts .assert_true (is_valid_command_id (id , allow_test = True ), msg )
252
+ asserts .assert_true (is_valid_command_id (id , allow_test = False ), msg )
253
+ asserts .assert_true (is_standard_command_id (id ), msg )
237
254
238
255
def check_manufacturer (id ):
239
256
id_type = command_id_type (id )
240
257
msg = f"Incorrect command range assessment, expecting manufacturer { id :08x} , type = { id_type } "
241
258
asserts .assert_equal (id_type , CommandIdType .kManufacturer , msg )
242
- asserts .assert_true (is_valid_command_id (id_type , allow_test = True ), msg )
243
- asserts .assert_true (is_valid_command_id (id_type , allow_test = False ), msg )
259
+ asserts .assert_true (is_valid_command_id (id , allow_test = True ), msg )
260
+ asserts .assert_true (is_valid_command_id (id , allow_test = False ), msg )
261
+ asserts .assert_false (is_standard_command_id (id ), msg )
244
262
245
263
def check_test (id ):
246
264
id_type = command_id_type (id )
247
265
msg = f"Incorrect command range assessment, expecting test { id :08x} , type = { id_type } "
248
266
asserts .assert_equal (id_type , CommandIdType .kTest , msg )
249
- asserts .assert_true (is_valid_command_id (id_type , allow_test = True ), msg )
250
- asserts .assert_false (is_valid_command_id (id_type , allow_test = False ), msg )
267
+ asserts .assert_true (is_valid_command_id (id , allow_test = True ), msg )
268
+ asserts .assert_false (is_valid_command_id (id , allow_test = False ), msg )
269
+ asserts .assert_false (is_standard_command_id (id ), msg )
251
270
252
271
def check_all_bad (id ):
253
272
id_type = command_id_type (id )
254
273
msg = f"Incorrect command range assessment, expecting invalid { id :08x} , type = { id_type } "
255
274
asserts .assert_equal (id_type , CommandIdType .kInvalid , msg )
256
- asserts .assert_false (is_valid_command_id (id_type , allow_test = True ), msg )
257
- asserts .assert_false (is_valid_command_id (id_type , allow_test = False ), msg )
275
+ asserts .assert_false (is_valid_command_id (id , allow_test = True ), msg )
276
+ asserts .assert_false (is_valid_command_id (id , allow_test = False ), msg )
277
+ asserts .assert_false (is_standard_command_id (id ), msg )
258
278
259
279
for id in standard_global_good :
260
280
check_standard_global (id )
0 commit comments