|
| 1 | +# |
| 2 | +# Copyright (c) 2024 Project CHIP Authors |
| 3 | +# All rights reserved. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# |
| 17 | + |
| 18 | +import chip.clusters as Clusters |
| 19 | +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main |
| 20 | +from mobly import asserts |
| 21 | + |
| 22 | + |
| 23 | +class TC_DGGEN_3_2(MatterBaseTest): |
| 24 | + def steps_TC_DGGEN_3_2(self): |
| 25 | + return [TestStep(0, "Commission DUT (already done)", is_commissioning=True), |
| 26 | + TestStep(1, "TH reads the MaxPathsPerInvoke attribute from the Basic Information Cluster from DUT. Save the value as `max_paths_per_invoke", |
| 27 | + "Read is successful"), |
| 28 | + TestStep(2, "TH reads FeatureMap attribute from the General Diagnostics Cluster from DUT", |
| 29 | + "Verify that the FeatureMap value has the DMTEST feature bit (0) set to 1 if `max_path_per_invoke` > 1") |
| 30 | + ] |
| 31 | + |
| 32 | + @async_test_body |
| 33 | + async def test_TC_DGGEN_3_2(self): |
| 34 | + # commissioning - already done |
| 35 | + self.step(0) |
| 36 | + |
| 37 | + self.step(1) |
| 38 | + max_paths_per_invoke = await self.read_single_attribute_check_success(cluster=Clusters.BasicInformation, attribute=Clusters.BasicInformation.Attributes.MaxPathsPerInvoke) |
| 39 | + |
| 40 | + self.step(2) |
| 41 | + feature_map = await self.read_single_attribute_check_success(cluster=Clusters.GeneralDiagnostics, attribute=Clusters.GeneralDiagnostics.Attributes.FeatureMap) |
| 42 | + if max_paths_per_invoke > 1: |
| 43 | + asserts.assert_true(feature_map & Clusters.GeneralDiagnostics.Bitmaps.Feature.kDataModelTest, |
| 44 | + "DMTEST feature must be set if MaxPathsPerInvoke > 1") |
| 45 | + |
| 46 | + |
| 47 | +if __name__ == "__main__": |
| 48 | + default_matter_test_main() |
0 commit comments