Skip to content

Commit

Permalink
[Group] Update group demo to include encryption configuration (#14862)
Browse files Browse the repository at this point in the history
* enable group key management cluster

* update demo  yaml tests

* Generated files

* add key mgmt server to esp cmakelist

* PR comments for external/RAM storage

* label comment update

Co-authored-by: Tennessee Carmel-Veilleux <[email protected]>

* generated files

Co-authored-by: Tennessee Carmel-Veilleux <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Feb 20, 2024
1 parent 76f9127 commit 6d5c3ef
Show file tree
Hide file tree
Showing 11 changed files with 498 additions and 48 deletions.
1 change: 1 addition & 0 deletions examples/lighting-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ idf_component_register(PRIV_INCLUDE_DIRS
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-requestor"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/groups-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server"
PRIV_REQUIRES chip QRCode bt led_strip app_update)

set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17)
Expand Down
67 changes: 67 additions & 0 deletions examples/lighting-app/lighting-common/lighting-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,72 @@ server cluster GeneralDiagnostics = 51 {
readonly global attribute int16u clusterRevision = 65533;
}

server cluster GroupKeyManagement = 63 {
enum GroupKeySecurityPolicy : ENUM8 {
kStandard = 0;
kLowLatency = 1;
}

struct GroupKeyMapStruct {
fabric_idx fabricIndex = 0;
group_id groupId = 1;
INT16U groupKeySetID = 2;
}

struct GroupInfoMapStruct {
fabric_idx fabricIndex = 0;
group_id groupId = 1;
endpoint_no endpoints[] = 2;
optional CHAR_STRING<16> groupName = 3;
}

struct GroupKeySetStruct {
INT16U groupKeySetID = 0;
GroupKeySecurityPolicy groupKeySecurityPolicy = 1;
nullable OCTET_STRING<16> epochKey0 = 2;
nullable epoch_us epochStartTime0 = 3;
nullable OCTET_STRING<16> epochKey1 = 4;
nullable epoch_us epochStartTime1 = 5;
nullable OCTET_STRING<16> epochKey2 = 6;
nullable epoch_us epochStartTime2 = 7;
}

attribute GroupKeyMapStruct groupKeyMap[] = 0;
readonly attribute GroupInfoMapStruct groupTable[] = 1;
readonly attribute int16u maxGroupsPerFabric = 2;
readonly attribute int16u maxGroupKeysPerFabric = 3;
readonly global attribute int16u clusterRevision = 65533;

request struct KeySetReadRequest {
INT16U groupKeySetID = 0;
}

request struct KeySetReadAllIndicesRequest {
INT16U groupKeySetIDs[] = 0;
}

request struct KeySetRemoveRequest {
INT16U groupKeySetID = 0;
}

request struct KeySetWriteRequest {
GroupKeySetStruct groupKeySet = 0;
}

response struct KeySetReadAllIndicesResponse {
INT16U groupKeySetIDs[] = 0;
}

response struct KeySetReadResponse {
GroupKeySetStruct groupKeySet = 0;
}

command KeySetRead(KeySetReadRequest): KeySetReadResponse = 1;
command KeySetReadAllIndices(KeySetReadAllIndicesRequest): KeySetReadAllIndicesResponse = 4;
command KeySetRemove(KeySetRemoveRequest): DefaultSuccess = 3;
command KeySetWrite(KeySetWriteRequest): DefaultSuccess = 0;
}

server cluster Groups = 4 {
readonly attribute bitmap8 nameSupport = 0;
readonly global attribute int16u clusterRevision = 65533;
Expand Down Expand Up @@ -1602,6 +1668,7 @@ endpoint 0 {
server cluster FixedLabel;
server cluster GeneralCommissioning;
server cluster GeneralDiagnostics;
server cluster GroupKeyManagement;
server cluster Groups;
server cluster LocalizationConfiguration;
server cluster NetworkCommissioning;
Expand Down
146 changes: 146 additions & 0 deletions examples/lighting-app/lighting-common/lighting-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -4509,6 +4509,152 @@
}
]
},
{
"name": "Group Key Management",
"code": 63,
"mfgCode": null,
"define": "GROUP_KEY_MANAGEMENT_CLUSTER",
"side": "client",
"enabled": 0,
"commands": [
{
"name": "KeySetWrite",
"code": 0,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 0
},
{
"name": "KeySetRead",
"code": 1,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 0
},
{
"name": "KeySetRemove",
"code": 3,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 0
},
{
"name": "KeySetReadAllIndices",
"code": 4,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 0
}
],
"attributes": []
},
{
"name": "Group Key Management",
"code": 63,
"mfgCode": null,
"define": "GROUP_KEY_MANAGEMENT_CLUSTER",
"side": "server",
"enabled": 1,
"commands": [
{
"name": "KeySetReadResponse",
"code": 2,
"mfgCode": null,
"source": "server",
"incoming": 0,
"outgoing": 1
},
{
"name": "KeySetReadAllIndicesResponse",
"code": 5,
"mfgCode": null,
"source": "server",
"incoming": 0,
"outgoing": 1
}
],
"attributes": [
{
"name": "groupKeyMap",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "groupTable",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "maxGroupsPerFabric",
"code": 2,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "maxGroupKeysPerFabric",
"code": 3,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ClusterRevision",
"code": 65533,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "1",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
}
]
},
{
"name": "Fixed Label",
"code": 64,
Expand Down
20 changes: 10 additions & 10 deletions src/app/tests/suites/TestGroupDemoCommand.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ tests:
- label: "Turn On the light to see attribute change"
cluster: "On/Off"
command: "On"
groupId: "4660"
groupId: 0x0101

- label: "Wait 100ms"
cluster: "DelayCommands"
Expand All @@ -52,7 +52,7 @@ tests:
- label: "Turn Off the light to see attribute change"
cluster: "On/Off"
command: "Off"
groupId: "4660"
groupId: 0x0101

- label: "Wait 100ms"
cluster: "DelayCommands"
Expand All @@ -66,7 +66,7 @@ tests:
- label: "Turn On the light to see attribute change"
cluster: "On/Off"
command: "On"
groupId: "4660"
groupId: 0x0101

- label: "Wait 100ms"
cluster: "DelayCommands"
Expand All @@ -79,7 +79,7 @@ tests:
- label: "Turn Off the light to see attribute change"
cluster: "On/Off"
command: "Off"
groupId: "4660"
groupId: 0x0101

- label: "Wait 100ms"
cluster: "DelayCommands"
Expand All @@ -93,7 +93,7 @@ tests:
- label: "Turn On the light to see attribute change"
cluster: "On/Off"
command: "On"
groupId: "4660"
groupId: 0x0101

- label: "Wait 100ms"
cluster: "DelayCommands"
Expand All @@ -106,7 +106,7 @@ tests:
- label: "Turn Off the light to see attribute change"
cluster: "On/Off"
command: "Off"
groupId: "4660"
groupId: 0x0101

- label: "Wait 100ms"
cluster: "DelayCommands"
Expand All @@ -120,7 +120,7 @@ tests:
- label: "Turn On the light to see attribute change"
cluster: "On/Off"
command: "On"
groupId: "4660"
groupId: 0x0101

- label: "Wait 100ms"
cluster: "DelayCommands"
Expand All @@ -133,7 +133,7 @@ tests:
- label: "Turn Off the light to see attribute change"
cluster: "On/Off"
command: "Off"
groupId: "4660"
groupId: 0x0101

- label: "Wait 100ms"
cluster: "DelayCommands"
Expand All @@ -147,7 +147,7 @@ tests:
- label: "Turn On the light to see attribute change"
cluster: "On/Off"
command: "On"
groupId: "4660"
groupId: 0x0101

- label: "Wait 100ms"
cluster: "DelayCommands"
Expand All @@ -160,7 +160,7 @@ tests:
- label: "Turn Off the light to see attribute change"
cluster: "On/Off"
command: "Off"
groupId: "4660"
groupId: 0x0101

- label: "Wait 100ms"
cluster: "DelayCommands"
Expand Down
29 changes: 27 additions & 2 deletions src/app/tests/suites/TestGroupDemoConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,37 @@ tests:
arguments:
values:
- name: "groupId"
value: 0x1234
value: 0x0101
- name: "groupName"
value: "Group #1"
response:
values:
- name: "status"
value: 0
- name: "groupId"
value: 0x1234
value: 0x0101

- label: "KeySet Write 1"
cluster: "Group Key Management"
command: "KeySetWrite"
arguments:
values:
- name: "GroupKeySet"
value:
{
GroupKeySetID: 0x01a1,
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: "Map Group Key Set to group ID on a given fabric"
cluster: "Group Key Management"
command: "writeAttribute"
attribute: "GroupKeyMap"
arguments:
value: [{ FabricIndex: 1, GroupId: 0x0101, GroupKeySetID: 0x01a1 }]
Loading

0 comments on commit 6d5c3ef

Please sign in to comment.