-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
Copy pathTC_BOOLCFG_4_1.py
102 lines (83 loc) · 4.55 KB
/
TC_BOOLCFG_4_1.py
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
#
# 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.
#
import logging
import chip.clusters as Clusters
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts
class TC_BOOLCFG_4_1(MatterBaseTest):
async def read_boolcfg_attribute_expect_success(self, endpoint, attribute):
cluster = Clusters.Objects.BooleanStateConfiguration
return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute)
def desc_TC_BOOLCFG_4_1(self) -> str:
return "[TC-BOOLCFG-4.1] AlarmsSupported attribute with DUT as Server"
def steps_TC_BOOLCFG_4_1(self) -> list[TestStep]:
steps = [
TestStep(1, "{comDutTH}.", "", is_commissioning=True),
TestStep(2, "{THread} _Featuremap_ attribute.", "{DUTreply} the _Featuremap_ attribute."),
TestStep(3, "If the _{F_VIS}_ or _{F_AUD}_ {featIsSupported}, {THread} _{A_ALARMSSUPPORTED}_ attribute. {storeValueAs} supportedAlarms.",
"{resDutSuccess} and that the received value is not 0."),
TestStep("4a", "If the _{F_VIS}_ {featIsSupported}.", "Verify that bit 0 in supportedAlarms is set to 1."),
TestStep("4b", "If the _{F_VIS}_ {featIsNotSupported}.", "Verify that bit 0 in supportedAlarms is set to 0."),
TestStep("5a", "If the _{F_AUD}_ {featIsSupported}.", "Verify that bit 1 in supportedAlarms is set to 1."),
TestStep("5b", "If the _{F_AUD}_ {featIsNotSupported}.", "Verify that bit 1 in supportedAlarms is set to 0."),
]
return steps
def pics_TC_BOOLCFG_4_1(self) -> list[str]:
pics = [
"BOOLCFG.S",
]
return pics
@async_test_body
async def test_TC_BOOLCFG_4_1(self):
endpoint = self.user_params.get("endpoint", 1)
self.step(1)
attributes = Clusters.BooleanStateConfiguration.Attributes
self.step(2)
feature_map = await self.read_boolcfg_attribute_expect_success(endpoint=endpoint, attribute=attributes.FeatureMap)
is_vis_feature_supported = feature_map & Clusters.BooleanStateConfiguration.Bitmaps.Feature.kVisual
is_aud_feature_supported = feature_map & Clusters.BooleanStateConfiguration.Bitmaps.Feature.kAudible
self.step(3)
if is_vis_feature_supported or is_aud_feature_supported:
supportedAlarms = await self.read_boolcfg_attribute_expect_success(endpoint=endpoint, attribute=attributes.AlarmsSupported)
else:
logging.info("Test step skipped")
self.step("4a")
if is_vis_feature_supported:
asserts.assert_not_equal((supportedAlarms & Clusters.BooleanStateConfiguration.Bitmaps.AlarmModeBitmap.kVisual), 0,
"Bit 0 in AlarmsSupported does not match feature map value")
else:
logging.info("Test step skipped")
self.step("4b")
if not is_vis_feature_supported:
asserts.assert_equal((supportedAlarms & Clusters.BooleanStateConfiguration.Bitmaps.AlarmModeBitmap.kVisual), 0,
"Bit 0 in AlarmsSupported does not match feature map value")
else:
logging.info("Test step skipped")
self.step("5a")
if is_aud_feature_supported:
asserts.assert_not_equal((supportedAlarms & Clusters.BooleanStateConfiguration.Bitmaps.AlarmModeBitmap.kAudible), 0,
"Bit 1 in AlarmsSupported does not match feature map value")
else:
logging.info("Test step skipped")
self.step("5b")
if not is_aud_feature_supported:
asserts.assert_equal((supportedAlarms & Clusters.BooleanStateConfiguration.Bitmaps.AlarmModeBitmap.kAudible), 0,
"Bit 1 in AlarmsSupported does not match feature map value")
else:
logging.info("Test step skipped")
if __name__ == "__main__":
default_matter_test_main()