From 4077530dc3c43d79a25907355c6b5f4e1a12e4b3 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Thu, 16 Feb 2023 18:07:05 +0100 Subject: [PATCH] [matter_yamltests] Add CommissionerCommands and DiscoveryCommands method definitions (#25110) * [matter_yamltests] Add CommissionerCommands methods definitions * [matter_yamltests] Add DiscoveryCommands methods definitions --- .../matter_yamltests/constraints.py | 2 +- .../clusters/commissioner_commands.py | 46 ++++++++++ .../clusters/discovery_commands.py | 84 +++++++++++++++++++ .../pseudo_clusters/pseudo_clusters.py | 4 + 4 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/commissioner_commands.py 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/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/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 58ff3bcb7f99f9..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 @@ -12,7 +12,9 @@ # 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.discovery_commands import DiscoveryCommands from .clusters.log_commands import LogCommands from .clusters.system_commands import SystemCommands from .pseudo_cluster import PseudoCluster @@ -46,7 +48,9 @@ def __get_command(self, request): def get_default_pseudo_clusters() -> PseudoClusters: clusters = [ + CommissionerCommands(), DelayCommands(), + DiscoveryCommands(), LogCommands(), SystemCommands() ]