From 7a4eeccae2928eee8b35a7f259b5225d403233f2 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Mon, 23 Jan 2023 17:45:36 +0100 Subject: [PATCH] [matter_yamltests] Add groupId keyword support to the parser (#24583) * [matter_yamltests] Add groupId keyword support to the parser * Update tests generated content --- .../matter_yamltests/parser.py | 6 ++++ .../suites/TestGroupKeyManagementCluster.yaml | 8 ++--- .../chip-tool/zap-generated/test/Commands.h | 32 +++++++++++++++++++ .../zap-generated/test/Commands.h | 28 ++++++++++++++++ 4 files changed, 70 insertions(+), 4 deletions(-) diff --git a/scripts/py_matter_yamltests/matter_yamltests/parser.py b/scripts/py_matter_yamltests/matter_yamltests/parser.py index 5307d9daffd58b..0a4bc23e104766 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/parser.py +++ b/scripts/py_matter_yamltests/matter_yamltests/parser.py @@ -38,6 +38,7 @@ 'endpoint', 'identity', 'fabricFiltered', + 'groupId', 'verification', 'nodeId', 'attribute', @@ -198,6 +199,7 @@ def __init__(self, test: dict, config: dict, definitions: SpecDefinitions, pics_ self.label = _value_or_none(test, 'label') self.optional = _value_or_none(test, 'optional') self.node_id = _value_or_config(test, 'nodeId', config) + self.group_id = _value_or_config(test, 'groupId', config) self.cluster = _value_or_config(test, 'cluster', config) self.command = _value_or_config(test, 'command', config) self.attribute = _value_or_none(test, 'attribute') @@ -426,6 +428,10 @@ def optional(self): def node_id(self): return self._test.node_id + @property + def group_id(self): + return self._test.group_id + @property def cluster(self): return self._test.cluster diff --git a/src/app/tests/suites/TestGroupKeyManagementCluster.yaml b/src/app/tests/suites/TestGroupKeyManagementCluster.yaml index dbd728018f77aa..e6759dec28845e 100644 --- a/src/app/tests/suites/TestGroupKeyManagementCluster.yaml +++ b/src/app/tests/suites/TestGroupKeyManagementCluster.yaml @@ -242,13 +242,13 @@ tests: { FabricIndex: 1, GroupId: 0x0103, - endpoints: [1], + Endpoints: [1], GroupName: "Group #3", }, { FabricIndex: 1, GroupId: 0x0104, - endpoints: [1], + Endpoints: [1], GroupName: "Group #4", }, ] @@ -320,13 +320,13 @@ tests: { FabricIndex: 1, GroupId: 0x0103, - endpoints: [1], + Endpoints: [1], GroupName: "Group #3", }, { FabricIndex: 1, GroupId: 0x0104, - endpoints: [1], + Endpoints: [1], GroupName: "Group #4", }, ] diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index e4bc58cac8faff..717e41133222cf 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -86269,12 +86269,28 @@ class TestGroupKeyManagementClusterSuite : public TestCommand VerifyOrReturn(CheckValue("groupTable[1].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); VerifyOrReturn(CheckNextListItemDecodes("groupTable", iter_0, 2)); VerifyOrReturn(CheckValue("groupTable[2].groupId", iter_0.GetValue().groupId, 259U)); + { + auto iter_2 = iter_0.GetValue().endpoints.begin(); + VerifyOrReturn( + CheckNextListItemDecodes("groupTable[2].endpoints", iter_2, 0)); + VerifyOrReturn(CheckValue("groupTable[2].endpoints[0]", iter_2.GetValue(), 1U)); + VerifyOrReturn( + CheckNoMoreListItems("groupTable[2].endpoints", iter_2, 1)); + } VerifyOrReturn(CheckValuePresent("groupTable[2].groupName", iter_0.GetValue().groupName)); VerifyOrReturn(CheckValueAsString("groupTable[2].groupName.Value()", iter_0.GetValue().groupName.Value(), chip::CharSpan("Group #3", 8))); VerifyOrReturn(CheckValue("groupTable[2].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); VerifyOrReturn(CheckNextListItemDecodes("groupTable", iter_0, 3)); VerifyOrReturn(CheckValue("groupTable[3].groupId", iter_0.GetValue().groupId, 260U)); + { + auto iter_2 = iter_0.GetValue().endpoints.begin(); + VerifyOrReturn( + CheckNextListItemDecodes("groupTable[3].endpoints", iter_2, 0)); + VerifyOrReturn(CheckValue("groupTable[3].endpoints[0]", iter_2.GetValue(), 1U)); + VerifyOrReturn( + CheckNoMoreListItems("groupTable[3].endpoints", iter_2, 1)); + } VerifyOrReturn(CheckValuePresent("groupTable[3].groupName", iter_0.GetValue().groupName)); VerifyOrReturn(CheckValueAsString("groupTable[3].groupName.Value()", iter_0.GetValue().groupName.Value(), chip::CharSpan("Group #4", 8))); @@ -86344,12 +86360,28 @@ class TestGroupKeyManagementClusterSuite : public TestCommand VerifyOrReturn(CheckValue("groupTable[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); VerifyOrReturn(CheckNextListItemDecodes("groupTable", iter_0, 1)); VerifyOrReturn(CheckValue("groupTable[1].groupId", iter_0.GetValue().groupId, 259U)); + { + auto iter_2 = iter_0.GetValue().endpoints.begin(); + VerifyOrReturn( + CheckNextListItemDecodes("groupTable[1].endpoints", iter_2, 0)); + VerifyOrReturn(CheckValue("groupTable[1].endpoints[0]", iter_2.GetValue(), 1U)); + VerifyOrReturn( + CheckNoMoreListItems("groupTable[1].endpoints", iter_2, 1)); + } VerifyOrReturn(CheckValuePresent("groupTable[1].groupName", iter_0.GetValue().groupName)); VerifyOrReturn(CheckValueAsString("groupTable[1].groupName.Value()", iter_0.GetValue().groupName.Value(), chip::CharSpan("Group #3", 8))); VerifyOrReturn(CheckValue("groupTable[1].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); VerifyOrReturn(CheckNextListItemDecodes("groupTable", iter_0, 2)); VerifyOrReturn(CheckValue("groupTable[2].groupId", iter_0.GetValue().groupId, 260U)); + { + auto iter_2 = iter_0.GetValue().endpoints.begin(); + VerifyOrReturn( + CheckNextListItemDecodes("groupTable[2].endpoints", iter_2, 0)); + VerifyOrReturn(CheckValue("groupTable[2].endpoints[0]", iter_2.GetValue(), 1U)); + VerifyOrReturn( + CheckNoMoreListItems("groupTable[2].endpoints", iter_2, 1)); + } VerifyOrReturn(CheckValuePresent("groupTable[2].groupName", iter_0.GetValue().groupName)); VerifyOrReturn(CheckValueAsString("groupTable[2].groupName.Value()", iter_0.GetValue().groupName.Value(), chip::CharSpan("Group #4", 8))); 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 636757b9a45c6b..fc64a87691276d 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -133251,6 +133251,13 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { 1U)); VerifyOrReturn(CheckValue("GroupId", ((MTRGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[2]).groupId, 259U)); + VerifyOrReturn(CheckValue("Endpoints", + [((MTRGroupKeyManagementClusterGroupInfoMapStruct *) + actualValue[2]).endpoints count], + static_cast(1))); + VerifyOrReturn(CheckValue("", + ((MTRGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[2]).endpoints[0], + 1U)); VerifyOrReturn(CheckValueAsString("GroupName", ((MTRGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[2]).groupName, @"Group #3")); @@ -133259,6 +133266,13 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { 1U)); VerifyOrReturn(CheckValue("GroupId", ((MTRGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[3]).groupId, 260U)); + VerifyOrReturn(CheckValue("Endpoints", + [((MTRGroupKeyManagementClusterGroupInfoMapStruct *) + actualValue[3]).endpoints count], + static_cast(1))); + VerifyOrReturn(CheckValue("", + ((MTRGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[3]).endpoints[0], + 1U)); VerifyOrReturn(CheckValueAsString("GroupName", ((MTRGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[3]).groupName, @"Group #4")); @@ -133448,6 +133462,13 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { 1U)); VerifyOrReturn(CheckValue("GroupId", ((MTRGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[1]).groupId, 259U)); + VerifyOrReturn(CheckValue("Endpoints", + [((MTRGroupKeyManagementClusterGroupInfoMapStruct *) + actualValue[1]).endpoints count], + static_cast(1))); + VerifyOrReturn(CheckValue("", + ((MTRGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[1]).endpoints[0], + 1U)); VerifyOrReturn(CheckValueAsString("GroupName", ((MTRGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[1]).groupName, @"Group #3")); @@ -133456,6 +133477,13 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { 1U)); VerifyOrReturn(CheckValue("GroupId", ((MTRGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[2]).groupId, 260U)); + VerifyOrReturn(CheckValue("Endpoints", + [((MTRGroupKeyManagementClusterGroupInfoMapStruct *) + actualValue[2]).endpoints count], + static_cast(1))); + VerifyOrReturn(CheckValue("", + ((MTRGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[2]).endpoints[0], + 1U)); VerifyOrReturn(CheckValueAsString("GroupName", ((MTRGroupKeyManagementClusterGroupInfoMapStruct *) actualValue[2]).groupName, @"Group #4"));