Skip to content

Commit

Permalink
Group Key Management cluster XML: YAML tests enabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
rcasallas-silabs committed Feb 4, 2022
1 parent 4cef16b commit cf41a90
Show file tree
Hide file tree
Showing 46 changed files with 8,599 additions and 60,391 deletions.
16 changes: 7 additions & 9 deletions src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@ bool emberAfGroupKeyManagementClusterKeySetWriteCallback(
keyset.num_keys_used++;

// Epoch Key 1
if (!commandData.groupKeySet.epochKey1.IsNull() && !commandData.groupKeySet.epochStartTime1.IsNull() &&
!commandData.groupKeySet.epochKey1.Value().empty())
if (!commandData.groupKeySet.epochKey1.IsNull())
{
if (commandData.groupKeySet.epochStartTime1.Value() <= commandData.groupKeySet.epochStartTime0.Value())
if (commandData.groupKeySet.epochStartTime1.IsNull() ||
commandData.groupKeySet.epochStartTime1.Value() <= commandData.groupKeySet.epochStartTime0.Value())
{
// If the EpochKey1 field is not null, its associated EpochStartTime1 field SHALL contain
// a later epoch start time than the epoch start time found in the EpochStartTime0 field.
Expand All @@ -301,11 +301,10 @@ bool emberAfGroupKeyManagementClusterKeySetWriteCallback(
}

// Epoch Key 2
if (!commandData.groupKeySet.epochKey2.IsNull() && !commandData.groupKeySet.epochStartTime2.IsNull() &&
!commandData.groupKeySet.epochKey2.Value().empty())
if (!commandData.groupKeySet.epochKey2.IsNull())
{
keyset.num_keys_used++;
if (commandData.groupKeySet.epochStartTime2.Value() <= commandData.groupKeySet.epochStartTime1.Value())
if (commandData.groupKeySet.epochKey1.IsNull() || commandData.groupKeySet.epochStartTime2.IsNull() ||
commandData.groupKeySet.epochStartTime2.Value() <= commandData.groupKeySet.epochStartTime1.Value())
{
// If the EpochKey2 field is not null then:
// * The EpochKey1 field SHALL NOT be null
Expand Down Expand Up @@ -362,8 +361,7 @@ bool emberAfGroupKeyManagementClusterKeySetReadCallback(
return true;
}

// In KeySetReadResponse EpochKey0, EpochKey1 and EpochKey2 fields shall be null.

// In KeySetReadResponse, EpochKey0, EpochKey1 and EpochKey2 key contents shall be null
GroupKeyManagement::Commands::KeySetReadResponse::Type response;
response.groupKeySet.groupKeySetID = keyset.keyset_id;
response.groupKeySet.groupKeySecurityPolicy = keyset.policy;
Expand Down
230 changes: 140 additions & 90 deletions src/app/tests/suites/TestGroupKeyManagementCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,146 +37,196 @@ tests:
value: 2

- label: "Add Group 1"
disabled: true
cluster: "Groups"
endpoint: 1
command: "AddGroup"
arguments:
values:
- name: "groupId"
value: 11
- name: "groupName"
- name: "GroupId"
value: 0x0011
- name: "GroupName"
value: "Group #1"
response:
values:
- name: "status"
value: 0
- name: "groupId"
value: 11
- name: "GroupId"
value: 0x0011

- label: "Add Group 2"
disabled: true
cluster: "Groups"
endpoint: 1
command: "AddGroup"
arguments:
values:
- name: "groupId"
value: 12
- name: "groupName"
- name: "GroupId"
value: 0x0012
- name: "GroupName"
value: "Group #2"
response:
values:
- name: "status"
value: 0
- name: "groupId"
value: 12
- name: "GroupId"
value: 0x0012

- label: "KeySetWrite 1"
disabled: true
- label: "KeySet Write 1"
command: "KeySetWrite"
arguments:
values:
- name: "groupKeySet"
- name: "GroupKeySet"
value:
{
groupKeySetID: 101,
securityPolicy: 0,
epochKey0:
[
0xa0,
0xa1,
0xa2,
0xa3,
0xa4,
0xa5,
0xa6,
0xa7,
0xa8,
0xa9,
0xaa,
0xab,
0xac,
0xad,
0xae,
0xaf,
],
epochStartTime0: 1110000,
epochKey1:
[
0xb0,
0xb1,
0xb2,
0xb3,
0xb4,
0xb5,
0xb6,
0xb7,
0xb8,
0xb9,
0xba,
0xbb,
0xbc,
0xbd,
0xbe,
0xbf,
],
epochStartTime1: 1110001,
epochKey2:
[
0xc0,
0xc1,
0xc2,
0xc3,
0xc4,
0xc5,
0xc6,
0xc7,
0xc8,
0xc9,
0xca,
0xcb,
0xcc,
0xcd,
0xce,
0xcf,
],
epochStartTime2: 1110002,
GroupKeySetID: 0x0101,
GroupKeySecurityPolicy: 0,
EpochKey0: "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf",
EpochStartTime0: 1110000,
EpochKey1: "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf",
EpochStartTime1: 1110001,
EpochKey2: "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf",
EpochStartTime2: 1110002,
}

- label: "Write Group Keys"
- label: "KeySet Write 2"
command: "KeySetWrite"
arguments:
values:
- name: "GroupKeySet"
value:
{
GroupKeySetID: 0x0102,
GroupKeySecurityPolicy: 1,
EpochKey0: "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf",
EpochStartTime0: 2110000,
EpochKey1: "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef",
EpochStartTime1: 2110001,
EpochKey2: "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
EpochStartTime2: 2110002,
}

- label: "KeySet Read"
command: "KeySetRead"
arguments:
values:
- name: "GroupKeySetID"
value: 0x0101
response:
values:
- name: "GroupKeySet"
value:
{
GroupKeySetID: 0x0101,
GroupKeySecurityPolicy: 0,
EpochKey0: null,
EpochStartTime0: 1110000,
EpochKey1: null,
EpochStartTime1: 1110001,
EpochKey2: null,
EpochStartTime2: 1110002,
}

- label: "KeySet Read All Indicers"
disabled: true
command: "KeySetReadAllIndices"
response:
values:
- name: "GroupKeySetIDs"
value: [0x0101, 0x0102]

- label: "Write Group Keys"
command: "writeAttribute"
attribute: "groupKeyMap"
attribute: "GroupKeyMap"
arguments:
value:
[
{ fabricIndex: 1, groupId: 11, groupKeySetID: 101 },
{ fabricIndex: 1, groupId: 12, groupKeySetID: 102 },
{ FabricIndex: 1, GroupId: 0x0011, GroupKeySetID: 0x0101 },
{ FabricIndex: 1, GroupId: 0x0012, GroupKeySetID: 0x0102 },
]

- label: "Read Group Keys"
disabled: true
command: "readAttribute"
attribute: "groupKeyMap"
attribute: "GroupKeyMap"
response:
value:
[
{ fabricIndex: 1, groupId: 11, groupKeySetID: 101 },
{ fabricIndex: 1, groupId: 12, groupKeySetID: 102 },
{ FabricIndex: 1, GroupId: 0x0011, GroupKeySetID: 0x0101 },
{ FabricIndex: 1, GroupId: 0x0012, GroupKeySetID: 0x0102 },
]

- label: "Read GroupTable"
disabled: true
command: "readAttribute"
attribute: "groupTable"
attribute: "GroupTable"
response:
value:
[
{
fabricIndex: 1,
groupId: 11,
FabricIndex: 1,
GroupId: 0x0011,
endpoints: [1],
groupName: "Group #1",
GroupName: "Group #1",
},
{
FabricIndex: 1,
GroupId: 0x0012,
endpoints: [1],
GroupName: "Group #2",
},
]

- label: "KeySet Remove 1"
command: "KeySetRemove"
arguments:
values:
- name: "GroupKeySetID"
value: 0x0101

- label: "KeySet Read (removed)"
command: "KeySetRead"
arguments:
values:
- name: "GroupKeySetID"
value: 0x0101
response:
error: NOT_FOUND

- label: "KeySet Read (not removed)"
command: "KeySetRead"
arguments:
values:
- name: "GroupKeySetID"
value: 0x0102
response:
values:
- name: "GroupKeySet"
value:
{
GroupKeySetID: 0x0102,
GroupKeySecurityPolicy: 1,
EpochKey0: null,
EpochStartTime0: 2110000,
EpochKey1: null,
EpochStartTime1: 2110001,
EpochKey2: null,
EpochStartTime2: 2110002,
}

- label: "Remove All"
cluster: "Groups"
endpoint: 1
command: "RemoveAllGroups"

- label: "KeySet Remove 2"
command: "KeySetRemove"
arguments:
values:
- name: "GroupKeySetID"
value: 0x0102

- label: "KeySet Read (also removed)"
command: "KeySetRead"
arguments:
values:
- name: "GroupKeySetID"
value: 0x0102
response:
error: NOT_FOUND
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ limitations under the License.
</command>

<command source="client" code="0x04" name="KeySetReadAllIndices" response="KeySetReadAllIndicesResponse" optional="false" cli="zcl GroupKeyManagement KeySetReadAllIndices">
<description>Revoke a Root Key from a Group</description>
<description>Return the list of Group Key Sets associated with the accessing fabric</description>
<arg name="GroupKeySetIDs" type="INT16U" array="true"/>
</command>

Expand Down
18 changes: 12 additions & 6 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1842,6 +1842,8 @@ client cluster GroupKeyManagement = 63 {
readonly attribute GroupInfoMapStruct groupTable[] = 1;
readonly attribute int16u maxGroupsPerFabric = 2;
readonly attribute int16u maxGroupKeysPerFabric = 3;
readonly global attribute command_id serverGeneratedCommandList[] = 65528;
readonly global attribute command_id clientGeneratedCommandList[] = 65529;
readonly global attribute attrib_id attributeList[] = 65531;
readonly global attribute int16u clusterRevision = 65533;

Expand Down Expand Up @@ -2209,7 +2211,9 @@ client cluster LevelControl = 8 {
client cluster LocalizationConfiguration = 43 {
attribute char_string<35> activeLocale = 1;
readonly attribute CHAR_STRING supportedLocales[] = 2;
readonly global nosubscribe attribute int16u clusterRevision = 65533;
readonly global attribute command_id serverGeneratedCommandList[] = 65528;
readonly global attribute command_id clientGeneratedCommandList[] = 65529;
readonly global attribute int16u clusterRevision = 65533;
}

client cluster LowPower = 1288 {
Expand Down Expand Up @@ -2712,7 +2716,7 @@ client cluster OperationalCredentials = 62 {
CHAR_STRING<32> label = 5;
}

readonly nosubscribe attribute NOCStruct NOCs[] = 0;
readonly attribute NOCStruct NOCs[] = 0;
readonly attribute FabricDescriptor fabricsList[] = 1;
readonly attribute int8u supportedFabrics = 2;
readonly attribute int8u commissionedFabrics = 3;
Expand Down Expand Up @@ -3781,10 +3785,12 @@ client cluster TimeFormatLocalization = 44 {
k24hr = 1;
}

nosubscribe attribute HourFormat hourFormat = 0;
nosubscribe attribute CalendarType activeCalendarType = 1;
readonly nosubscribe attribute CalendarType supportedCalendarTypes[] = 2;
readonly global nosubscribe attribute int16u clusterRevision = 65533;
attribute HourFormat hourFormat = 0;
attribute CalendarType activeCalendarType = 1;
readonly attribute CalendarType supportedCalendarTypes[] = 2;
readonly global attribute command_id serverGeneratedCommandList[] = 65528;
readonly global attribute command_id clientGeneratedCommandList[] = 65529;
readonly global attribute int16u clusterRevision = 65533;
}

client cluster UnitLocalization = 45 {
Expand Down
Loading

0 comments on commit cf41a90

Please sign in to comment.