From fe5dcfe18c9bd9a696ac41e81b650e670b339ba6 Mon Sep 17 00:00:00 2001 From: William Date: Thu, 25 Jan 2024 14:25:53 +0000 Subject: [PATCH] Update rvc mode cluters with new mode restrictions (#31560) * Updated step 3 in TC 1.1 for RvcRunMode and RvcCleanMode * Updated TC 1.2 for RvcRunMode and RvcCleanMode cluters. * Added TC 2.2 for the RvcCleanMode cluster. * Restyled by autopep8 * Added TC 2.2 for the RvcRunMode cluster. * Removed unused imports. * Regenerated zap files. * Added the PICS provider methods to the new python tests. * Changed the features supported by the RVC mode cluters in the all-clusters-app to match recent changes in the spec and tests. * Added the mapping mode tag to the all-clusters-app example * Changed the response returned by the RVC clean mode's handler of the ChanedToMode command to match the new spec. * Updated TC_RVCCLEAN_2_2 to remove incorrect type checks. * Apply suggestions from code review Co-authored-by: C Freeman Co-authored-by: Petru Lauric <81822411+plauric@users.noreply.github.com> * Updated the RVC run ChangeToMode handler in the all-clusters-app to match the new spec behaviour. * Updated the cl-pics-values for the RVC Run and Clean clusters. * Future proofed the enum to text function and change to using the --endpoint flag. * Fixed retrival of the endpoint setting. * Simplified some of the test code following review. * Removed test steps to match the test plan. * Changed the capture of the endpoint for the RVC run and RVC clean test 2.1. * Restyled by clang-format * Restyled by autopep8 * Regenerated zap files. * Removed duplicate RVCRUNM PICS from the ci-pics-values. * Updated PICS.yaml to reflect the new PICS requirements for the RvcRunMode and RvcCleanMode clusters. * Made all RVC python tests consistent regarding the capture of the endpoint and their documentation. * Apply typo suggestions from code review Co-authored-by: Petru Lauric <81822411+plauric@users.noreply.github.com> * Fixed the RVC clean handle change to mode in the all-clusters-app. * Restyled by clang-format --------- Co-authored-by: Restyled.io Co-authored-by: C Freeman Co-authored-by: Petru Lauric <81822411+plauric@users.noreply.github.com> --- .../all-clusters-common/include/rvc-modes.h | 8 +- .../all-clusters-common/src/rvc-modes.cpp | 15 +- src/app/tests/suites/certification/PICS.yaml | 13 +- .../certification/Test_TC_RVCCLEANM_1_1.yaml | 34 -- .../certification/Test_TC_RVCRUNM_1_1.yaml | 36 +-- .../tests/suites/certification/ci-pics-values | 19 +- src/python_testing/TC_RVCCLEANM_1_2.py | 104 ++++--- src/python_testing/TC_RVCCLEANM_2_1.py | 44 +-- src/python_testing/TC_RVCCLEANM_2_2.py | 125 ++++++++ src/python_testing/TC_RVCRUNM_1_2.py | 123 +++++--- src/python_testing/TC_RVCRUNM_2_1.py | 44 +-- src/python_testing/TC_RVCRUNM_2_2.py | 182 +++++++++++ .../zap-generated/test/Commands.h | 294 +++--------------- 13 files changed, 537 insertions(+), 504 deletions(-) create mode 100644 src/python_testing/TC_RVCCLEANM_2_2.py create mode 100644 src/python_testing/TC_RVCRUNM_2_2.py diff --git a/examples/all-clusters-app/all-clusters-common/include/rvc-modes.h b/examples/all-clusters-app/all-clusters-common/include/rvc-modes.h index af8313fa285385..8af4aa5f6f9155 100644 --- a/examples/all-clusters-app/all-clusters-common/include/rvc-modes.h +++ b/examples/all-clusters-app/all-clusters-common/include/rvc-modes.h @@ -41,6 +41,7 @@ class RvcRunModeDelegate : public ModeBase::Delegate using ModeTagStructType = detail::Structs::ModeTagStruct::Type; ModeTagStructType ModeTagsIdle[1] = { { .value = to_underlying(ModeTag::kIdle) } }; ModeTagStructType ModeTagsCleaning[1] = { { .value = to_underlying(ModeTag::kCleaning) } }; + ModeTagStructType ModeTagsMapping[1] = { { .value = to_underlying(ModeTag::kMapping) } }; const detail::Structs::ModeOptionStruct::Type kModeOptions[3] = { detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Idle"), @@ -49,10 +50,9 @@ class RvcRunModeDelegate : public ModeBase::Delegate detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Cleaning"), .mode = ModeCleaning, .modeTags = DataModel::List(ModeTagsCleaning) }, - detail::Structs::ModeOptionStruct::Type{ - .label = CharSpan::fromCharString("Mapping"), - .mode = ModeMapping, - .modeTags = DataModel::List(ModeTagsIdle) }, // todo set to no mode tags + detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Mapping"), + .mode = ModeMapping, + .modeTags = DataModel::List(ModeTagsMapping) }, }; CHIP_ERROR Init() override; diff --git a/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp b/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp index 480c8f793ceb4d..999d62ae48c263 100644 --- a/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp @@ -43,7 +43,7 @@ void RvcRunModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands: // Our business logic states that we can only switch into the mapping state from the idle state. if (NewMode == RvcRunMode::ModeMapping && currentMode != RvcRunMode::ModeIdle) { - response.status = to_underlying(ModeBase::StatusCode::kGenericFailure); + response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode); response.statusText.SetValue(chip::CharSpan::fromCharString("Change to the mapping mode is only allowed from idle")); return; } @@ -112,8 +112,7 @@ void emberAfRvcRunModeClusterInitCallback(chip::EndpointId endpointId) VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. VerifyOrDie(gRvcRunModeDelegate == nullptr && gRvcRunModeInstance == nullptr); gRvcRunModeDelegate = new RvcRunMode::RvcRunModeDelegate; - gRvcRunModeInstance = - new ModeBase::Instance(gRvcRunModeDelegate, 0x1, RvcRunMode::Id, chip::to_underlying(RvcRunMode::Feature::kOnOff)); + gRvcRunModeInstance = new ModeBase::Instance(gRvcRunModeDelegate, 0x1, RvcRunMode::Id, 0); gRvcRunModeInstance->Init(); } @@ -130,10 +129,11 @@ void RvcCleanModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Command { uint8_t rvcRunCurrentMode = gRvcRunModeInstance->GetCurrentMode(); - if (rvcRunCurrentMode == RvcRunMode::ModeCleaning) + if (rvcRunCurrentMode != RvcRunMode::ModeIdle) { - response.status = to_underlying(RvcCleanMode::StatusCode::kCleaningInProgress); - response.statusText.SetValue(chip::CharSpan::fromCharString("Cannot change the cleaning mode during a clean")); + response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode); + response.statusText.SetValue( + chip::CharSpan::fromCharString("Cannot change the cleaning mode when the device is not in idle")); return; } @@ -201,7 +201,6 @@ void emberAfRvcCleanModeClusterInitCallback(chip::EndpointId endpointId) VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. VerifyOrDie(gRvcCleanModeDelegate == nullptr && gRvcCleanModeInstance == nullptr); gRvcCleanModeDelegate = new RvcCleanMode::RvcCleanModeDelegate; - gRvcCleanModeInstance = - new ModeBase::Instance(gRvcCleanModeDelegate, 0x1, RvcCleanMode::Id, chip::to_underlying(RvcCleanMode::Feature::kOnOff)); + gRvcCleanModeInstance = new ModeBase::Instance(gRvcCleanModeDelegate, 0x1, RvcCleanMode::Id, 0); gRvcCleanModeInstance->Init(); } diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index af29b4df7a37b9..93cfe963c6bc13 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -9116,12 +9116,6 @@ PICS: - label: "Does the device implement the CurrentMode attribute?" id: RVCCLEANM.S.A0001 - - label: "Does the device implement the StartUpMode attribute?" - id: RVCCLEANM.S.A0002 - - - label: "Does the device implement the OnMode attribute?" - id: RVCCLEANM.S.A0003 - # # server / Commands received # @@ -9334,11 +9328,8 @@ PICS: - label: "Does the device implement the CurrentMode attribute?" id: RVCRUNM.S.A0001 - - label: "Does the device implement the StartUpMode attribute?" - id: RVCRUNM.S.A0002 - - - label: "Does the device implement the OnMode attribute?" - id: RVCRUNM.S.A0003 + - label: "Can the mode change be manually controlled?" + id: RVCRUNM.S.M.CAN_MANUALLY_CONTROLLED #Commands received - label: "Does the device implement receiving the ChangeToMode command?" diff --git a/src/app/tests/suites/certification/Test_TC_RVCCLEANM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_RVCCLEANM_1_1.yaml index f95386249c2dff..1a4dbae62cb01f 100644 --- a/src/app/tests/suites/certification/Test_TC_RVCCLEANM_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_RVCCLEANM_1_1.yaml @@ -42,7 +42,6 @@ tests: type: int16u - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - PICS: " !RVCCLEANM.S.F00 " command: "readAttribute" attribute: "FeatureMap" response: @@ -50,17 +49,6 @@ tests: constraints: type: bitmap32 - - label: - "Step 3: Given RVCCLEANM.S.F00(DEPONOFF) ensure featuremap has the - correct bit set" - PICS: RVCCLEANM.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." PICS: PICS_EVENT_LIST_ENABLED command: "readAttribute" @@ -79,28 +67,6 @@ tests: type: list contains: [0, 1, 65528, 65529, 65531, 65532, 65533] - - label: - "Step 4c: TH reads the Feature dependent(RVCCLEANM.S.F00 - DEPONOFF) - and optional attribute(OnMode) is in AttributeList from the DUT" - PICS: RVCCLEANM.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: - "Step 4c: TH reads the Feature dependent(RVCCLEANM.S.F00 - DEPONOFF) - and optional attribute(OnMode) is not in AttributeList from the DUT" - PICS: " !RVCCLEANM.S.F00 " - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - excludes: [3] - - label: "Step 5: TH reads from the DUT the EventList attribute." PICS: PICS_EVENT_LIST_ENABLED command: "readAttribute" diff --git a/src/app/tests/suites/certification/Test_TC_RVCRUNM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_RVCRUNM_1_1.yaml index cb97b72a1d2a79..f9b4aed3db30c3 100644 --- a/src/app/tests/suites/certification/Test_TC_RVCRUNM_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_RVCRUNM_1_1.yaml @@ -41,8 +41,7 @@ tests: constraints: type: int16u - - label: "Step 3a: TH reads from the DUT the FeatureMap attribute." - PICS: " !RVCRUNM.S.F00 " + - label: "Step 3: TH reads from the DUT the FeatureMap attribute." command: "readAttribute" attribute: "FeatureMap" response: @@ -50,17 +49,6 @@ tests: constraints: type: bitmap32 - - label: - "Step 3b: Given RVCRUNM.S.F00(DEPONOFF) ensure featuremap has the - correct bit set" - PICS: RVCRUNM.S.F00 - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: bitmap32 - hasMasksSet: [0x1] - - label: "Step 4a: TH reads from the DUT the AttributeList attribute." PICS: PICS_EVENT_LIST_ENABLED command: "readAttribute" @@ -79,28 +67,6 @@ tests: type: list contains: [0, 1, 65528, 65529, 65531, 65532, 65533] - - label: - "Step 4c: TH reads the Feature dependent(RVCRUNM.S.F00 - DEPONOFF) and - optional attribute(OnMode) is in AttributeList from the DUT" - PICS: RVCRUNM.S.F00 - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - contains: [3] - - - label: - "Step 4d: TH reads the Feature dependent(RVCRUNM.S.F00 - DEPONOFF) and - optional attribute(OnMode) is not in AttributeList from the DUT" - PICS: " !RVCRUNM.S.F00 " - command: "readAttribute" - attribute: "AttributeList" - response: - constraints: - type: list - excludes: [3] - - label: "Step 5: TH reads from the DUT the EventList attribute." PICS: PICS_EVENT_LIST_ENABLED command: "readAttribute" diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index 4201b969a81020..4c4df4cef22a9a 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -2438,11 +2438,9 @@ RVCCLEANM.S=1 #Server RVCCLEANM.S.A0000=1 RVCCLEANM.S.A0001=1 -RVCCLEANM.S.A0002=0 -RVCCLEANM.S.A0003=1 #Feature -RVCCLEANM.S.F00=1 +RVCCLEANM.S.F00=0 #commands RVCCLEANM.S.C00.Rsp=1 @@ -2506,19 +2504,18 @@ RVCOPSTATE.C.C04.Tx=1 # RVC RUN MODE CLUSTER RVCRUNM.S=1 -RVCRUNM.S.F00=1 +RVCRUNM.S.F00=0 #Server RVCRUNM.S.A0000=1 RVCRUNM.S.A0001=1 -RVCRUNM.S.A0002=0 -RVCRUNM.S.A0003=1 #Commands RVCRUNM.S.C00.Rsp=1 RVCRUNM.S.C01.Tx=1 RVCRUNM.S.M.CAN_TEST_MODE_FAILURE=1 +RVCRUNM.S.M.CAN_MANUALLY_CONTROLLED=1 #PIXIT PIXIT.RVCRUNM.MODE_CHANGE_FAIL=1 @@ -2691,16 +2688,6 @@ WASHERCTRL.S.M.ManuallyControlledSpin=1 WASHERCTRL.S.M.ManuallyControlledRinse=1 WASHERCTRL.S.M.ManuallyControlled=0 -#RVC Run Mode -RVCRUNM.S=1 -RVCRUNM.S.F00=1 -RVCRUNM.S.A0000=1 -RVCRUNM.S.A0001=1 -RVCRUNM.S.A0002=0 -RVCRUNM.S.A0003=1 -RVCRUNM.S.C00.Rsp=1 -RVCRUNM.S.C01.Tx=1 - #Refrigerator Alarm REFALM.S=1 REFALM.C=1 diff --git a/src/python_testing/TC_RVCCLEANM_1_2.py b/src/python_testing/TC_RVCCLEANM_1_2.py index a3a764830e96be..2f3c6f9dd0085a 100644 --- a/src/python_testing/TC_RVCCLEANM_1_2.py +++ b/src/python_testing/TC_RVCCLEANM_1_2.py @@ -18,16 +18,26 @@ 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: - class TC_RVCCLEANM_1_2(MatterBaseTest): + def __init__(self, *args): + super().__init__(*args) + self.endpoint = 0 + self.commonTags = {0x0: 'Auto', + 0x1: 'Quick', + 0x2: 'Quiet', + 0x3: 'LowNoise', + 0x4: 'LowEnergy', + 0x5: 'Vacation', + 0x6: 'Min', + 0x7: 'Max', + 0x8: 'Night', + 0x9: 'Day'} + self.cleanTags = [tag.value for tag in Clusters.RvcCleanMode.Enums.ModeTag] + self.supported_modes_dut = [] async def read_mod_attribute_expect_success(self, endpoint, attribute): cluster = Clusters.Objects.RvcCleanMode @@ -38,12 +48,7 @@ def pics_TC_RVCCLEANM_1_2(self) -> list[str]: @async_test_body async def test_TC_RVCCLEANM_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:") - - self.endpoint = self.matter_test_config.global_test_params['PIXIT_ENDPOINT'] + self.endpoint = self.matter_test_config.endpoint attributes = Clusters.RvcCleanMode.Attributes @@ -55,16 +60,18 @@ async def test_TC_RVCCLEANM_1_2(self): logging.info("SupportedModes: %s" % (supported_modes)) + # Verify that the list has at least 2 and at most 255 entries 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 = [] + # Verify that each ModeOptionsStruct entry has a unique Mode field value for m in supported_modes: - if m.mode in modes: + if m.mode in self.supported_modes_dut: asserts.fail("SupportedModes must have unique mode values!") else: - modes.append(m.mode) + self.supported_modes_dut.append(m.mode) + # Verify that each ModeOptionsStruct entry has a unique Label field value labels = [] for m in supported_modes: if m.label in labels: @@ -72,47 +79,50 @@ async def test_TC_RVCCLEANM_1_2(self): 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'} - - cleanTags = [tag.value for tag in Clusters.RvcCleanMode.Enums.ModeTag - if tag is not Clusters.RvcCleanMode.Enums.ModeTag.kUnknownEnumValue] - + # Verify that each ModeOptionsStruct entry's ModeTags field has: for m in supported_modes: + # * at least one entry + if len(m.modeTags) == 0: + asserts.fail("SupportedModes must have at least one mode tag!") + + at_least_one_common_or_clean_tag = False 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 cleanTags or is_mfg, - "Found a SupportedModes entry with invalid mode tag value!") + # * the values of the Value fields that are not larger than 16 bits + if t.value > 0xFFFF or t.value < 0: + asserts.fail("Mode tag values must not be larger than 16 bits!") + + # * for each Value field: {isCommonOrDerivedOrMfgTagsVal} + is_mfg = (0x8000 <= t.value <= 0xBFFF) + if (t.value not in self.commonTags and + t.value not in self.cleanTags and + not is_mfg): + asserts.fail("Mode tag value is not a common tag, clean tag or vendor tag!") + + # * for at least one Value field: {isCommonOrDerivedTagsVal} + if not is_mfg: + at_least_one_common_or_clean_tag = True + + if not at_least_one_common_or_clean_tag: + asserts.fail("At least one mode tag must be a common tag or clean tag!") + + # Verify that at least one ModeOptionsStruct entry includes either the + # Vacuum(0x4001) mode tag or the Mop(0x4002)mode tag in the ModeTags field + vacuum_mop_tags = [Clusters.RvcCleanMode.Enums.ModeTag.kVacuum, Clusters.RvcCleanMode.Enums.ModeTag.kMop] + has_vacuum_or_mop_mode_tag = False + for m in supported_modes: + has_vacuum_or_mop_mode_tag = any(t.value in vacuum_mop_tags for t in m.modeTags) + if has_vacuum_or_mop_mode_tag: + break + + asserts.assert_true(has_vacuum_or_mop_mode_tag, + "At least one ModeOptionsStruct entry must include either the Vacuum or Mop mode tag") if self.check_pics("RVCCLEANM.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("RVCCLEANM.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(on_mode in modes or on_mode == NullValue, "OnMode is not a supported mode!") - - if self.check_pics("RVCCLEANM.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(startup_mode in modes or startup_mode == NullValue, "StartUpMode is not a supported mode!") + asserts.assert_true(current_mode in self.supported_modes_dut, "CurrentMode is not a supported mode!") if __name__ == "__main__": diff --git a/src/python_testing/TC_RVCCLEANM_2_1.py b/src/python_testing/TC_RVCCLEANM_2_1.py index 56743b6192551e..4f553206eb0a7f 100644 --- a/src/python_testing/TC_RVCCLEANM_2_1.py +++ b/src/python_testing/TC_RVCCLEANM_2_1.py @@ -23,11 +23,17 @@ # This test requires several additional command line arguments # run with -# --int-arg PIXIT_ENDPOINT: PIXIT.RVCCLEANM.MODE_CHANGE_OK: PIXIT.RVCCLEANM.MODE_CHANGE_FAIL: +# --int-arg PIXIT.RVCCLEANM.MODE_CHANGE_OK: PIXIT.RVCCLEANM.MODE_CHANGE_FAIL: class TC_RVCCLEANM_2_1(MatterBaseTest): + def __init__(self, *args): + super().__init__(*args) + self.endpoint = 0 + self.mode_ok = 0 + self.mode_fail = 0 + async def read_mod_attribute_expect_success(self, endpoint, attribute): cluster = Clusters.Objects.RvcCleanMode return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) @@ -44,9 +50,6 @@ def pics_TC_RVCCLEANM_2_1(self) -> list[str]: @async_test_body async def test_TC_RVCCLEANM_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:") asserts.assert_true('PIXIT.RVCCLEANM.MODE_CHANGE_OK' in self.matter_test_config.global_test_params, "PIXIT.RVCCLEANM.MODE_CHANGE_OK must be included on the command line in " "the --int-arg flag as PIXIT.RVCCLEANM.MODE_CHANGE_OK:") @@ -54,9 +57,9 @@ async def test_TC_RVCCLEANM_2_1(self): "PIXIT.RVCCLEANM.MODE_CHANGE_FAIL must be included on the command line in " "the --int-arg flag as PIXIT.RVCCLEANM.MODE_CHANGE_FAIL:") - self.endpoint = self.matter_test_config.global_test_params['PIXIT_ENDPOINT'] - self.modeok = self.matter_test_config.global_test_params['PIXIT.RVCCLEANM.MODE_CHANGE_OK'] - self.modefail = self.matter_test_config.global_test_params['PIXIT.RVCCLEANM.MODE_CHANGE_FAIL'] + self.endpoint = self.matter_test_config.endpoint + self.mode_ok = self.matter_test_config.global_test_params['PIXIT.RVCCLEANM.MODE_CHANGE_OK'] + self.mode_fail = self.matter_test_config.global_test_params['PIXIT.RVCCLEANM.MODE_CHANGE_FAIL'] asserts.assert_true(self.check_pics("RVCCLEANM.S.A0000"), "RVCCLEANM.S.A0000 must be supported") asserts.assert_true(self.check_pics("RVCCLEANM.S.A0001"), "RVCCLEANM.S.A0001 must be supported") @@ -93,8 +96,7 @@ class CommonCodes(Enum): GENERIC_FAILURE = 0x02 INVALID_IN_MODE = 0x03 - rvcCleanCodes = [code.value for code in Clusters.RvcCleanMode.Enums.StatusCode - if code is not Clusters.RvcCleanMode.Enums.StatusCode.kUnknownEnumValue] + rvcCleanCodes = [code.value for code in Clusters.RvcCleanMode.Enums.StatusCode] self.print_step(4, "Send ChangeToMode command with NewMode set to %d" % (old_current_mode)) @@ -102,9 +104,9 @@ class CommonCodes(Enum): asserts.assert_true(ret.status == CommonCodes.SUCCESS.value, "Changing the mode to the current mode should be a no-op") if self.check_pics("RVCCLEANM.S.M.CAN_TEST_MODE_FAILURE"): - asserts.assert_true(self.modefail in modes, - "The MODE_CHANGE_FAIL PIXIT value (%d) is not a supported mode" % (self.modefail)) - self.print_step(5, "Manually put the device in a state from which it will FAIL to transition to mode %d" % (self.modefail)) + asserts.assert_true(self.mode_fail in modes, + "The MODE_CHANGE_FAIL PIXIT value (%d) is not a supported mode" % (self.mode_fail)) + self.print_step(5, "Manually put the device in a state from which it will FAIL to transition to mode %d" % (self.mode_fail)) input("Press Enter when done.\n") self.print_step(6, "Read CurrentMode attribute") @@ -112,15 +114,15 @@ class CommonCodes(Enum): logging.info("CurrentMode: %s" % (old_current_mode)) - self.print_step(7, "Send ChangeToMode command with NewMode set to %d" % (self.modefail)) + self.print_step(7, "Send ChangeToMode command with NewMode set to %d" % (self.mode_fail)) - ret = await self.send_change_to_mode_cmd(newMode=self.modefail) + ret = await self.send_change_to_mode_cmd(newMode=self.mode_fail) st = ret.status is_mfg_code = st in range(0x80, 0xC0) is_err_code = (st == CommonCodes.GENERIC_FAILURE.value) or ( st == CommonCodes.INVALID_IN_MODE.value) or (st in rvcCleanCodes) or is_mfg_code asserts.assert_true( - is_err_code, "Changing to mode %d must fail due to the current state of the device" % (self.modefail)) + is_err_code, "Changing to mode %d must fail due to the current state of the device" % (self.mode_fail)) st_text_len = len(ret.statusText) asserts.assert_true(st_text_len in range(1, 65), "StatusText length (%d) must be between 1 and 64" % (st_text_len)) @@ -131,7 +133,7 @@ class CommonCodes(Enum): asserts.assert_true(current_mode == old_current_mode, "CurrentMode changed after failed ChangeToMode command!") - self.print_step(9, "Manually put the device in a state from which it will SUCCESSFULLY transition to mode %d" % (self.modeok)) + self.print_step(9, "Manually put the device in a state from which it will SUCCESSFULLY transition to mode %d" % (self.mode_ok)) input("Press Enter when done.\n") self.print_step(10, "Read CurrentMode attribute") @@ -139,18 +141,18 @@ class CommonCodes(Enum): logging.info("CurrentMode: %s" % (old_current_mode)) - self.print_step(11, "Send ChangeToMode command with NewMode set to %d" % (self.modeok)) + self.print_step(11, "Send ChangeToMode command with NewMode set to %d" % (self.mode_ok)) - ret = await self.send_change_to_mode_cmd(newMode=self.modeok) + ret = await self.send_change_to_mode_cmd(newMode=self.mode_ok) asserts.assert_true(ret.status == CommonCodes.SUCCESS.value, - "Changing to mode %d must succeed due to the current state of the device" % (self.modeok)) + "Changing to mode %d must succeed due to the current state of the device" % (self.mode_ok)) self.print_step(12, "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 == self.modeok, + asserts.assert_true(current_mode == self.mode_ok, "CurrentMode doesn't match the argument of the successful ChangeToMode command!") self.print_step(13, "Send ChangeToMode command with NewMode set to %d" % (invalid_mode)) @@ -164,7 +166,7 @@ class CommonCodes(Enum): logging.info("CurrentMode: %s" % (current_mode)) - asserts.assert_true(current_mode == self.modeok, "CurrentMode changed after failed ChangeToMode command!") + asserts.assert_true(current_mode == self.mode_ok, "CurrentMode changed after failed ChangeToMode command!") if __name__ == "__main__": diff --git a/src/python_testing/TC_RVCCLEANM_2_2.py b/src/python_testing/TC_RVCCLEANM_2_2.py new file mode 100644 index 00000000000000..a4107e12c70665 --- /dev/null +++ b/src/python_testing/TC_RVCCLEANM_2_2.py @@ -0,0 +1,125 @@ +# +# Copyright (c) 2024 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 chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main +from mobly import asserts + + +class TC_RVCCLEANM_2_2(MatterBaseTest): + + def __init__(self, *args): + super().__init__(*args) + self.endpoint = 0 + self.supported_run_modes = {} # these are the ModeOptionStructs + self.supported_run_modes_dut = [] + self.supported_clean_modes_dut = [] + self.run_mode_dut = 0 + self.old_clean_mode_dut = 0 + self.new_clean_mode_th = 0 + + async def read_mod_attribute_expect_success(self, cluster, attribute): + return await self.read_single_attribute_check_success( + endpoint=self.endpoint, cluster=cluster, attribute=attribute) + + async def read_run_supported_modes(self) -> Clusters.Objects.RvcRunMode.Attributes.SupportedModes: + ret = await self.read_mod_attribute_expect_success( + Clusters.RvcRunMode, + Clusters.RvcRunMode.Attributes.SupportedModes) + return ret + + async def read_clean_supported_modes(self) -> Clusters.Objects.RvcCleanMode.Attributes.SupportedModes: + ret = await self.read_mod_attribute_expect_success( + Clusters.RvcCleanMode, + Clusters.RvcCleanMode.Attributes.SupportedModes) + return ret + + async def send_change_to_mode_cmd(self, newMode) -> Clusters.Objects.RvcCleanMode.Commands.ChangeToModeResponse: + ret = await self.send_single_cmd(cmd=Clusters.Objects.RvcCleanMode.Commands.ChangeToMode(newMode=newMode), endpoint=self.endpoint) + return ret + + # Prints the instruction and waits for a user input to continue + def print_instruction(self, step_number, instruction): + self.print_step(step_number, instruction) + input("Press Enter when done.\n") + + def pics_TC_RVCCLEANM_2_2(self) -> list[str]: + return ["RVCCLEANM.S"] + + @async_test_body + async def test_TC_RVCCLEANM_2_2(self): + self.endpoint = self.matter_test_config.endpoint + + asserts.assert_true(self.check_pics("RVCCLEANM.S"), "RVCCLEANM.S must be supported") + asserts.assert_true(self.check_pics("RVCRUNM.S.A0000"), "RVCRUNM.S.A0000 must be supported") + asserts.assert_true(self.check_pics("RVCRUNM.S.A0001"), "RVCRUNM.S.A0001 must be supported") + + self.print_step(1, "Commissioning, already done") + + self.print_instruction(2, "Manually put the device in a state in which the RVC Run Mode " + "cluster’s CurrentMode attribute is set to a mode without the Idle mode tag.") + + self.print_step(3, "Read the RvcRunMode SupportedModes attribute") + supported_run_modes = await self.read_run_supported_modes() + for mode in supported_run_modes: + self.supported_run_modes[mode.mode] = mode + # Save the Mode field values as supported_run_modes_dut + self.supported_run_modes_dut.append(mode.mode) + + self.print_step(4, "Read the RvcRunMode CurrentMode attribute") + current_run_mode = await self.read_mod_attribute_expect_success( + Clusters.RvcRunMode, + Clusters.RvcRunMode.Attributes.CurrentMode) + + # Save the value as run_mode_dut + self.run_mode_dut = current_run_mode + + # Verify that the supported_run_modes_dut entry matching run_mode_dut does not have the Idle (0x4000) mode tag. + for t in self.supported_run_modes[current_run_mode].modeTags: + asserts.assert_true(t.value != Clusters.RvcRunMode.Enums.ModeTag.kIdle, + "The device must be in a mode without the Idle (0x4000) mode tag.") + + self.print_step(5, "Read the RvcCleanMode SupportedModes attribute") + supported_clean_modes = await self.read_clean_supported_modes() + for mode in supported_clean_modes: + # Save the Mode field values as supported_run_modes_dut + self.supported_clean_modes_dut.append(mode.mode) + + self.print_step(6, "Read the RvcCleanMode CurrentMode attribute") + current_clean_mode = await self.read_mod_attribute_expect_success( + Clusters.RvcCleanMode, + Clusters.RvcCleanMode.Attributes.CurrentMode) + + # Save the value as old_clean_mode_dut + self.old_clean_mode_dut = current_clean_mode + + # Select from supported_clean_modes_dut a value which is different from old_clean_mode_dut, + # and save it as new_clean_mode_th + for mode in self.supported_clean_modes_dut: + if mode != self.old_clean_mode_dut: + self.new_clean_mode_th = mode + break + + self.print_step(7, "Send ChangeToMode command") + response = await self.send_change_to_mode_cmd(self.new_clean_mode_th) + asserts.assert_equal(response.status, 3, + "The response should contain a ChangeToModeResponse command " + "with the Status set to InvalidInMode(0x03).") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_RVCRUNM_1_2.py b/src/python_testing/TC_RVCRUNM_1_2.py index 68684e45dd5c61..4fc9a1f5cab7d9 100644 --- a/src/python_testing/TC_RVCRUNM_1_2.py +++ b/src/python_testing/TC_RVCRUNM_1_2.py @@ -18,16 +18,26 @@ 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: - class TC_RVCRUNM_1_2(MatterBaseTest): + def __init__(self, *args): + super().__init__(*args) + self.endpoint = 0 + self.commonTags = {0x0: 'Auto', + 0x1: 'Quick', + 0x2: 'Quiet', + 0x3: 'LowNoise', + 0x4: 'LowEnergy', + 0x5: 'Vacation', + 0x6: 'Min', + 0x7: 'Max', + 0x8: 'Night', + 0x9: 'Day'} + self.runTags = [tag.value for tag in Clusters.RvcRunMode.Enums.ModeTag] + self.supported_modes_dut = [] async def read_mod_attribute_expect_success(self, endpoint, attribute): cluster = Clusters.Objects.RvcRunMode @@ -38,12 +48,7 @@ def pics_TC_RVCRUNM_1_2(self) -> list[str]: @async_test_body async def test_TC_RVCRUNM_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:") - - self.endpoint = self.matter_test_config.global_test_params['PIXIT_ENDPOINT'] + self.endpoint = self.matter_test_config.endpoint attributes = Clusters.RvcRunMode.Attributes @@ -55,16 +60,18 @@ async def test_TC_RVCRUNM_1_2(self): logging.info("SupportedModes: %s" % (supported_modes)) + # Verify that the list has at least 2 and at most 255 entries 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 = [] + # Verify that each ModeOptionsStruct entry has a unique Mode field value for m in supported_modes: - if m.mode in modes: + if m.mode in self.supported_modes_dut: asserts.fail("SupportedModes must have unique mode values!") else: - modes.append(m.mode) + self.supported_modes_dut.append(m.mode) + # Verify that each ModeOptionsStruct entry has a unique Label field value labels = [] for m in supported_modes: if m.label in labels: @@ -72,53 +79,69 @@ async def test_TC_RVCRUNM_1_2(self): 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'} - - runTags = [tag.value for tag in Clusters.RvcRunMode.Enums.ModeTag - if tag is not Clusters.RvcRunMode.Enums.ModeTag.kUnknownEnumValue] + # Verify that each ModeOptionsStruct entry's ModeTags field has: + for m in supported_modes: + # * at least one entry + if len(m.modeTags) == 0: + asserts.fail("SupportedModes must have at least one mode tag!") + at_least_one_common_or_run_tag = False + for t in m.modeTags: + # * the values of the Value fields that are not larger than 16 bits + if t.value > 0xFFFF or t.value < 0: + asserts.fail("Mode tag values must not be larger than 16 bits!") + + # * for each Value field: {isCommonOrDerivedOrMfgTagsVal} + is_mfg = (0x8000 <= t.value <= 0xBFFF) + if (t.value not in self.commonTags and + t.value not in self.runTags and + not is_mfg): + asserts.fail("Mode tag value is not a common tag, run tag or vendor tag!") + + # * for at least one Value field: {isCommonOrDerivedTagsVal} + if not is_mfg: + at_least_one_common_or_run_tag = True + + if not at_least_one_common_or_run_tag: + asserts.fail("At least one mode tag must be a common tag or run tag!") + + # Verify that at least one ModeOptionsStruct entry includes the Idle(0x4000) + # mode tag in the ModeTags field + at_least_one_idle_mode_tag = False + # Verify that at least one ModeOptionsStruct entry includes the Cleaning(0x4001) + # mode tag in the ModeTags field + at_least_one_cleaning_mode_tag = False for m in supported_modes: + # Verify that each ModeOptionsStruct entry includes at most one of the following + # mode tags: Idle(0x4000), Cleaning(0x4001), _Mapping(0x4002) + count_of_idle_cleaning_or_mapping_mode_tags = 0 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 runTags or is_mfg, - "Found a SupportedModes entry with invalid mode tag value!") if t.value == Clusters.RvcRunMode.Enums.ModeTag.kIdle: - idle_present = True + at_least_one_idle_mode_tag = True + count_of_idle_cleaning_or_mapping_mode_tags += 1 + if t.value == Clusters.RvcRunMode.Enums.ModeTag.kCleaning: - cleaning_present = True - asserts.assert_true(idle_present, "The Supported Modes does not have an entry of Idle(0x4000)") - asserts.assert_true(cleaning_present, "The Supported Modes does not have an entry of Cleaning(0x4001)") + at_least_one_cleaning_mode_tag = True + count_of_idle_cleaning_or_mapping_mode_tags += 1 + + if t.value == Clusters.RvcRunMode.Enums.ModeTag.kMapping: + count_of_idle_cleaning_or_mapping_mode_tags += 1 + + if count_of_idle_cleaning_or_mapping_mode_tags > 1: + asserts.fail("A ModeOptionsStruct entry includes more than one of the following " + "mode tags: Idle(0x4000), Cleaning(0x4001), Mapping(0x4002)!") + + asserts.assert_true(at_least_one_idle_mode_tag, + "The Supported Modes does not have an entry of Idle(0x4000)") + asserts.assert_true(at_least_one_cleaning_mode_tag, + "The Supported Modes does not have an entry of Cleaning(0x4001)") if self.check_pics("RVCRUNM.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("RVCRUNM.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(on_mode in modes or on_mode == NullValue, "OnMode is not a supported mode!") - - if self.check_pics("RVCRUNM.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(startup_mode in modes or startup_mode == NullValue, "StartUpMode is not a supported mode!") + asserts.assert_true(current_mode in self.supported_modes_dut, "CurrentMode is not a supported mode!") if __name__ == "__main__": diff --git a/src/python_testing/TC_RVCRUNM_2_1.py b/src/python_testing/TC_RVCRUNM_2_1.py index 20229d1b7dd00d..60afbef1b2b115 100644 --- a/src/python_testing/TC_RVCRUNM_2_1.py +++ b/src/python_testing/TC_RVCRUNM_2_1.py @@ -23,11 +23,17 @@ # This test requires several additional command line arguments # run with -# --int-arg PIXIT_ENDPOINT: PIXIT.RVCRUNM.MODE_CHANGE_OK: PIXIT.RVCRUNM.MODE_CHANGE_FAIL: +# --int-arg PIXIT.RVCRUNM.MODE_CHANGE_OK: PIXIT.RVCRUNM.MODE_CHANGE_FAIL: class TC_RVCRUNM_2_1(MatterBaseTest): + def __init__(self, *args): + super().__init__(*args) + self.endpoint = 0 + self.mode_ok = 0 + self.mode_fail = 0 + async def read_mod_attribute_expect_success(self, endpoint, attribute): cluster = Clusters.Objects.RvcRunMode return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) @@ -44,9 +50,6 @@ def pics_TC_RVCRUNM_2_1(self) -> list[str]: @async_test_body async def test_TC_RVCRUNM_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:") asserts.assert_true('PIXIT.RVCRUNM.MODE_CHANGE_OK' in self.matter_test_config.global_test_params, "PIXIT.RVCRUNM.MODE_CHANGE_OK must be included on the command line in " "the --int-arg flag as PIXIT.RVCRUNM.MODE_CHANGE_OK:") @@ -54,9 +57,9 @@ async def test_TC_RVCRUNM_2_1(self): "PIXIT.RVCRUNM.MODE_CHANGE_FAIL must be included on the command line in " "the --int-arg flag as PIXIT.RVCRUNM.MODE_CHANGE_FAIL:") - self.endpoint = self.matter_test_config.global_test_params['PIXIT_ENDPOINT'] - self.modeok = self.matter_test_config.global_test_params['PIXIT.RVCRUNM.MODE_CHANGE_OK'] - self.modefail = self.matter_test_config.global_test_params['PIXIT.RVCRUNM.MODE_CHANGE_FAIL'] + self.endpoint = self.matter_test_config.endpoint + self.mode_ok = self.matter_test_config.global_test_params['PIXIT.RVCRUNM.MODE_CHANGE_OK'] + self.mode_fail = self.matter_test_config.global_test_params['PIXIT.RVCRUNM.MODE_CHANGE_FAIL'] asserts.assert_true(self.check_pics("RVCRUNM.S.A0000"), "RVCRUNM.S.A0000 must be supported") asserts.assert_true(self.check_pics("RVCRUNM.S.A0001"), "RVCRUNM.S.A0001 must be supported") @@ -93,8 +96,7 @@ class CommonCodes(Enum): GENERIC_FAILURE = 0x02 INVALID_IN_MODE = 0x03 - rvcRunCodes = [code.value for code in Clusters.RvcRunMode.Enums.StatusCode - if code is not Clusters.RvcRunMode.Enums.StatusCode.kUnknownEnumValue] + rvcRunCodes = [code.value for code in Clusters.RvcRunMode.Enums.StatusCode] self.print_step(4, "Send ChangeToMode command with NewMode set to %d" % (old_current_mode)) @@ -102,9 +104,9 @@ class CommonCodes(Enum): asserts.assert_true(ret.status == CommonCodes.SUCCESS.value, "Changing the mode to the current mode should be a no-op") if self.check_pics("RVCRUNM.S.M.CAN_TEST_MODE_FAILURE"): - asserts.assert_true(self.modefail in modes, - "The MODE_CHANGE_FAIL PIXIT value (%d) is not a supported mode" % (self.modefail)) - self.print_step(5, "Manually put the device in a state from which it will FAIL to transition to mode %d" % (self.modefail)) + asserts.assert_true(self.mode_fail in modes, + "The MODE_CHANGE_FAIL PIXIT value (%d) is not a supported mode" % (self.mode_fail)) + self.print_step(5, "Manually put the device in a state from which it will FAIL to transition to mode %d" % (self.mode_fail)) input("Press Enter when done.\n") self.print_step(6, "Read CurrentMode attribute") @@ -112,15 +114,15 @@ class CommonCodes(Enum): logging.info("CurrentMode: %s" % (old_current_mode)) - self.print_step(7, "Send ChangeToMode command with NewMode set to %d" % (self.modefail)) + self.print_step(7, "Send ChangeToMode command with NewMode set to %d" % (self.mode_fail)) - ret = await self.send_change_to_mode_cmd(newMode=self.modefail) + ret = await self.send_change_to_mode_cmd(newMode=self.mode_fail) st = ret.status is_mfg_code = st in range(0x80, 0xC0) is_err_code = (st == CommonCodes.GENERIC_FAILURE.value) or ( st == CommonCodes.INVALID_IN_MODE.value) or (st in rvcRunCodes) or is_mfg_code asserts.assert_true( - is_err_code, "Changing to mode %d must fail due to the current state of the device" % (self.modefail)) + is_err_code, "Changing to mode %d must fail due to the current state of the device" % (self.mode_fail)) st_text_len = len(ret.statusText) asserts.assert_true(st_text_len in range(1, 65), "StatusText length (%d) must be between 1 and 64" % (st_text_len)) @@ -131,7 +133,7 @@ class CommonCodes(Enum): asserts.assert_true(current_mode == old_current_mode, "CurrentMode changed after failed ChangeToMode command!") - self.print_step(9, "Manually put the device in a state from which it will SUCCESSFULLY transition to mode %d" % (self.modeok)) + self.print_step(9, "Manually put the device in a state from which it will SUCCESSFULLY transition to mode %d" % (self.mode_ok)) input("Press Enter when done.\n") self.print_step(10, "Read CurrentMode attribute") @@ -139,18 +141,18 @@ class CommonCodes(Enum): logging.info("CurrentMode: %s" % (old_current_mode)) - self.print_step(11, "Send ChangeToMode command with NewMode set to %d" % (self.modeok)) + self.print_step(11, "Send ChangeToMode command with NewMode set to %d" % (self.mode_ok)) - ret = await self.send_change_to_mode_cmd(newMode=self.modeok) + ret = await self.send_change_to_mode_cmd(newMode=self.mode_ok) asserts.assert_true(ret.status == CommonCodes.SUCCESS.value, - "Changing to mode %d must succeed due to the current state of the device" % (self.modeok)) + "Changing to mode %d must succeed due to the current state of the device" % (self.mode_ok)) self.print_step(12, "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 == self.modeok, + asserts.assert_true(current_mode == self.mode_ok, "CurrentMode doesn't match the argument of the successful ChangeToMode command!") self.print_step(13, "Send ChangeToMode command with NewMode set to %d" % (invalid_mode)) @@ -164,7 +166,7 @@ class CommonCodes(Enum): logging.info("CurrentMode: %s" % (current_mode)) - asserts.assert_true(current_mode == self.modeok, "CurrentMode changed after failed ChangeToMode command!") + asserts.assert_true(current_mode == self.mode_ok, "CurrentMode changed after failed ChangeToMode command!") if __name__ == "__main__": diff --git a/src/python_testing/TC_RVCRUNM_2_2.py b/src/python_testing/TC_RVCRUNM_2_2.py new file mode 100644 index 00000000000000..d6d0ac8acb7b5d --- /dev/null +++ b/src/python_testing/TC_RVCRUNM_2_2.py @@ -0,0 +1,182 @@ +# +# Copyright (c) 2024 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 chip.clusters as Clusters +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 the test with +# --int-arg PIXIT.RVCRUNM.MODE_A: PIXIT.RVCRUNM.MODE_B: + + +def error_enum_to_text(error_enum): + try: + return f'{Clusters.RvcRunMode.Enums.ModeTag(error_enum).name} 0x{error_enum:02x}' + except AttributeError: + if error_enum == 0: + return "Success(0x00)" + elif error_enum == 0x1: + return "UnsupportedMode(0x01)" + elif error_enum == 0x2: + return "GenericFailure(0x02)" + elif error_enum == 0x3: + return "InvalidInMode(0x03)" + + raise AttributeError("Unknown Enum value") + + +class TC_RVCRUNM_2_2(MatterBaseTest): + + def __init__(self, *args): + super().__init__(*args) + self.endpoint = 0 + self.mode_a = 0 + self.mode_b = 0 + self.supported_run_modes = {} # these are the ModeOptionStructs + self.supported_run_modes_dut = [] + self.idle_mode_dut = 0 + + async def read_mod_attribute_expect_success(self, cluster, attribute): + return await self.read_single_attribute_check_success( + endpoint=self.endpoint, cluster=cluster, attribute=attribute) + + async def read_run_supported_modes(self) -> Clusters.Objects.RvcRunMode.Attributes.SupportedModes: + ret = await self.read_mod_attribute_expect_success( + Clusters.RvcRunMode, + Clusters.RvcRunMode.Attributes.SupportedModes) + return ret + + async def read_current_mode_with_check(self, expected_mode): + run_mode = await self.read_mod_attribute_expect_success( + Clusters.RvcRunMode, + Clusters.RvcRunMode.Attributes.CurrentMode) + asserts.assert_true(run_mode == expected_mode, + "Expected the current mode to be %i, got %i" % (expected_mode, run_mode)) + + async def send_change_to_mode_cmd(self, new_mode) -> Clusters.Objects.RvcRunMode.Commands.ChangeToModeResponse: + ret = await self.send_single_cmd(cmd=Clusters.Objects.RvcRunMode.Commands.ChangeToMode(newMode=new_mode), + endpoint=self.endpoint) + return ret + + async def send_change_to_mode_with_check(self, new_mode, expected_error): + response = await self.send_change_to_mode_cmd(new_mode) + asserts.assert_true(response.status == expected_error, + "Expected a ChangeToMode response status of %s, got %s" % + (error_enum_to_text(expected_error), error_enum_to_text(response.status))) + + # Prints the instruction and waits for a user input to continue + def print_instruction(self, step_number, instruction): + self.print_step(step_number, instruction) + input("Press Enter when done.\n") + + def pics_TC_RVCRUNM_2_2(self) -> list[str]: + return ["RVCRUNM.S"] + + @async_test_body + async def test_TC_RVCRUNM_2_2(self): + + if 'PIXIT.RVCRUNM.MODE_A' not in self.matter_test_config.global_test_params or \ + 'PIXIT.RVCRUNM.MODE_B' not in self.matter_test_config.global_test_params: + asserts.fail("There are missing arguments to the `--int-arg` flag! " + "Make sure that all of these arguments are given to this flag: \n" + "PIXIT.RVCRUNM.MODE_A: \n" + "PIXIT.RVCRUNM.MODE_B:") + + self.endpoint = self.matter_test_config.endpoint + self.mode_a = self.matter_test_config.global_test_params['PIXIT.RVCRUNM.MODE_A'] + self.mode_b = self.matter_test_config.global_test_params['PIXIT.RVCRUNM.MODE_B'] + + asserts.assert_true(self.check_pics("RVCRUNM.S"), "RVCRUNM.S must be supported") + # I think that the following PICS should be listed in the preconditions section in the test plan as if either + # of these PICS is not supported, this test would not be useful. + asserts.assert_true(self.check_pics("RVCRUNM.S.A0000"), "RVCRUNM.S.A0000 must be supported") + asserts.assert_true(self.check_pics("RVCRUNM.S.A0001"), "RVCRUNM.S.A0001 must be supported") + asserts.assert_true(self.check_pics("RVCRUNM.S.C00.Rsp"), "RVCRUNM.S.C00.Rsp must be supported") + asserts.assert_true(self.check_pics("RVCRUNM.S.M.CAN_MANUALLY_CONTROLLED"), + "RVCRUNM.S.M.CAN_MANUALLY_CONTROLLED must be supported") + + # Starting the test steps + self.print_step(1, "Commissioning, already done") + + self.print_instruction(2, "Manually put the device in a RVC Run Mode cluster mode with " + "the Idle(0x4000) mode tag and in a device state that allows changing to either " + "of these modes: %i, %i" % (self.mode_a, self.mode_b)) + + self.print_step(3, "Read the RvcRunMode SupportedModes attribute") + supported_run_modes = await self.read_run_supported_modes() + for mode in supported_run_modes: + self.supported_run_modes[mode.mode] = mode + # Save the Mode field values as supported_run_modes_dut + self.supported_run_modes_dut.append(mode.mode) + + asserts.assert_false(self.mode_a == self.mode_b, + "PIXIT.RVCRUNM.MODE_A must be different from PIXIT.RVCRUNM.MODE_B") + + if self.mode_a not in self.supported_run_modes_dut or \ + self.mode_b not in self.supported_run_modes_dut: + asserts.fail("PIXIT.RVCRUNM.MODE_A and PIXIT.RVCRUNM.MODE_B must be valid supported modes.") + + for tag in self.supported_run_modes[self.mode_a].modeTags: + if tag.value == Clusters.RvcRunMode.Enums.ModeTag.kIdle: + asserts.fail("The mode chosen for PIXIT.RVCRUNM.MODE_A must not have the Idle(0x4000) mode tag.") + + for tag in self.supported_run_modes[self.mode_b].modeTags: + if tag.value == Clusters.RvcRunMode.Enums.ModeTag.kIdle: + asserts.fail("The mode chosen for PIXIT.RVCRUNM.MODE_B must not have the Idle(0x4000) mode tag.") + + self.print_step(4, "Read the RvcRunMode CurrentMode attribute") + current_run_mode = await self.read_mod_attribute_expect_success( + Clusters.RvcRunMode, + Clusters.RvcRunMode.Attributes.CurrentMode) + + # Save the value as idle_mode_dut + self.idle_mode_dut = current_run_mode + + # Verify that the supported_run_modes_dut entry matching idle_mode_dut has the Idle (0x4000) mode tag. + idle_tag_present = False + for t in self.supported_run_modes[current_run_mode].modeTags: + if t.value == Clusters.RvcRunMode.Enums.ModeTag.kIdle: + idle_tag_present = True + asserts.assert_true(idle_tag_present, "The device must be in a mode with the Idle (0x4000) mode tag.") + + self.print_step(5, "Send ChangeToMode MODE_A command") + await self.send_change_to_mode_with_check(self.mode_a, 0) + # This step is not described in the test plan, but it ought to be + await self.read_current_mode_with_check(self.mode_a) + + self.print_step(6, "Send ChangeToMode MODE_B command") + await self.send_change_to_mode_with_check(self.mode_b, 3) + + self.print_step(7, "Send ChangeToMode idle command") + await self.send_change_to_mode_with_check(self.idle_mode_dut, 0) + # This step is not described in the test plan, but it ought to be + await self.read_current_mode_with_check(self.idle_mode_dut) + + self.print_step(8, "Send ChangeToMode MODE_B command") + await self.send_change_to_mode_with_check(self.mode_b, 0) + # This step is not described in the test plan, but it ought to be + await self.read_current_mode_with_check(self.mode_b) + + self.print_step(9, "Send ChangeToMode idle command") + await self.send_change_to_mode_with_check(self.idle_mode_dut, 0) + # This step is not described in the test plan, but it ought to be + await self.read_current_mode_with_check(self.idle_mode_dut) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 3ad4ef32b850de..c1b428dd930133 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -98155,75 +98155,47 @@ class Test_TC_RVCCLEANM_1_1 : public TestCommandBridge { break; case 2: ChipLogProgress(chipTool, " ***** Test Step 2 : Step 3: TH reads from the DUT the FeatureMap attribute.\n"); - if (ShouldSkip(" !RVCCLEANM.S.F00 ")) { - NextTest(); - return; - } err = TestStep3ThReadsFromTheDutTheFeatureMapAttribute_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Step 3: Given RVCCLEANM.S.F00(DEPONOFF) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("RVCCLEANM.S.F00")) { + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 4a: TH reads from the DUT the AttributeList attribute.\n"); + if (ShouldSkip("PICS_EVENT_LIST_ENABLED")) { NextTest(); return; } - err = TestStep3GivenRvccleanmsf00deponoffEnsureFeaturemapHasTheCorrectBitSet_3(); + err = TestStep4aThReadsFromTheDutTheAttributeListAttribute_3(); break; case 4: ChipLogProgress(chipTool, " ***** Test Step 4 : Step 4a: TH reads from the DUT the AttributeList attribute.\n"); - if (ShouldSkip("PICS_EVENT_LIST_ENABLED")) { + if (ShouldSkip("!PICS_EVENT_LIST_ENABLED")) { NextTest(); return; } err = TestStep4aThReadsFromTheDutTheAttributeListAttribute_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Step 4a: TH reads from the DUT the AttributeList attribute.\n"); - if (ShouldSkip("!PICS_EVENT_LIST_ENABLED")) { - NextTest(); - return; - } - err = TestStep4aThReadsFromTheDutTheAttributeListAttribute_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Step 4c: TH reads the Feature dependent(RVCCLEANM.S.F00 - DEPONOFF) and optional attribute(OnMode) is in AttributeList from the DUT\n"); - if (ShouldSkip("RVCCLEANM.S.F00")) { - NextTest(); - return; - } - err = TestStep4cThReadsTheFeatureDependentRVCCLEANMSF00DeponoffAndOptionalAttributeOnModeIsInAttributeListFromTheDut_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Step 4c: TH reads the Feature dependent(RVCCLEANM.S.F00 - DEPONOFF) and optional attribute(OnMode) is not in AttributeList from the DUT\n"); - if (ShouldSkip(" !RVCCLEANM.S.F00 ")) { - NextTest(); - return; - } - err = TestStep4cThReadsTheFeatureDependentRVCCLEANMSF00DeponoffAndOptionalAttributeOnModeIsNotInAttributeListFromTheDut_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Step 5: TH reads from the DUT the EventList attribute.\n"); + ChipLogProgress(chipTool, " ***** Test Step 5 : Step 5: TH reads from the DUT the EventList attribute.\n"); if (ShouldSkip("PICS_EVENT_LIST_ENABLED")) { NextTest(); return; } NextTest(); return; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Step 6: TH reads from the DUT the AcceptedCommandList attribute. Check if it contains id 0x0 (ChangeToMode)\n"); + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Step 6: TH reads from the DUT the AcceptedCommandList attribute. Check if it contains id 0x0 (ChangeToMode)\n"); if (ShouldSkip("RVCCLEANM.S.C00.Rsp")) { NextTest(); return; } - err = TestStep6ThReadsFromTheDutTheAcceptedCommandListAttributeCheckIfItContainsId0x0ChangeToMode_9(); + err = TestStep6ThReadsFromTheDutTheAcceptedCommandListAttributeCheckIfItContainsId0x0ChangeToMode_6(); break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Step 7: TH reads from the DUT the GeneratedCommandList attribute. Check if it contains id 0x1 (ChangeToModeResponse)\n"); + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Step 7: TH reads from the DUT the GeneratedCommandList attribute. Check if it contains id 0x1 (ChangeToModeResponse)\n"); if (ShouldSkip("RVCCLEANM.S.C01.Tx")) { NextTest(); return; } - err = TestStep7ThReadsFromTheDutTheGeneratedCommandListAttributeCheckIfItContainsId0x1ChangeToModeResponse_10(); + err = TestStep7ThReadsFromTheDutTheGeneratedCommandListAttributeCheckIfItContainsId0x1ChangeToModeResponse_7(); break; } @@ -98260,15 +98232,6 @@ class Test_TC_RVCCLEANM_1_1 : public TestCommandBridge { case 7: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; } // Go on to the next test. @@ -98279,7 +98242,7 @@ class Test_TC_RVCCLEANM_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 11; + const uint16_t mTestCount = 8; chip::Optional mNodeId; chip::Optional mCluster; @@ -98350,30 +98313,7 @@ class Test_TC_RVCCLEANM_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep3GivenRvccleanmsf00deponoffEnsureFeaturemapHasTheCorrectBitSet_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 3: Given RVCCLEANM.S.F00(DEPONOFF) ensure featuremap has the correct bit set: Error: %@", err); - } else { - NSLog(@"Step 3: Given RVCCLEANM.S.F00(DEPONOFF) ensure featuremap has the correct bit set: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep4aThReadsFromTheDutTheAttributeListAttribute_4() + CHIP_ERROR TestStep4aThReadsFromTheDutTheAttributeListAttribute_3() { MTRBaseDevice * device = GetDevice("alpha"); @@ -98405,7 +98345,7 @@ class Test_TC_RVCCLEANM_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep4aThReadsFromTheDutTheAttributeListAttribute_5() + CHIP_ERROR TestStep4aThReadsFromTheDutTheAttributeListAttribute_4() { MTRBaseDevice * device = GetDevice("alpha"); @@ -98436,57 +98376,7 @@ class Test_TC_RVCCLEANM_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep4cThReadsTheFeatureDependentRVCCLEANMSF00DeponoffAndOptionalAttributeOnModeIsInAttributeListFromTheDut_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 4c: TH reads the Feature dependent(RVCCLEANM.S.F00 - DEPONOFF) and optional attribute(OnMode) is in AttributeList from the DUT: Error: %@", err); - } else { - NSLog(@"Step 4c: TH reads the Feature dependent(RVCCLEANM.S.F00 - DEPONOFF) and optional attribute(OnMode) is in AttributeList from the DUT: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep4cThReadsTheFeatureDependentRVCCLEANMSF00DeponoffAndOptionalAttributeOnModeIsNotInAttributeListFromTheDut_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 4c: TH reads the Feature dependent(RVCCLEANM.S.F00 - DEPONOFF) and optional attribute(OnMode) is not in AttributeList from the DUT: Error: %@", err); - } else { - NSLog(@"Step 4c: TH reads the Feature dependent(RVCCLEANM.S.F00 - DEPONOFF) and optional attribute(OnMode) is not in AttributeList from the DUT: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep6ThReadsFromTheDutTheAcceptedCommandListAttributeCheckIfItContainsId0x0ChangeToMode_9() + CHIP_ERROR TestStep6ThReadsFromTheDutTheAcceptedCommandListAttributeCheckIfItContainsId0x0ChangeToMode_6() { MTRBaseDevice * device = GetDevice("alpha"); @@ -98515,7 +98405,7 @@ class Test_TC_RVCCLEANM_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep7ThReadsFromTheDutTheGeneratedCommandListAttributeCheckIfItContainsId0x1ChangeToModeResponse_10() + CHIP_ERROR TestStep7ThReadsFromTheDutTheGeneratedCommandListAttributeCheckIfItContainsId0x1ChangeToModeResponse_7() { MTRBaseDevice * device = GetDevice("alpha"); @@ -98594,76 +98484,48 @@ class Test_TC_RVCRUNM_1_1 : public TestCommandBridge { err = TestStep2ThReadsFromTheDutTheClusterRevisionAttribute_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Step 3a: TH reads from the DUT the FeatureMap attribute.\n"); - if (ShouldSkip(" !RVCRUNM.S.F00 ")) { - NextTest(); - return; - } - err = TestStep3aThReadsFromTheDutTheFeatureMapAttribute_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Step 3: TH reads from the DUT the FeatureMap attribute.\n"); + err = TestStep3ThReadsFromTheDutTheFeatureMapAttribute_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Step 3b: Given RVCRUNM.S.F00(DEPONOFF) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("RVCRUNM.S.F00")) { + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 4a: TH reads from the DUT the AttributeList attribute.\n"); + if (ShouldSkip("PICS_EVENT_LIST_ENABLED")) { NextTest(); return; } - err = TestStep3bGivenRvcrunmsf00deponoffEnsureFeaturemapHasTheCorrectBitSet_3(); + err = TestStep4aThReadsFromTheDutTheAttributeListAttribute_3(); break; case 4: ChipLogProgress(chipTool, " ***** Test Step 4 : Step 4a: TH reads from the DUT the AttributeList attribute.\n"); - if (ShouldSkip("PICS_EVENT_LIST_ENABLED")) { + if (ShouldSkip("!PICS_EVENT_LIST_ENABLED")) { NextTest(); return; } err = TestStep4aThReadsFromTheDutTheAttributeListAttribute_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Step 4a: TH reads from the DUT the AttributeList attribute.\n"); - if (ShouldSkip("!PICS_EVENT_LIST_ENABLED")) { - NextTest(); - return; - } - err = TestStep4aThReadsFromTheDutTheAttributeListAttribute_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Step 4c: TH reads the Feature dependent(RVCRUNM.S.F00 - DEPONOFF) and optional attribute(OnMode) is in AttributeList from the DUT\n"); - if (ShouldSkip("RVCRUNM.S.F00")) { - NextTest(); - return; - } - err = TestStep4cThReadsTheFeatureDependentRVCRUNMSF00DeponoffAndOptionalAttributeOnModeIsInAttributeListFromTheDut_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Step 4d: TH reads the Feature dependent(RVCRUNM.S.F00 - DEPONOFF) and optional attribute(OnMode) is not in AttributeList from the DUT\n"); - if (ShouldSkip(" !RVCRUNM.S.F00 ")) { - NextTest(); - return; - } - err = TestStep4dThReadsTheFeatureDependentRVCRUNMSF00DeponoffAndOptionalAttributeOnModeIsNotInAttributeListFromTheDut_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Step 5: TH reads from the DUT the EventList attribute.\n"); + ChipLogProgress(chipTool, " ***** Test Step 5 : Step 5: TH reads from the DUT the EventList attribute.\n"); if (ShouldSkip("PICS_EVENT_LIST_ENABLED")) { NextTest(); return; } NextTest(); return; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Step 6: TH reads from the DUT the AcceptedCommandList attribute. Check if it contains id 0x0 (ChangeToMode)\n"); + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Step 6: TH reads from the DUT the AcceptedCommandList attribute. Check if it contains id 0x0 (ChangeToMode)\n"); if (ShouldSkip("RVCRUNM.S.C00.Rsp")) { NextTest(); return; } - err = TestStep6ThReadsFromTheDutTheAcceptedCommandListAttributeCheckIfItContainsId0x0ChangeToMode_9(); + err = TestStep6ThReadsFromTheDutTheAcceptedCommandListAttributeCheckIfItContainsId0x0ChangeToMode_6(); break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Step 7: TH reads from the DUT the GeneratedCommandList attribute. Check if it contains id 0x1 (ChangeToModeResponse)\n"); + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Step 7: TH reads from the DUT the GeneratedCommandList attribute. Check if it contains id 0x1 (ChangeToModeResponse)\n"); if (ShouldSkip("RVCRUNM.S.C01.Tx")) { NextTest(); return; } - err = TestStep7ThReadsFromTheDutTheGeneratedCommandListAttributeCheckIfItContainsId0x1ChangeToModeResponse_10(); + err = TestStep7ThReadsFromTheDutTheGeneratedCommandListAttributeCheckIfItContainsId0x1ChangeToModeResponse_7(); break; } @@ -98700,15 +98562,6 @@ class Test_TC_RVCRUNM_1_1 : public TestCommandBridge { case 7: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; } // Go on to the next test. @@ -98719,7 +98572,7 @@ class Test_TC_RVCRUNM_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 11; + const uint16_t mTestCount = 8; chip::Optional mNodeId; chip::Optional mCluster; @@ -98762,7 +98615,7 @@ class Test_TC_RVCRUNM_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep3aThReadsFromTheDutTheFeatureMapAttribute_2() + CHIP_ERROR TestStep3ThReadsFromTheDutTheFeatureMapAttribute_2() { MTRBaseDevice * device = GetDevice("alpha"); @@ -98771,9 +98624,9 @@ class Test_TC_RVCRUNM_1_1 : public TestCommandBridge { [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { if (err != nil) { - NSLog(@"Step 3a: TH reads from the DUT the FeatureMap attribute.: Error: %@", err); + NSLog(@"Step 3: TH reads from the DUT the FeatureMap attribute.: Error: %@", err); } else { - NSLog(@"Step 3a: TH reads from the DUT the FeatureMap attribute.: Success"); + NSLog(@"Step 3: TH reads from the DUT the FeatureMap attribute.: Success"); } VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -98790,30 +98643,7 @@ class Test_TC_RVCRUNM_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep3bGivenRvcrunmsf00deponoffEnsureFeaturemapHasTheCorrectBitSet_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 3b: Given RVCRUNM.S.F00(DEPONOFF) ensure featuremap has the correct bit set: Error: %@", err); - } else { - NSLog(@"Step 3b: Given RVCRUNM.S.F00(DEPONOFF) ensure featuremap has the correct bit set: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep4aThReadsFromTheDutTheAttributeListAttribute_4() + CHIP_ERROR TestStep4aThReadsFromTheDutTheAttributeListAttribute_3() { MTRBaseDevice * device = GetDevice("alpha"); @@ -98845,7 +98675,7 @@ class Test_TC_RVCRUNM_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep4aThReadsFromTheDutTheAttributeListAttribute_5() + CHIP_ERROR TestStep4aThReadsFromTheDutTheAttributeListAttribute_4() { MTRBaseDevice * device = GetDevice("alpha"); @@ -98876,57 +98706,7 @@ class Test_TC_RVCRUNM_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep4cThReadsTheFeatureDependentRVCRUNMSF00DeponoffAndOptionalAttributeOnModeIsInAttributeListFromTheDut_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 4c: TH reads the Feature dependent(RVCRUNM.S.F00 - DEPONOFF) and optional attribute(OnMode) is in AttributeList from the DUT: Error: %@", err); - } else { - NSLog(@"Step 4c: TH reads the Feature dependent(RVCRUNM.S.F00 - DEPONOFF) and optional attribute(OnMode) is in AttributeList from the DUT: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep4dThReadsTheFeatureDependentRVCRUNMSF00DeponoffAndOptionalAttributeOnModeIsNotInAttributeListFromTheDut_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 4d: TH reads the Feature dependent(RVCRUNM.S.F00 - DEPONOFF) and optional attribute(OnMode) is not in AttributeList from the DUT: Error: %@", err); - } else { - NSLog(@"Step 4d: TH reads the Feature dependent(RVCRUNM.S.F00 - DEPONOFF) and optional attribute(OnMode) is not in AttributeList from the DUT: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep6ThReadsFromTheDutTheAcceptedCommandListAttributeCheckIfItContainsId0x0ChangeToMode_9() + CHIP_ERROR TestStep6ThReadsFromTheDutTheAcceptedCommandListAttributeCheckIfItContainsId0x0ChangeToMode_6() { MTRBaseDevice * device = GetDevice("alpha"); @@ -98955,7 +98735,7 @@ class Test_TC_RVCRUNM_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep7ThReadsFromTheDutTheGeneratedCommandListAttributeCheckIfItContainsId0x1ChangeToModeResponse_10() + CHIP_ERROR TestStep7ThReadsFromTheDutTheGeneratedCommandListAttributeCheckIfItContainsId0x1ChangeToModeResponse_7() { MTRBaseDevice * device = GetDevice("alpha");