33
33
import chip .clusters as Clusters
34
34
from chip import ChipDeviceCtrl
35
35
from chip .interaction_model import InteractionModelError
36
- from matter_testing_support import MatterBaseTest , async_test_body , default_matter_test_main
36
+ from matter_testing_support import MatterBaseTest , TestStep , async_test_body , default_matter_test_main
37
37
from mobly import asserts
38
38
39
39
@@ -48,141 +48,265 @@ async def teardown_test(self):
48
48
await self .send_single_cmd (cmd = cmd , endpoint = 0 ,
49
49
payloadCapability = ChipDeviceCtrl .TransportPayloadCapability .LARGE_PAYLOAD )
50
50
51
- def pics_SC_8_1 (self ):
51
+ def pics_TC_SC_8_1 (self ):
52
52
return ['MCORE.SC.TCP' ]
53
53
54
+ def steps_TC_SC_8_1 (self ) -> list [TestStep ]:
55
+ steps = [
56
+ TestStep (1 , "Commissioning, already done" , is_commissioning = True ),
57
+ TestStep (2 , "TH initiates a CASE session establishment with DUT, requesting a session supporting large payloads." ),
58
+ TestStep (3 , "Verifying that a session is set up with an underlying TCP connection established with DUT." ),
59
+ ]
60
+ return steps
61
+
54
62
# TCP Connection Establishment
55
63
@async_test_body
56
64
async def test_TC_SC_8_1 (self ):
57
65
66
+ self .step (1 )
58
67
try :
68
+ self .step (2 )
59
69
device = await self .default_controller .GetConnectedDevice (nodeid = self .dut_node_id , allowPASE = False , timeoutMs = 1000 ,
60
70
payloadCapability = ChipDeviceCtrl .TransportPayloadCapability .LARGE_PAYLOAD )
61
71
except TimeoutError :
62
72
asserts .fail ("Unable to establish a CASE session over TCP to the device" )
73
+
74
+ self .step (3 )
63
75
asserts .assert_equal (device .isSessionOverTCPConnection , True , "Session does not have associated TCP connection" )
64
76
asserts .assert_equal (device .isActiveSession , True , "Large Payload Session should be active over TCP connection" )
65
77
66
- def pics_SC_8_2 (self ):
78
+ def pics_TC_SC_8_2 (self ):
67
79
return ['MCORE.SC.TCP' ]
68
80
81
+ def steps_TC_SC_8_2 (self ) -> list [TestStep ]:
82
+ steps = [
83
+ TestStep (1 , "Commissioning, already done" , is_commissioning = True ),
84
+ TestStep (2 , "TH initiates a CASE session establishment with DUT, requesting a session supporting large payloads." ),
85
+ TestStep (3 , "Verifying that the session established with DUT allows large payloads." ),
86
+ ]
87
+ return steps
88
+
69
89
# Large Payload Session Establishment
70
90
@async_test_body
71
91
async def test_TC_SC_8_2 (self ):
72
92
93
+ self .step (1 )
73
94
try :
95
+ self .step (2 )
74
96
device = await self .default_controller .GetConnectedDevice (nodeid = self .dut_node_id , allowPASE = False , timeoutMs = 1000 ,
75
97
payloadCapability = ChipDeviceCtrl .TransportPayloadCapability .LARGE_PAYLOAD )
76
98
except TimeoutError :
77
99
asserts .fail ("Unable to establish a CASE session over TCP to the device" )
100
+
101
+ self .step (3 )
78
102
asserts .assert_equal (device .sessionAllowsLargePayload , True , "Session does not have associated TCP connection" )
79
103
80
- def pics_SC_8_3 (self ):
104
+ def pics_TC_SC_8_3 (self ):
81
105
return ['MCORE.SC.TCP' ]
82
106
107
+ def steps_TC_SC_8_3 (self ) -> list [TestStep ]:
108
+ steps = [
109
+ TestStep (1 , "Commissioning, already done" , is_commissioning = True ),
110
+ TestStep (2 , "TH initiates a CASE session establishment with DUT, requesting a session supporting large payloads." ),
111
+ TestStep (3 , "Verifying that a session is set up with an underlying TCP connection established with DUT." ),
112
+ TestStep (4 , "TH closes the TCP connection with DUT" ),
113
+ TestStep (5 , "Verifying that the secure session with DUT is inactive." ),
114
+ ]
115
+ return steps
116
+
83
117
# Session Inactive After TCP Disconnect
84
118
@async_test_body
85
119
async def test_TC_SC_8_3 (self ):
86
120
121
+ self .step (1 )
87
122
try :
123
+ self .step (2 )
88
124
device = await self .default_controller .GetConnectedDevice (nodeid = self .dut_node_id , allowPASE = False , timeoutMs = 1000 ,
89
125
payloadCapability = ChipDeviceCtrl .TransportPayloadCapability .LARGE_PAYLOAD )
90
126
except TimeoutError :
91
127
asserts .fail ("Unable to establish a CASE session over TCP to the device" )
128
+
129
+ self .step (3 )
92
130
asserts .assert_equal (device .isSessionOverTCPConnection , True , "Session does not have associated TCP connection" )
93
131
132
+ self .step (4 )
94
133
device .closeTCPConnectionWithPeer ()
134
+
135
+ self .step (5 )
95
136
asserts .assert_equal (device .isActiveSession , False ,
96
137
"Large Payload Session should not be active after TCP connection closure" )
97
138
98
- def pics_SC_8_4 (self ):
139
+ def pics_TC_SC_8_4 (self ):
99
140
return ['MCORE.SC.TCP' ]
100
141
142
+ def steps_TC_SC_8_4 (self ) -> list [TestStep ]:
143
+ steps = [
144
+ TestStep (1 , "Commissioning, already done" , is_commissioning = True ),
145
+ TestStep (2 , "TH initiates a CASE session establishment with DUT, requesting a session supporting large payloads." ),
146
+ TestStep (3 , "Verifying that a session is set up with an underlying TCP connection established with DUT." ),
147
+ TestStep (4 , "TH closes the TCP connection with DUT" ),
148
+ TestStep (5 , "Verifyng that the secure session with DUT is inactive." ),
149
+ TestStep (6 , "TH re-initiates CASE session establishment over TCP with DUT" ),
150
+ TestStep (7 , "Verifying that a session is set up with an underlying TCP connection established with DUT." ),
151
+ TestStep (8 , "Verifying that the large-payload secure session with DUT is active." ),
152
+ ]
153
+ return steps
154
+
101
155
# TCP Connect, Disconnect, Then Connect Again
102
156
@async_test_body
103
157
async def test_TC_SC_8_4 (self ):
104
158
159
+ self .step (1 )
105
160
try :
161
+ self .step (2 )
106
162
device = await self .default_controller .GetConnectedDevice (nodeid = self .dut_node_id , allowPASE = False , timeoutMs = 1000 ,
107
163
payloadCapability = ChipDeviceCtrl .TransportPayloadCapability .LARGE_PAYLOAD )
108
164
except TimeoutError :
109
165
asserts .fail ("Unable to establish a CASE session over TCP to the device" )
166
+
167
+ self .step (3 )
110
168
asserts .assert_equal (device .isSessionOverTCPConnection , True , "Session does not have associated TCP connection" )
111
169
170
+ self .step (4 )
112
171
device .closeTCPConnectionWithPeer ()
172
+
173
+ self .step (5 )
113
174
asserts .assert_equal (device .isActiveSession , False ,
114
175
"Large Payload Session should not be active after TCP connection closure" )
115
176
116
177
# Connect again
117
178
try :
179
+ self .step (6 )
118
180
device = await self .default_controller .GetConnectedDevice (nodeid = self .dut_node_id , allowPASE = False , timeoutMs = 1000 ,
119
181
payloadCapability = ChipDeviceCtrl .TransportPayloadCapability .LARGE_PAYLOAD )
120
182
except TimeoutError :
121
183
asserts .fail ("Unable to establish a CASE session over TCP to the device" )
184
+
185
+ self .step (7 )
122
186
asserts .assert_equal (device .isSessionOverTCPConnection , True , "Session does not have associated TCP connection" )
187
+
188
+ self .step (8 )
123
189
asserts .assert_equal (device .isActiveSession , True , "Large Payload Session should be active over TCP connection" )
124
190
125
- def pics_SC_8_5 (self ):
191
+ def pics_TC_SC_8_5 (self ):
126
192
return ['MCORE.SC.TCP' ]
127
193
194
+ def steps_TC_SC_8_5 (self ) -> list [TestStep ]:
195
+ steps = [
196
+ TestStep (1 , "Commissioning, already done" , is_commissioning = True ),
197
+ TestStep (2 , "TH initiates a CASE session establishment with DUT, requesting a session supporting large payloads." ),
198
+ TestStep (3 , "Verifying that a session is set up with an underlying TCP connection established with DUT." ),
199
+ TestStep (4 , "Verifying that the large-payload secure session with DUT is active." ),
200
+ TestStep (5 , "TH initiates an InvokeCommandRequest with DUT over the established session." ),
201
+ TestStep (6 , "Verifying successful invocation with DUT over the established session without any error." ),
202
+ ]
203
+ return steps
204
+
128
205
@async_test_body
129
206
async def test_TC_SC_8_5 (self ):
130
207
208
+ self .step (1 )
131
209
try :
210
+ self .step (2 )
132
211
device = await self .default_controller .GetConnectedDevice (nodeid = self .dut_node_id , allowPASE = False , timeoutMs = 1000 ,
133
212
payloadCapability = ChipDeviceCtrl .TransportPayloadCapability .LARGE_PAYLOAD )
134
213
except TimeoutError :
135
214
asserts .fail ("Unable to establish a CASE session over TCP to the device" )
215
+
216
+ self .step (3 )
136
217
asserts .assert_equal (device .isSessionOverTCPConnection , True , "Session does not have associated TCP connection" )
218
+
219
+ self .step (4 )
137
220
asserts .assert_equal (device .isActiveSession , True , "Large Payload Session should be active over TCP connection" )
138
221
asserts .assert_equal (device .sessionAllowsLargePayload , True , "Session does not have associated TCP connection" )
139
222
140
223
try :
224
+ self .step (5 )
141
225
await self .send_arm_cmd (ChipDeviceCtrl .TransportPayloadCapability .LARGE_PAYLOAD )
142
226
except InteractionModelError :
143
227
asserts .fail ("Unexpected error returned by DUT" )
228
+ self .step (6 )
144
229
145
- def pics_SC_8_6 (self ):
230
+ def pics_TC_SC_8_6 (self ):
146
231
return ['MCORE.SC.TCP' ]
147
232
233
+ def steps_TC_SC_8_6 (self ) -> list [TestStep ]:
234
+ steps = [
235
+ TestStep (1 , "Commissioning, already done" , is_commissioning = True ),
236
+ TestStep (2 , "TH initiates a CASE session establishment with DUT, requesting a session supporting large payloads." ),
237
+ TestStep (3 , "Verifying that a session is set up with an underlying TCP connection established with DUT." ),
238
+ TestStep (4 , "Verifying that the large-payload secure session with DUT is active." ),
239
+ TestStep (5 , "TH initiates a Read of all attributes of all clusters of DUT." ),
240
+ TestStep (6 , "Verifying wildcard read was successful with DUT over the established session without any error." ),
241
+ ]
242
+ return steps
243
+
148
244
# WildCard Read Over TCP Session
149
245
@async_test_body
150
246
async def test_TC_SC_8_6 (self ):
151
247
248
+ self .step (1 )
152
249
try :
250
+ self .step (2 )
153
251
device = await self .default_controller .GetConnectedDevice (nodeid = self .dut_node_id , allowPASE = False , timeoutMs = 1000 ,
154
252
payloadCapability = ChipDeviceCtrl .TransportPayloadCapability .LARGE_PAYLOAD )
155
253
except TimeoutError :
156
254
asserts .fail ("Unable to establish a CASE session over TCP to the device" )
255
+
256
+ self .step (3 )
157
257
asserts .assert_equal (device .isSessionOverTCPConnection , True , "Session does not have associated TCP connection" )
258
+
259
+ self .step (4 )
158
260
asserts .assert_equal (device .isActiveSession , True , "Large Payload Session should be active over TCP connection" )
159
261
asserts .assert_equal (device .sessionAllowsLargePayload , True , "Session does not have associated TCP connection" )
160
262
161
263
try :
264
+ self .step (5 )
162
265
await self .default_controller .Read (self .dut_node_id , [()], payloadCapability = ChipDeviceCtrl .TransportPayloadCapability .LARGE_PAYLOAD )
163
266
except InteractionModelError :
164
267
asserts .fail ("Unexpected error returned by DUT" )
268
+ self .step (6 )
165
269
166
- def pics_SC_8_7 (self ):
270
+ def pics_TC_SC_8_7 (self ):
167
271
return ['MCORE.SC.TCP' ]
168
272
273
+ def steps_TC_SC_8_7 (self ) -> list [TestStep ]:
274
+ steps = [
275
+ TestStep (1 , "Commissioning, already done" , is_commissioning = True ),
276
+ TestStep (2 , "TH initiates a CASE session establishment with DUT, requesting a session supporting large payloads." ),
277
+ TestStep (3 , "Verifying that a session is set up with an underlying TCP connection established with DUT." ),
278
+ TestStep (4 , "Verifying that the large-payload secure session with DUT is active." ),
279
+ TestStep (5 , "TH initiates a regularly-sized InvokeCommandRequest with DUT, specifying that either a MRP or TCP-based session is usable." ),
280
+ TestStep (6 , "Verifying successful invocation with DUT over the established TCP-based session without any error." ),
281
+ ]
282
+ return steps
283
+
169
284
# Use TCP Session If Available For MRP Interaction
170
285
@async_test_body
171
286
async def test_TC_SC_8_7 (self ):
172
287
288
+ self .step (1 )
289
+
173
290
try :
291
+ self .step (2 )
174
292
device = await self .default_controller .GetConnectedDevice (nodeid = self .dut_node_id , allowPASE = False , timeoutMs = 1000 ,
175
293
payloadCapability = ChipDeviceCtrl .TransportPayloadCapability .LARGE_PAYLOAD )
176
294
except TimeoutError :
177
295
asserts .fail ("Unable to establish a CASE session over TCP to the device" )
296
+
297
+ self .step (3 )
178
298
asserts .assert_equal (device .isSessionOverTCPConnection , True , "Session does not have associated TCP connection" )
299
+
300
+ self .step (4 )
179
301
asserts .assert_equal (device .isActiveSession , True , "Large Payload Session should be active over TCP connection" )
180
302
asserts .assert_equal (device .sessionAllowsLargePayload , True , "Session does not have associated TCP connection" )
181
303
182
304
try :
305
+ self .step (5 )
183
306
self .send_arm_cmd (ChipDeviceCtrl .TransportPayloadCapability .MRP_OR_TCP_PAYLOAD )
184
307
except InteractionModelError :
185
308
asserts .fail ("Unexpected error returned by DUT" )
309
+ self .step (6 )
186
310
187
311
188
312
if __name__ == "__main__" :
0 commit comments