Skip to content

Commit

Permalink
Match default group and ACL values to Specification (#24338)
Browse files Browse the repository at this point in the history
* Update CHIPConfig.h to match specification changes in Group Limits.

* Update tests for changes to group and ACL minima.

* Restyled by clang-format

* Restyled by autopep8

* Correct group key assignment in test suite.

* Update TC_RR_1_1.py to include new group tests as well.

* Update with latest zap generated test Commands

* Reduce debug log buffer for TI CC26X2X7 shell app.

THere was insufficient space in SRAM region.

* Resolve comments - improve errors and remove extra print.

Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
2 people authored and pull[bot] committed Jan 20, 2024
1 parent 80ac9e6 commit 3146445
Show file tree
Hide file tree
Showing 7 changed files with 1,182 additions and 159 deletions.
2 changes: 1 addition & 1 deletion examples/shell/cc13x2x7_26x2x7/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
*
* A size, in bytes, of the individual debug event logging buffer.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512)
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (256)

#define MATTER_CC13X2_26X2_PLATFORM_LOG_ENABLED 0

Expand Down
50 changes: 49 additions & 1 deletion src/app/tests/suites/TestAccessControlCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ tests:
{ Cluster: 18, Endpoint: 19, DeviceType: null },
],
},
{
FabricIndex: 0,
Privilege: 3, # operate
AuthMode: 2, # case
Subjects: [20, 21, 22, 23],
Targets:
[
{ Cluster: null, Endpoint: 24, DeviceType: null },
{ Cluster: 25, Endpoint: null, DeviceType: null },
{ Cluster: 26, Endpoint: 27, DeviceType: null },
],
},
]

- label: "Verify"
Expand Down Expand Up @@ -112,6 +124,18 @@ tests:
{ Cluster: 18, Endpoint: 19, DeviceType: null },
],
},
{
FabricIndex: 1,
Privilege: 3, # operate
AuthMode: 2, # case
Subjects: [20, 21, 22, 23],
Targets:
[
{ Cluster: null, Endpoint: 24, DeviceType: null },
{ Cluster: 25, Endpoint: null, DeviceType: null },
{ Cluster: 26, Endpoint: 27, DeviceType: null },
],
},
]

- label: "Write entries empty lists"
Expand Down Expand Up @@ -476,6 +500,18 @@ tests:
{ Cluster: 26, Endpoint: 27, DeviceType: null },
],
},
{
FabricIndex: 0,
Privilege: 3, # operate
AuthMode: 2, # case
Subjects: [28, 29, 30, 31],
Targets:
[
{ Cluster: null, Endpoint: 32, DeviceType: null },
{ Cluster: 33, Endpoint: null, DeviceType: null },
{ Cluster: 34, Endpoint: 35, DeviceType: null },
],
},
]
response:
error: RESOURCE_EXHAUSTED
Expand Down Expand Up @@ -521,6 +557,18 @@ tests:
{ Cluster: 18, Endpoint: 19, DeviceType: null },
],
},
{
FabricIndex: 1,
Privilege: 1, # view
AuthMode: 2, # case
Subjects: [20, 21, 22, 23],
Targets:
[
{ Cluster: null, Endpoint: 24, DeviceType: null },
{ Cluster: 25, Endpoint: null, DeviceType: null },
{ Cluster: 26, Endpoint: 27, DeviceType: null },
],
},
]

# note missing last entry
Expand Down Expand Up @@ -571,4 +619,4 @@ tests:
attribute: "AccessControlEntriesPerFabric"
response:
constraints:
minValue: 3
minValue: 4
68 changes: 65 additions & 3 deletions src/app/tests/suites/TestGroupKeyManagementCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tests:
attribute: "maxGroupsPerFabric"
response:
constraints:
minValue: 2
minValue: 4

- label: "Read maxGroupKeysPerFabric"
command: "readAttribute"
Expand Down Expand Up @@ -123,6 +123,8 @@ tests:
{ FabricIndex: 1, GroupId: 0x0101, GroupKeySetID: 0x01a2 },
{ FabricIndex: 1, GroupId: 0x0102, GroupKeySetID: 0x01a1 },
{ FabricIndex: 1, GroupId: 0x0102, GroupKeySetID: 0x01a2 },
{ FabricIndex: 1, GroupId: 0x0103, GroupKeySetID: 0x01a1 },
{ FabricIndex: 1, GroupId: 0x0103, GroupKeySetID: 0x01a2 },
]
response:
error: FAILURE
Expand All @@ -134,8 +136,9 @@ tests:
value:
[
{ FabricIndex: 1, GroupId: 0x0101, GroupKeySetID: 0x01a1 },
{ FabricIndex: 1, GroupId: 0x0102, GroupKeySetID: 0x01a1 },
{ FabricIndex: 1, GroupId: 0x0102, GroupKeySetID: 0x01a2 },
{ FabricIndex: 1, GroupId: 0x0103, GroupKeySetID: 0x01a1 },
{ FabricIndex: 1, GroupId: 0x0104, GroupKeySetID: 0x01a2 },
]

- label: "Read Group Keys"
Expand All @@ -145,8 +148,9 @@ tests:
value:
[
{ FabricIndex: 1, GroupId: 0x0101, GroupKeySetID: 0x01a1 },
{ FabricIndex: 1, GroupId: 0x0102, GroupKeySetID: 0x01a1 },
{ FabricIndex: 1, GroupId: 0x0102, GroupKeySetID: 0x01a2 },
{ FabricIndex: 1, GroupId: 0x0103, GroupKeySetID: 0x01a1 },
{ FabricIndex: 1, GroupId: 0x0104, GroupKeySetID: 0x01a2 },
]

- label: "Add Group 1"
Expand Down Expand Up @@ -183,6 +187,40 @@ tests:
- name: "GroupID"
value: 0x0102

- label: "Add Group 3"
cluster: "Groups"
endpoint: 1
command: "AddGroup"
arguments:
values:
- name: "GroupID"
value: 0x0103
- name: "GroupName"
value: "Group #3"
response:
values:
- name: "Status"
value: 0
- name: "GroupID"
value: 0x0103

- label: "Add Group 4"
cluster: "Groups"
endpoint: 1
command: "AddGroup"
arguments:
values:
- name: "GroupID"
value: 0x0104
- name: "GroupName"
value: "Group #4"
response:
values:
- name: "Status"
value: 0
- name: "GroupID"
value: 0x0104

- label: "Read GroupTable"
command: "readAttribute"
attribute: "GroupTable"
Expand All @@ -201,6 +239,18 @@ tests:
Endpoints: [1],
GroupName: "Group #2",
},
{
FabricIndex: 1,
GroupId: 0x0103,
endpoints: [1],
GroupName: "Group #3",
},
{
FabricIndex: 1,
GroupId: 0x0104,
endpoints: [1],
GroupName: "Group #4",
},
]

- label: "KeySet Remove 1"
Expand Down Expand Up @@ -267,6 +317,18 @@ tests:
Endpoints: [1],
GroupName: "Group #2",
},
{
FabricIndex: 1,
GroupId: 0x0103,
endpoints: [1],
GroupName: "Group #3",
},
{
FabricIndex: 1,
GroupId: 0x0104,
endpoints: [1],
GroupName: "Group #4",
},
]

- label: "Remove All"
Expand Down
30 changes: 17 additions & 13 deletions src/lib/core/CHIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,17 @@ extern const char CHIP_NON_PRODUCTION_MARKER[];
#define CHIP_CONFIG_DEVICE_MAX_ACTIVE_DEVICES 4
#endif

/**
* @def CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC
*
* @brief Defines the number of "endpoint->controlling group" mappings per fabric.
*
* Binds to number of GroupMapping entries per fabric
*/
#ifndef CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC
#define CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC 1
#endif

/**
* @def CHIP_CONFIG_MAX_GROUPS_PER_FABRIC
*
Expand All @@ -991,7 +1002,11 @@ extern const char CHIP_NON_PRODUCTION_MARKER[];
* Binds to number of GroupState entries to support per fabric
*/
#ifndef CHIP_CONFIG_MAX_GROUPS_PER_FABRIC
#define CHIP_CONFIG_MAX_GROUPS_PER_FABRIC 3
#define CHIP_CONFIG_MAX_GROUPS_PER_FABRIC (4 * CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC)
#endif

#if CHIP_CONFIG_MAX_GROUPS_PER_FABRIC < (4 * CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC)
#error "Please ensure CHIP_CONFIG_MAX_GROUPS_PER_FABRIC meets minimum requirements. See Group Limits in the specification."
#endif

/**
Expand All @@ -1009,17 +1024,6 @@ extern const char CHIP_NON_PRODUCTION_MARKER[];
#error "Please ensure CHIP_CONFIG_MAX_GROUP_KEYS_PER_FABRIC > 0 to support at least the IPK."
#endif

/**
* @def CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC
*
* @brief Defines the number of "endpoint->controlling group" mappings per fabric.
*
* Binds to number of GroupMapping entries per fabric
*/
#ifndef CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC
#define CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC 1
#endif

/**
* @def CHIP_CONFIG_MAX_GROUP_CONCURRENT_ITERATORS
*
Expand Down Expand Up @@ -1047,7 +1051,7 @@ extern const char CHIP_NON_PRODUCTION_MARKER[];
* example access control code.
*/
#ifndef CHIP_CONFIG_EXAMPLE_ACCESS_CONTROL_MAX_ENTRIES_PER_FABRIC
#define CHIP_CONFIG_EXAMPLE_ACCESS_CONTROL_MAX_ENTRIES_PER_FABRIC 3
#define CHIP_CONFIG_EXAMPLE_ACCESS_CONTROL_MAX_ENTRIES_PER_FABRIC 4
#endif

/**
Expand Down
Loading

0 comments on commit 3146445

Please sign in to comment.