forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTC_DeviceConformance.py
More file actions
163 lines (143 loc) · 7.92 KB
/
TC_DeviceConformance.py
File metadata and controls
163 lines (143 loc) · 7.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#
# Copyright (c) 2023 Project CHIP Authors
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments
# for details about the block below.
#
# === BEGIN CI TEST ARGUMENTS ===
# test-runner-runs:
# run1:
# app: ${CHIP_LOCK_APP}
# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
# script-args: >
# --storage-path admin_storage.json
# --manual-code 10054912339
# --bool-arg ignore_in_progress_test_event_only_disallowed_for_certification:True allow_provisional_test_event_only_disallowed_for_certification:True
# --PICS src/app/tests/suites/certification/ci-pics-values
# --trace-to json:${TRACE_TEST_JSON}.json
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
# --tests test_TC_IDM_10_2 test_TC_IDM_10_6 test_TC_DESC_2_3 test_TC_IDM_14_1
# --debug
# factory-reset: true
# quiet: true
# run2:
# app: ${ALL_DEVICES_APP}
# app-args: >
# --discriminator 1234
# --KVS kvs1
# --device on-off-light
# script-args: >
# --storage-path admin_storage.json
# --manual-code 10054912339
# --bool-arg ignore_in_progress_test_event_only_disallowed_for_certification:True allow_provisional_test_event_only_disallowed_for_certification:True
# --PICS src/app/tests/suites/certification/ci-pics-values
# --trace-to json:${TRACE_TEST_JSON}.json
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
# --tests test_TC_IDM_10_2 test_TC_IDM_10_6 test_TC_DESC_2_3 test_TC_IDM_14_1 test_TC_IDM_10_5
# --debug
# factory-reset: true
# quiet: true
# === END CI TEST ARGUMENTS ===
from matter.testing.decorators import async_test_body
# TODO: Enable 10.5 in CI once the door lock OTA requestor problem is sorted.
from matter.testing.device_conformance_tests import DeviceConformanceTests
from matter.testing.runner import TestStep, default_matter_test_main
class TC_DeviceConformance(DeviceConformanceTests):
@async_test_body
async def setup_class(self):
super().setup_class()
await self.setup_class_helper()
def test_TC_IDM_10_2(self):
# TODO: Turn this off after TE2
# https://github.com/project-chip/connectedhomeip/issues/34615
ignore_in_progress_test_event_only_disallowed_for_certification = self.user_params.get(
"ignore_in_progress_test_event_only_disallowed_for_certification", True)
allow_provisional_test_event_only_disallowed_for_certification = self.user_params.get(
"allow_provisional_test_event_only_disallowed_for_certification", False)
success, problems = self.check_conformance(ignore_in_progress_test_event_only_disallowed_for_certification,
self.is_pics_sdk_ci_only,
allow_provisional_test_event_only_disallowed_for_certification)
self.problems.extend(problems)
if not success:
self.fail_current_test("Problems with conformance")
def test_TC_IDM_10_3(self):
ignore_in_progress_test_event_only_disallowed_for_certification = self.user_params.get(
"ignore_in_progress_test_event_only_disallowed_for_certification", False)
success, problems = self.check_revisions(ignore_in_progress_test_event_only_disallowed_for_certification)
self.problems.extend(problems)
if not success:
self.fail_current_test("Problems with cluster revision on at least one cluster")
def test_TC_IDM_10_5(self):
fail_on_extra_clusters = self.user_params.get("fail_on_extra_clusters", True)
allow_provisional_test_event_only_disallowed_for_certification = self.user_params.get(
"allow_provisional_test_event_only_disallowed_for_certification", False)
success, problems = self.check_device_type(fail_on_extra_clusters,
allow_provisional_test_event_only_disallowed_for_certification)
self.problems.extend(problems)
if not success:
self.fail_current_test("Problems with Device type conformance on one or more endpoints")
def test_TC_IDM_10_6(self):
success, problems = self.check_device_type_revisions()
self.problems.extend(problems)
if not success:
self.fail_current_test("Problems with Device type revisions on one or more endpoints")
def steps_TC_IDM_14_1(self):
return [TestStep(0, "TH performs a wildcard read of all attributes and endpoints on the device"),
TestStep(1, """ For each root-node-restricted cluster in the list, ensure the cluster does not appear on any endpoint that is not the root node.
List of root-node-restricted clusters:
* ACL
* Time Synchronization
* TLS Certificate Management
* TLS Client Management
""", "No root-node-restricted clusters appear on non-root endpoints"),
TestStep(2, "Ensure the complex device type composition and conformance rules related to closure device types are met",
"Closure cluster device type rules are met"),
TestStep(3, "Ensure the rules related to semantic tags for the closure device types are met",
"Closure semantic tags rules are met")
]
def test_TC_IDM_14_1(self):
self.step(0) # wildcard read - done in setup
self.step(1)
problems = self.check_root_node_restricted_clusters()
self.step(2)
problems.extend(self.check_closure_restricted_clusters())
self.step(3)
problems.extend(self.check_closure_restricted_sem_tags())
if problems:
self.problems.extend(problems)
self.fail_current_test("One or more device conformance violations were found")
def steps_TC_DESC_2_3(self):
return [TestStep(0, "TH performs a wildcard read of all attributes on all endpoints on the device"),
TestStep(1, "TH checks the Root node endpoint and ensures no application device types are listed",
"No Application device types on EP0"),
TestStep(2, "For each non-root endpoint on the device, TH checks the DeviceTypeList of the Descriptor cluster and verifies that all the listed application device types are part of the same superset, and that no two device types are unrelated supersets of any device type."),
TestStep(3, "Fail test if either of the above steps failed.")]
# TODO: add check that at least one endpoint has an application endpoint or an aggregator
def desc_TC_DESC_2_3(self):
return "[TC-DESC-2.3] Test for superset application device types"
def test_TC_DESC_2_3(self):
self.step(0) # done in setup class
problems = []
self.step(1)
problems.extend(self.check_root_endpoint_for_application_device_types())
self.step(2)
problems.extend(self.check_all_application_device_types_superset())
self.step(3)
self.problems.extend(problems)
if problems:
self.fail_current_test("One or more application device type endpoint violations")
if __name__ == "__main__":
default_matter_test_main()