16
16
#
17
17
18
18
import logging
19
- from dataclasses import dataclass
20
19
21
20
import chip .clusters as Clusters
22
- from chip import ChipUtility
23
21
from chip .exceptions import ChipStackError
24
22
from chip .interaction_model import InteractionModelError , Status
25
23
from matter_testing_support import MatterBaseTest , TestStep , async_test_body , default_matter_test_main , type_matches
26
24
from mobly import asserts
27
25
28
-
29
- @dataclass
30
- class FakeInvalidBasicInformationCommand (Clusters .BasicInformation .Commands .MfgSpecificPing ):
31
- @ChipUtility .classproperty
32
- def must_use_timed_invoke (cls ) -> bool :
33
- return False
26
+ # If DUT supports `MaxPathsPerInvoke > 1`, additional command line argument
27
+ # run with
28
+ # --hex-arg PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY:<key>
34
29
35
30
36
31
class TC_IDM_1_4 (MatterBaseTest ):
@@ -44,7 +39,9 @@ def steps_TC_IDM_1_4(self) -> list[TestStep]:
44
39
TestStep (6 , "Verify DUT responds to InvokeRequestMessage containing one valid paths, and one InvokeRequest to unsupported endpoint" ),
45
40
TestStep (7 , "Verify DUT responds to InvokeRequestMessage containing two valid paths. One of which requires timed invoke, and TimedRequest in InvokeResponseMessage set to true, but never sending preceding Timed Invoke Action" ),
46
41
TestStep (8 , "Verify DUT responds to InvokeRequestMessage containing two valid paths. One of which requires timed invoke, and TimedRequest in InvokeResponseMessage set to true" ),
47
- TestStep (9 , "Verify DUT capable of responding to request with multiple InvokeResponseMessages" )]
42
+ TestStep (9 , "Verify DUT supports extended Data Model Testing feature in General Diagnostics Cluster" ),
43
+ TestStep (10 , "Verify DUT has TestEventTriggersEnabled attribute set to true in General Diagnostics Cluster" ),
44
+ TestStep (11 , "Verify DUT capable of responding to request with multiple InvokeResponseMessages" )]
48
45
return steps
49
46
50
47
@async_test_body
@@ -118,9 +115,14 @@ async def test_TC_IDM_1_4(self):
118
115
if max_paths_per_invoke == 1 :
119
116
self .skip_all_remaining_steps (3 )
120
117
else :
121
- await self .steps_3_to_9 (False )
118
+ asserts .assert_true ('PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY' in self .matter_test_config .global_test_params ,
119
+ "PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY must be included on the command line in "
120
+ "the --hex-arg flag as PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY:<key>, "
121
+ "e.g. --hex-arg PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY:000102030405060708090a0b0c0d0e0f" )
122
+
123
+ await self .remaining_batch_commands_test_steps (False )
122
124
123
- async def steps_3_to_9 (self , dummy_value ):
125
+ async def remaining_batch_commands_test_steps (self , dummy_value ):
124
126
dev_ctrl = self .default_controller
125
127
dut_node_id = self .dut_node_id
126
128
@@ -247,8 +249,66 @@ async def steps_3_to_9(self, dummy_value):
247
249
except InteractionModelError :
248
250
asserts .fail ("DUT failed with non-path specific error when path specific error was expected" )
249
251
250
- # Skipping test until https://github.com/project-chip/connectedhomeip/issues/31434 resolved
251
- self .skip_step (9 )
252
+ self .step (9 )
253
+ try :
254
+ feature_map = await self .read_single_attribute (
255
+ dev_ctrl ,
256
+ dut_node_id ,
257
+ endpoint = 0 ,
258
+ attribute = Clusters .GeneralDiagnostics .Attributes .FeatureMap
259
+ )
260
+ except InteractionModelError :
261
+ asserts .fail ("DUT failed to respond reading FeatureMap attribute" )
262
+ has_data_model_test_feature = (feature_map & Clusters .GeneralDiagnostics .Bitmaps .Feature .kDataModelTest ) != 0
263
+ asserts .assert_true (has_data_model_test_feature , "DataModelTest Feature is not supported by DUT" )
264
+
265
+ self .step (10 )
266
+ try :
267
+ test_event_triggers_enabled = await self .read_single_attribute (
268
+ dev_ctrl ,
269
+ dut_node_id ,
270
+ endpoint = 0 ,
271
+ attribute = Clusters .GeneralDiagnostics .Attributes .TestEventTriggersEnabled
272
+ )
273
+ except InteractionModelError :
274
+ asserts .fail ("DUT failed to respond reading TestEventTriggersEnabled attribute" )
275
+ asserts .assert_true (test_event_triggers_enabled , "Test Event Triggers must be enabled on DUT" )
276
+
277
+ self .step (11 )
278
+ enable_key = self .matter_test_config .global_test_params ['PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY' ]
279
+ endpoint = 0
280
+ command = Clusters .GeneralDiagnostics .Commands .PayloadTestRequest (
281
+ enableKey = enable_key ,
282
+ value = ord ('A' ),
283
+ count = 800
284
+ )
285
+ invoke_request_1 = Clusters .Command .InvokeRequestInfo (endpoint , command )
286
+
287
+ command = Clusters .OperationalCredentials .Commands .CertificateChainRequest (
288
+ Clusters .OperationalCredentials .Enums .CertificateChainTypeEnum .kDACCertificate )
289
+ invoke_request_2 = Clusters .Command .InvokeRequestInfo (endpoint , command )
290
+
291
+ try :
292
+ test_only_result = await dev_ctrl .TestOnlySendBatchCommands (dut_node_id , [invoke_request_1 , invoke_request_2 ])
293
+ except InteractionModelError :
294
+ asserts .fail ("DUT failed to respond to batch commands, where response is expected to be too large to fit in a single ResponseMessage" )
295
+
296
+ responses = test_only_result .Responses
297
+ # This check is validating the number of InvokeResponses we got
298
+ asserts .assert_equal (len (responses ), 2 , "Unexpected number of InvokeResponses sent back from DUT" )
299
+ asserts .assert_true (type_matches (
300
+ responses [0 ], Clusters .GeneralDiagnostics .Commands .PayloadTestResponse ), "Unexpected return type for first InvokeRequest" )
301
+ asserts .assert_true (type_matches (
302
+ responses [1 ], Clusters .OperationalCredentials .Commands .CertificateChainResponse ), "Unexpected return type for second InvokeRequest" )
303
+ logging .info ("DUT successfully responded to a InvokeRequest action with two valid commands" )
304
+
305
+ asserts .assert_equal (responses [0 ].payload , b'A' * 800 , "Expect response to match for count == 800" )
306
+ # If this assert below fails then some assumptions we were relying on are now no longer true.
307
+ # This check is validating the number of InvokeResponsesMessages we got. This is different then the earlier
308
+ # `len(responses)` check as you can have multiple InvokeResponses in a single message. But this test step
309
+ # is explicitly making sure that we recieved multiple ResponseMessages.
310
+ asserts .assert_greater_equal (test_only_result .ResponseMessageCount , 2 ,
311
+ "DUT was expected to send multiple InvokeResponseMessages" )
252
312
253
313
254
314
if __name__ == "__main__" :
0 commit comments