-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
269 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Copyright (c) 2023 Project CHIP Authors | ||
# | ||
# 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. | ||
|
||
name: 263.1.1. [TC-MWOM-1.1] Global attributes with DUT as Server | ||
|
||
PICS: | ||
- MWOM.S | ||
|
||
config: | ||
nodeId: 0x12344321 | ||
cluster: "Microwave Oven Mode" | ||
endpoint: 1 | ||
|
||
tests: | ||
- label: "Step 1: Wait for the commissioned device to be retrieved" | ||
cluster: "DelayCommands" | ||
command: "WaitForCommissionee" | ||
arguments: | ||
values: | ||
- name: "nodeId" | ||
value: nodeId | ||
|
||
- label: "Step 2: Read the global attribute: ClusterRevision" | ||
command: "readAttribute" | ||
attribute: "ClusterRevision" | ||
response: | ||
value: 1 | ||
constraints: | ||
type: int16u | ||
|
||
- label: "Step 3: Read the global attribute: FeatureMap" | ||
command: "readAttribute" | ||
attribute: "FeatureMap" | ||
PICS: "!MWOM.S.F00" | ||
response: | ||
value: 0 | ||
constraints: | ||
type: bitmap32 | ||
|
||
- label: "Step 4a: Read the global attribute: AttributeList" | ||
PICS: PICS_EVENT_LIST_ENABLED | ||
command: "readAttribute" | ||
attribute: "AttributeList" | ||
response: | ||
constraints: | ||
type: list | ||
contains: [0, 1, 65528, 65529, 65530, 65531, 65532, 65533] | ||
|
||
- label: "Step 4b: Read the global attribute: AttributeList" | ||
PICS: "!PICS_EVENT_LIST_ENABLED" | ||
command: "readAttribute" | ||
attribute: "AttributeList" | ||
response: | ||
constraints: | ||
type: list | ||
contains: [0, 1, 65528, 65529, 65531, 65532, 65533] | ||
|
||
- label: "Step 5: TH reads EventList attribute from DUT" | ||
PICS: PICS_EVENT_LIST_ENABLED | ||
command: "readAttribute" | ||
attribute: "EventList" | ||
response: | ||
value: [] | ||
constraints: | ||
type: list | ||
|
||
- label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." | ||
command: "readAttribute" | ||
attribute: "AcceptedCommandList" | ||
response: | ||
constraints: | ||
type: list | ||
contains: [0] | ||
|
||
- label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." | ||
command: "readAttribute" | ||
attribute: "GeneratedCommandList" | ||
response: | ||
constraints: | ||
type: list | ||
contains: [1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
# | ||
# 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 chip.clusters.Types import NullValue | ||
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main | ||
from mobly import asserts | ||
|
||
# This test requires several additional command line arguments | ||
# run with | ||
# --int-arg PIXIT_ENDPOINT:<endpoint> | ||
|
||
|
||
class TC_MWOM_1_2(MatterBaseTest): | ||
|
||
async def read_mod_attribute_expect_success(self, endpoint, attribute): | ||
cluster = Clusters.Objects.MicrowaveOvenMode | ||
return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) | ||
|
||
@async_test_body | ||
async def test_TC_MWOM_1_2(self): | ||
|
||
asserts.assert_true('PIXIT_ENDPOINT' in self.matter_test_config.global_test_params, | ||
"PIXIT_ENDPOINT must be included on the command line in " | ||
"the --int-arg flag as PIXIT_ENDPOINT:<endpoint>") | ||
|
||
self.endpoint = self.matter_test_config.global_test_params['PIXIT_ENDPOINT'] | ||
|
||
attributes = Clusters.MicrowaveOvenMode.Attributes | ||
|
||
self.print_step(1, "Commissioning, already done") | ||
|
||
if self.check_pics("MWOM.S.A0000"): | ||
self.print_step(2, "Read SupportedModes attribute") | ||
supported_modes = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.SupportedModes) | ||
|
||
logging.info("SupportedModes: %s" % (supported_modes)) | ||
|
||
asserts.assert_greater_equal(len(supported_modes), 2, "SupportedModes must have at least 2 entries!") | ||
asserts.assert_less_equal(len(supported_modes), 255, "SupportedModes must have at most 255 entries!") | ||
|
||
modes = [] | ||
for m in supported_modes: | ||
if m.mode in modes: | ||
asserts.fail("SupportedModes must have unique mode values!") | ||
else: | ||
modes.append(m.mode) | ||
|
||
labels = [] | ||
for m in supported_modes: | ||
if m.label in labels: | ||
asserts.fail("SupportedModes must have unique mode label values!") | ||
else: | ||
labels.append(m.label) | ||
|
||
# common mode tags | ||
commonTags = {0x0: 'Auto', | ||
0x1: 'Quick', | ||
0x2: 'Quiet', | ||
0x3: 'LowNoise', | ||
0x4: 'LowEnergy', | ||
0x5: 'Vacation', | ||
0x6: 'Min', | ||
0x7: 'Max', | ||
0x8: 'Night', | ||
0x9: 'Day'} | ||
|
||
# derived cluster defined tags | ||
derivedTags = [tag.value for tag in Clusters.MicrowaveOvenMode.Enums.ModeTag | ||
if tag is not Clusters.MicrowaveOvenMode.Enums.ModeTag.kUnknownEnumValue] | ||
|
||
for m in supported_modes: | ||
for t in m.modeTags: | ||
is_mfg = (0x8000 <= t.value and t.value <= 0xBFFF) | ||
asserts.assert_true(t.value in commonTags.keys() or t.value in derivedTags or is_mfg, | ||
"Found a SupportedModes entry with invalid mode tag value!") | ||
if t.value == Clusters.MicrowaveOvenMode.Enums.ModeTag.kNormal: | ||
normal_present = True | ||
if t.value == Clusters.MicrowaveOvenMode.Enums.ModeTag.kDefrost: | ||
defrost_present = True | ||
asserts.assert_true(normal_present, "The Supported Modes does not have an entry of Normal(0x4000)") | ||
|
||
if self.check_pics("MWOM.S.A0001"): | ||
self.print_step(3, "Read CurrentMode attribute") | ||
current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode) | ||
|
||
logging.info("CurrentMode: %s" % (current_mode)) | ||
asserts.assert_true(current_mode in modes, "CurrentMode is not a supported mode!") | ||
|
||
if self.check_pics("MWOM.S.A0003"): | ||
self.print_step(4, "Read OnMode attribute") | ||
on_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.OnMode) | ||
|
||
logging.info("OnMode: %s" % (on_mode)) | ||
asserts.assert_true(false, "OnMode is supported on the DUT when support is not allowed!") | ||
|
||
if self.check_pics("MWOM.S.A0002"): | ||
self.print_step(5, "Read StartUpMode attribute") | ||
startup_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.StartUpMode) | ||
|
||
logging.info("StartUpMode: %s" % (startup_mode)) | ||
asserts.assert_true(false, "StartUpMode is supported on the DUT when support is not allowed!") | ||
|
||
|
||
if __name__ == "__main__": | ||
default_matter_test_main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# | ||
# 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, async_test_body, default_matter_test_main, type_matches | ||
from mobly import asserts | ||
|
||
# This test requires several additional command line arguments | ||
# run with | ||
# --int-arg PIXIT_ENDPOINT:<endpoint> | ||
|
||
class TC_MWOM_2_1(MatterBaseTest): | ||
|
||
async def read_mod_attribute_expect_success(self, endpoint, attribute): | ||
cluster = Clusters.Objects.MicrowaveOvenMode | ||
return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) | ||
|
||
async def send_change_to_mode_cmd(self, newMode) -> Clusters.Objects.MicrowaveOvenMode.Commands.ChangeToModeResponse: | ||
ret = await self.send_single_cmd(cmd=Clusters.Objects.MicrowaveOvenMode.Commands.ChangeToMode(newMode=newMode), endpoint=self.endpoint) | ||
asserts.assert_true(type_matches(ret, Clusters.Objects.MicrowaveOvenMode.Commands.ChangeToModeResponse), | ||
"Unexpected return type for ChangeToMode") | ||
return ret | ||
|
||
@async_test_body | ||
async def test_TC_MWOM_2_1(self): | ||
|
||
asserts.assert_true('PIXIT_ENDPOINT' in self.matter_test_config.global_test_params, | ||
"PIXIT_ENDPOINT must be included on the command line in " | ||
"the --int-arg flag as PIXIT_ENDPOINT:<endpoint>") | ||
|
||
self.endpoint = self.matter_test_config.global_test_params['PIXIT_ENDPOINT'] | ||
|
||
asserts.assert_true(self.check_pics("MWOM.S.A0000"), "MWOM.S.A0000 must be supported") | ||
asserts.assert_true(self.check_pics("MWOM.S.A0001"), "MWOM.S.A0001 must be supported") | ||
asserts.assert_false(self.check_pics("MWOM.S.C00.Rsp"), "MWOM.S.C00.Rsp must NOT be supported") | ||
asserts.assert_false(self.check_pics("MWOM.S.C01.Tx"), "MWOM.S.C01.Tx must NOT be supported") | ||
|
||
if __name__ == "__main__": | ||
default_matter_test_main() |