From 0cf51be3deeeddb941dd645aa4fc0ddd18c82028 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Thu, 16 Feb 2023 12:40:20 +0100 Subject: [PATCH 1/2] [matter_yamltests] Add CommissionerCommands methods definitions --- .../clusters/commissioner_commands.py | 46 +++++++++++++++++++ .../pseudo_clusters/pseudo_clusters.py | 2 + 2 files changed, 48 insertions(+) create mode 100644 scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/commissioner_commands.py diff --git a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/commissioner_commands.py b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/commissioner_commands.py new file mode 100644 index 00000000000000..ae659c61e63c3b --- /dev/null +++ b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/commissioner_commands.py @@ -0,0 +1,46 @@ +# +# 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. + +from ..pseudo_cluster import PseudoCluster + +_DEFINITION = ''' + + + CommissionerCommands + 0xFFF1FD04 + + + + + + + + + + + + + + + + + + +''' + + +class CommissionerCommands(PseudoCluster): + name = 'CommissionerCommands' + definition = _DEFINITION diff --git a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/pseudo_clusters.py b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/pseudo_clusters.py index 58ff3bcb7f99f9..64110f05087a9e 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/pseudo_clusters.py +++ b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/pseudo_clusters.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from .clusters.commissioner_commands import CommissionerCommands from .clusters.delay_commands import DelayCommands from .clusters.log_commands import LogCommands from .clusters.system_commands import SystemCommands @@ -46,6 +47,7 @@ def __get_command(self, request): def get_default_pseudo_clusters() -> PseudoClusters: clusters = [ + CommissionerCommands(), DelayCommands(), LogCommands(), SystemCommands() From fd8583fe66da5072f7d4ffd0164c4a20d1e31fea Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Thu, 16 Feb 2023 12:57:40 +0100 Subject: [PATCH 2/2] [matter_yamltests] Add DiscoveryCommands methods definitions --- .../matter_yamltests/constraints.py | 2 +- .../clusters/discovery_commands.py | 84 +++++++++++++++++++ .../pseudo_clusters/pseudo_clusters.py | 2 + 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/discovery_commands.py diff --git a/scripts/py_matter_yamltests/matter_yamltests/constraints.py b/scripts/py_matter_yamltests/matter_yamltests/constraints.py index b186fb1bef6282..96c2494a0f20c7 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/constraints.py +++ b/scripts/py_matter_yamltests/matter_yamltests/constraints.py @@ -87,7 +87,7 @@ def check_response(self, value, value_type_name) -> bool: success = True elif self._type == 'vendor_id' and type(value) is int: success = value >= 0 and value <= 0xFFFF - elif self._type == 'device_type_id' and type(value) is int: + elif self._type == 'devtype_id' and type(value) is int: success = value >= 0 and value <= 0xFFFFFFFF elif self._type == 'cluster_id' and type(value) is int: success = value >= 0 and value <= 0xFFFFFFFF diff --git a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/discovery_commands.py b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/discovery_commands.py new file mode 100644 index 00000000000000..af4aaf8aa1f79a --- /dev/null +++ b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/discovery_commands.py @@ -0,0 +1,84 @@ +# +# 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. + +from ..pseudo_cluster import PseudoCluster + +_DEFINITION = ''' + + + DiscoveryCommands + 0xFFF1FD05 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +''' + + +class DiscoveryCommands(PseudoCluster): + name = 'DiscoveryCommands' + definition = _DEFINITION diff --git a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/pseudo_clusters.py b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/pseudo_clusters.py index 64110f05087a9e..9255969fe9add0 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/pseudo_clusters.py +++ b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/pseudo_clusters.py @@ -14,6 +14,7 @@ from .clusters.commissioner_commands import CommissionerCommands from .clusters.delay_commands import DelayCommands +from .clusters.discovery_commands import DiscoveryCommands from .clusters.log_commands import LogCommands from .clusters.system_commands import SystemCommands from .pseudo_cluster import PseudoCluster @@ -49,6 +50,7 @@ def get_default_pseudo_clusters() -> PseudoClusters: clusters = [ CommissionerCommands(), DelayCommands(), + DiscoveryCommands(), LogCommands(), SystemCommands() ]