@@ -72,32 +72,22 @@ def desc_TC_ICDM_3_1(self) -> str:
72
72
73
73
def steps_TC_ICDM_3_1 (self ) -> list [TestStep ]:
74
74
steps = [
75
- TestStep ("0a" , "Commissioning, already done" ,
75
+ TestStep (0 , "Commissioning, already done" ,
76
76
is_commissioning = True ),
77
- TestStep (
78
- "0b" , "TH reads from the DUT the RegisteredClients attribute. RegisteredClients is empty." ),
79
- TestStep (
80
- "1a" , "TH reads from the DUT the ClientsSupportedPerFabric attribute." ),
81
- TestStep (
82
- "1b" , "TH reads from the DUT the ICDCounter attribute." ),
77
+ TestStep ("1a" , "TH reads from the DUT the RegisteredClients attribute. RegisteredClients is empty." ),
78
+ TestStep ("1b" , "TH reads from the DUT the ClientsSupportedPerFabric attribute." ),
79
+ TestStep ("1c" , "TH reads from the DUT the ICDCounter attribute." ),
83
80
TestStep (2 , "TH sends RegisterClient command." ),
84
81
TestStep (3 , "TH reads from the DUT the RegisteredClients attribute." ),
85
- TestStep (
86
- 4 , "If len(RegisteredClients) is less than ClientsSupportedPerFabric, TH repeats RegisterClient command with different CheckInNodeID(s) until the number of entries in RegisteredClients equals ClientsSupportedPerFabric." ),
82
+ TestStep (4 , "If len(RegisteredClients) is less than ClientsSupportedPerFabric, TH repeats RegisterClient command with different CheckInNodeID(s) until the number of entries in RegisteredClients equals ClientsSupportedPerFabric." ),
87
83
TestStep (5 , "TH reads from the DUT the RegisteredClients attribute." ),
88
- TestStep (
89
- 6 , "TH sends RegisterClient command with a different CheckInNodeID." ),
90
- TestStep (
91
- 7 , "TTH sends UnregisterClient command with the CheckInNodeID from Step 6." ),
92
- TestStep (
93
- 8 , "TH sends UnregisterClient command with the CheckInNodeID from Step 2." ),
94
- TestStep (
95
- 9 , "TH reads from the DUT the RegisteredClients attribute." ),
96
- TestStep (
97
- 10 , "Repeat Step 9 with the rest of CheckInNodeIDs from the list of RegisteredClients from Step 4, if any." ),
84
+ TestStep (6 , "TH sends RegisterClient command with a different CheckInNodeID." ),
85
+ TestStep (7 , "TTH sends UnregisterClient command with the CheckInNodeID from Step 6." ),
86
+ TestStep (8 , "TH sends UnregisterClient command with the CheckInNodeID from Step 2." ),
87
+ TestStep (9 , "TH reads from the DUT the RegisteredClients attribute." ),
88
+ TestStep (10 , "Repeat Step 9 with the rest of CheckInNodeIDs from the list of RegisteredClients from Step 4, if any." ),
98
89
TestStep (11 , "TH reads from the DUT the RegisteredClients attribute." ),
99
- TestStep (
100
- 12 , "TH sends UnregisterClient command with the CheckInNodeID from Step 2." ),
90
+ TestStep (12 , "TH sends UnregisterClient command with the CheckInNodeID from Step 2." ),
101
91
]
102
92
return steps
103
93
@@ -120,10 +110,10 @@ async def test_TC_ICDM_3_1(self):
120
110
attributes = cluster .Attributes
121
111
122
112
# Pre-Condition: Commissioning
123
- self .step ("0a" )
113
+ self .step (0 )
124
114
125
- # Pre-Condition: Empty RegisteredClients attribute for all registrations
126
- self .step ("0b " )
115
+ # Empty RegisteredClients attribute for all registrations
116
+ self .step ("1a " )
127
117
registeredClients = await self ._read_icdm_attribute_expect_success (
128
118
attributes .RegisteredClients )
129
119
@@ -135,56 +125,51 @@ async def test_TC_ICDM_3_1(self):
135
125
e .status , Status .Success , "Unexpected error returned" )
136
126
pass
137
127
138
- self .step ("1a" )
139
- if self .pics_guard (self .check_pics ("ICDM.S.A0005" )):
140
- clientsSupportedPerFabric = await self ._read_icdm_attribute_expect_success (
141
- attributes .ClientsSupportedPerFabric )
142
-
143
128
self .step ("1b" )
144
- if self .pics_guard (self .check_pics ("ICDM.S.A0005" )):
145
- icdCounter = await self ._read_icdm_attribute_expect_success (attributes .ICDCounter )
129
+ clientsSupportedPerFabric = await self ._read_icdm_attribute_expect_success (
130
+ attributes .ClientsSupportedPerFabric )
131
+
132
+ self .step ("1c" )
133
+ icdCounter = await self ._read_icdm_attribute_expect_success (attributes .ICDCounter )
146
134
147
135
self .step (2 )
148
- if self .pics_guard (self .check_pics ("ICDM.S.C00.Rsp" )):
149
- try :
150
- response = await self ._send_single_icdm_command (commands .RegisterClient (checkInNodeID = kStep2CheckInNodeId , monitoredSubject = kStep2MonitoredSubjectStep2 , key = kStep2Key , clientType = clientTypeEnum .kEphemeral ))
151
- except InteractionModelError as e :
152
- asserts .assert_equal (
153
- e .status , Status .Success , "Unexpected error returned" )
154
- pass
136
+ try :
137
+ response = await self ._send_single_icdm_command (commands .RegisterClient (checkInNodeID = kStep2CheckInNodeId , monitoredSubject = kStep2MonitoredSubjectStep2 , key = kStep2Key , clientType = clientTypeEnum .kEphemeral ))
138
+ except InteractionModelError as e :
139
+ asserts .assert_equal (
140
+ e .status , Status .Success , "Unexpected error returned" )
141
+ pass
155
142
156
- # Validate response contains the ICDCounter
157
- asserts .assert_greater_equal (response .ICDCounter , icdCounter ,
158
- "The ICDCounter in the response does not match the read ICDCounter." )
143
+ # Validate response contains the ICDCounter
144
+ asserts .assert_greater_equal (response .ICDCounter , icdCounter ,
145
+ "The ICDCounter in the response does not match the read ICDCounter." )
159
146
160
147
self .step (3 )
161
- if self .pics_guard (self .check_pics ("ICDM.S.A0003" )):
162
- registeredClients = await self ._read_icdm_attribute_expect_success (
163
- attributes .RegisteredClients )
164
- # Validate list size
165
- asserts .assert_equal (len (registeredClients ), 1 ,
166
- "The expected length of RegisteredClients is 1. List has the wrong size." )
167
-
168
- # Validate entry values
169
- asserts .assert_equal (
170
- registeredClients [0 ].checkInNodeID , kStep2CheckInNodeId , "The read attribute does not match the registered value." )
171
- asserts .assert_equal (
172
- registeredClients [0 ].monitoredSubject , kStep2MonitoredSubjectStep2 , "The read attribute does not match the registered value." )
173
- asserts .assert_equal (
174
- registeredClients [0 ].clientType , clientTypeEnum .kEphemeral , "The read attribute does not match the registered value." )
148
+ registeredClients = await self ._read_icdm_attribute_expect_success (
149
+ attributes .RegisteredClients )
150
+ # Validate list size
151
+ asserts .assert_equal (len (registeredClients ), 1 ,
152
+ "The expected length of RegisteredClients is 1. List has the wrong size." )
153
+
154
+ # Validate entry values
155
+ asserts .assert_equal (
156
+ registeredClients [0 ].checkInNodeID , kStep2CheckInNodeId , "The read attribute does not match the registered value." )
157
+ asserts .assert_equal (
158
+ registeredClients [0 ].monitoredSubject , kStep2MonitoredSubjectStep2 , "The read attribute does not match the registered value." )
159
+ asserts .assert_equal (
160
+ registeredClients [0 ].clientType , clientTypeEnum .kEphemeral , "The read attribute does not match the registered value." )
175
161
176
162
self .step (4 )
177
- if self .pics_guard (self .check_pics ("ICDM.S.C00.Rsp" )):
178
- if (len (registeredClients ) < clientsSupportedPerFabric ):
179
- newClients = []
180
- # Generate new clients data
181
- for i in range (clientsSupportedPerFabric - len (registeredClients )):
182
- newClients .append ({
183
- "checkInNodeID" : i + 1 ,
184
- "monitoredSubject" : i + 1 ,
185
- "key" : os .urandom (16 ),
186
- "clientType" : clientTypeEnum .kPermanent
187
- })
163
+ if (len (registeredClients ) < clientsSupportedPerFabric ):
164
+ newClients = []
165
+ # Generate new clients data
166
+ for i in range (clientsSupportedPerFabric - len (registeredClients )):
167
+ newClients .append ({
168
+ "checkInNodeID" : i + 1 ,
169
+ "monitoredSubject" : i + 1 ,
170
+ "key" : os .urandom (16 ),
171
+ "clientType" : clientTypeEnum .kPermanent
172
+ })
188
173
189
174
for client in newClients :
190
175
try :
@@ -199,84 +184,76 @@ async def test_TC_ICDM_3_1(self):
199
184
"The ICDCounter in the response does not match the read ICDCounter." )
200
185
201
186
self .step (5 )
202
- if self .pics_guard (self .check_pics ("ICDM.S.A0003" )):
203
- registeredClients = await self ._read_icdm_attribute_expect_success (
204
- attributes .RegisteredClients )
187
+ registeredClients = await self ._read_icdm_attribute_expect_success (
188
+ attributes .RegisteredClients )
205
189
206
- # Validate list size
207
- asserts .assert_equal (len (registeredClients [1 :]), len (newClients ),
208
- "The expected length of RegisteredClients is clientsSupportedPerFabric. List has the wrong size." )
190
+ # Validate list size
191
+ asserts .assert_equal (len (registeredClients [1 :]), len (newClients ),
192
+ "The expected length of RegisteredClients is clientsSupportedPerFabric. List has the wrong size." )
209
193
210
- for client , expectedClient in zip (registeredClients [1 :], newClients ):
211
- asserts .assert_equal (
212
- client .checkInNodeID , expectedClient ["checkInNodeID" ], "The read attribute does not match the registered value." )
213
- asserts .assert_equal (
214
- client .monitoredSubject , expectedClient ["monitoredSubject" ], "The read attribute does not match the registered value." )
215
- asserts .assert_equal (
216
- client .clientType , expectedClient ["clientType" ], "The read attribute does not match the registered value." )
194
+ for client , expectedClient in zip (registeredClients [1 :], newClients ):
195
+ asserts .assert_equal (
196
+ client .checkInNodeID , expectedClient ["checkInNodeID" ], "The read attribute does not match the registered value." )
197
+ asserts .assert_equal (
198
+ client .monitoredSubject , expectedClient ["monitoredSubject" ], "The read attribute does not match the registered value." )
199
+ asserts .assert_equal (
200
+ client .clientType , expectedClient ["clientType" ], "The read attribute does not match the registered value." )
217
201
218
202
self .step (6 )
219
- if self .pics_guard (self .check_pics ("ICDM.S.C00.Rsp" )):
220
- try :
221
- response = await self ._send_single_icdm_command (commands .RegisterClient (checkInNodeID = 0xFFFF , monitoredSubject = 0xFFFF , key = os .urandom (16 ), clientType = clientTypeEnum .kPermanent ))
222
- except InteractionModelError as e :
223
- asserts .assert_equal (
224
- e .status , Status .ResourceExhausted , "Unexpected error returned" )
225
- pass
203
+ try :
204
+ response = await self ._send_single_icdm_command (commands .RegisterClient (checkInNodeID = 0xFFFF , monitoredSubject = 0xFFFF , key = os .urandom (16 ), clientType = clientTypeEnum .kPermanent ))
205
+ except InteractionModelError as e :
206
+ asserts .assert_equal (
207
+ e .status , Status .ResourceExhausted , "Unexpected error returned" )
208
+ pass
226
209
227
210
self .step (7 )
228
- if self .pics_guard (self .check_pics ("ICDM.S.C02.Rsp" )):
229
- try :
230
- await self ._send_single_icdm_command (commands .UnregisterClient (checkInNodeID = 0xFFFF ))
231
- except InteractionModelError as e :
232
- asserts .assert_equal (
233
- e .status , Status .NotFound , "Unexpected error returned" )
234
- pass
211
+ try :
212
+ await self ._send_single_icdm_command (commands .UnregisterClient (checkInNodeID = 0xFFFF ))
213
+ except InteractionModelError as e :
214
+ asserts .assert_equal (
215
+ e .status , Status .NotFound , "Unexpected error returned" )
216
+ pass
235
217
236
218
self .step (8 )
237
- if self .pics_guard (self .check_pics ("ICDM.S.C02.Rsp" )):
238
- try :
239
- await self ._send_single_icdm_command (commands .UnregisterClient (checkInNodeID = kStep2CheckInNodeId ))
240
- except InteractionModelError as e :
241
- asserts .assert_equal (
242
- e .status , Status .Success , "Unexpected error returned" )
243
- pass
219
+ try :
220
+ await self ._send_single_icdm_command (commands .UnregisterClient (checkInNodeID = kStep2CheckInNodeId ))
221
+ except InteractionModelError as e :
222
+ asserts .assert_equal (
223
+ e .status , Status .Success , "Unexpected error returned" )
224
+ pass
244
225
245
226
self .step (9 )
246
- if self .pics_guard (self .check_pics ("ICDM.S.A0003" )):
247
- registeredClients = await self ._read_icdm_attribute_expect_success (
248
- attributes .RegisteredClients )
227
+ registeredClients = await self ._read_icdm_attribute_expect_success (
228
+ attributes .RegisteredClients )
249
229
250
- for client in registeredClients :
251
- asserts .assert_not_equal (client .checkInNodeID , kStep2CheckInNodeId ,
252
- "CheckInNodeID was unregistered. It should not be present in the attribute list." )
230
+ for client in registeredClients :
231
+ asserts .assert_not_equal (client .checkInNodeID , kStep2CheckInNodeId ,
232
+ "CheckInNodeID was unregistered. It should not be present in the attribute list." )
253
233
254
234
self .step (10 )
255
- if self .pics_guard (self .check_pics ("ICDM.S.C02.Rsp" )):
256
- for client in newClients :
257
- try :
258
- await self ._send_single_icdm_command (commands .UnregisterClient (checkInNodeID = client ["checkInNodeID" ]))
259
- except InteractionModelError as e :
260
- asserts .assert_equal (
261
- e .status , Status .Success , "Unexpected error returned" )
262
- pass
235
+ for client in newClients :
236
+ try :
237
+ await self ._send_single_icdm_command (commands .UnregisterClient (checkInNodeID = client ["checkInNodeID" ]))
238
+ except InteractionModelError as e :
239
+ asserts .assert_equal (
240
+ e .status , Status .Success , "Unexpected error returned" )
241
+ pass
263
242
264
243
self .step (11 )
265
- if self .pics_guard (self .check_pics ("ICDM.S.A0003" )):
266
- registeredClients = await self ._read_icdm_attribute_expect_success (
267
- attributes .RegisteredClients )
244
+ registeredClients = await self ._read_icdm_attribute_expect_success (
245
+ attributes .RegisteredClients )
268
246
269
- asserts .assert_true (
270
- not registeredClients , "This list should empty. An element did not get deleted." )
247
+ asserts .assert_true (
248
+ not registeredClients , "This list should empty. An element did not get deleted." )
271
249
272
250
self .step (12 )
273
- if self .pics_guard (self .check_pics ("ICDM.S.C02.Rsp" )):
274
- try :
275
- await self ._send_single_icdm_command (commands .UnregisterClient (checkInNodeID = kStep2CheckInNodeId ))
276
- except InteractionModelError as e :
277
- asserts .assert_equal (
278
- e .status , Status .NotFound , "Unexpected error returned" )
279
- pass
251
+ try :
252
+ await self ._send_single_icdm_command (commands .UnregisterClient (checkInNodeID = kStep2CheckInNodeId ))
253
+ except InteractionModelError as e :
254
+ asserts .assert_equal (
255
+ e .status , Status .NotFound , "Unexpected error returned" )
256
+ pass
280
257
281
258
282
259
if __name__ == "__main__" :
0 commit comments