Skip to content

Commit

Permalink
Add access control server skeleton (#12296)
Browse files Browse the repository at this point in the history
Add access control cluster and server skeleton

- Define cluster XML, ZAP, etc.
- Add empty cluster implementation to all-clusters-app example.
- Disabled some tests of the cluster (since its attributes are not implemented).

Issue #11204

Testing:
Built and ran and ensured it's present in chip-all-cluster-app. Ran unit tests.
  • Loading branch information
mlepage-google authored Dec 4, 2021
1 parent fc35caf commit 1f484bd
Show file tree
Hide file tree
Showing 62 changed files with 2,605 additions and 179 deletions.
66 changes: 66 additions & 0 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,72 @@
}
]
},
{
"name": "Access Control",
"code": 31,
"mfgCode": null,
"define": "ACCESS_CONTROL_CLUSTER",
"side": "client",
"enabled": 0,
"commands": [],
"attributes": []
},
{
"name": "Access Control",
"code": 31,
"mfgCode": null,
"define": "ACCESS_CONTROL_CLUSTER",
"side": "server",
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "ACL",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "Extension",
"code": 1,
"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": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
}
]
},
{
"name": "Basic",
"code": 40,
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ set(SRC_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/level-control"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/identify-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/access-control-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/account-login-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/application-launcher-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/audio-output-server"
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ target_sources(${APP_TARGET} PRIVATE
${APP_CLUSTERS}/basic/basic.cpp
${APP_CLUSTERS}/bindings/bindings.cpp
${APP_CLUSTERS}/on-off-server/on-off-server.cpp
${APP_CLUSTERS}/access-control-server/access-control-server.cpp
${APP_CLUSTERS}/account-login-server/account-login-server.cpp
${APP_CLUSTERS}/application-launcher-server/application-launcher-server.cpp
${APP_CLUSTERS}/audio-output-server/audio-output-server.cpp
Expand Down
18 changes: 18 additions & 0 deletions src/app/clusters/access-control-server/access-control-server.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
*
* Copyright (c) 2021 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.
*/

void MatterAccessControlPluginServerInitCallback() {}
1 change: 1 addition & 0 deletions src/app/tests/suites/TestDescriptorCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ tests:
value: [
0x0003, # Identify
0x001D, # Descriptor
0x001F, # Access Control
0x0028, # Basic Information
0x0029, # OTA Software Update Provider
0x002A, # OTA Software Update Requestor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ limitations under the License.
and enforce Access Control for the Node’s endpoints and their associated
cluster instances.</description>
<!-- Base data types -->
<attribute side="server" code="0x0000" define="ACL" type="ARRAY" entryType="AccessControlEntry" writable="true" isNullable="true">
<attribute side="server" code="0x0000" define="ACL" type="ARRAY" entryType="AccessControlEntry" writable="true">
<description>ACL</description>
<access op="read" privilege="administer"/>
<access op="write" privilege="administer"/>
<access modifier="fabric-scoped"/>
</attribute>
<attribute side="server" code="0x0001" define="EXTENSION" type="ARRAY" entryType="ExtensionEntry" writable="true" isNullable="true">
<attribute side="server" code="0x0001" define="EXTENSION" type="ARRAY" entryType="ExtensionEntry" writable="true">
<description>Extension</description>
<access op="read" privilege="administer"/>
<access op="write" privilege="administer"/>
Expand Down
1 change: 1 addition & 0 deletions src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"version": "ZCL Test Data",
"xmlRoot": [".", "./data-model/chip/", "./data-model/silabs/"],
"xmlFile": [
"access-control-cluster.xml",
"account-login-cluster.xml",
"administrator-commissioning-cluster.xml",
"application-basic-cluster.xml",
Expand Down
36 changes: 19 additions & 17 deletions src/app/zap_cluster_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@

# List of directories in src/app/clusters to build for server clusters.
SERVER_CLUSTERS: typing.Dict[str, typing.List[str]] = {
'ALARM_CLUSTER': [],
'APPLICATION_BASIC_CLUSTER': ['application-basic-server'],
'ACCESS_CONTROL_CLUSTER': ['access-control-server'],
'ACCOUNT_LOGIN_CLUSTER': ['account-login-server'],
'ADMINISTRATOR_COMMISSIONING_CLUSTER': ['administrator-commissioning-server'],
'ALARM_CLUSTER': [],
'APPLICATION_BASIC_CLUSTER': ['application-basic-server'],
'APPLICATION_LAUNCHER_CLUSTER': ['application-launcher-server'],
'AUDIO_OUTPUT_CLUSTER': ['audio-output-server'],
'BARRIER_CONTROL_CLUSTER': ['barrier-control-server'],
Expand All @@ -29,13 +30,14 @@
'DEVICE_TEMP_CLUSTER': [],
'DIAGNOSTIC_LOGS_CLUSTER': ['diagnostic-logs-server'],
'DOOR_LOCK_CLUSTER': ['door-lock-server'],
'ELECTRICAL_MEASUREMENT_CLUSTER': [],
'ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER': ['ethernet_network_diagnostics_server'],
'FIXED_LABEL_CLUSTER': [],
'FLOW_MEASUREMENT_CLUSTER': [],
'GENERAL_COMMISSIONING_CLUSTER': ['general-commissioning-server'],
'GENERAL_DIAGNOSTICS_CLUSTER': ['general_diagnostics_server'],
'GROUPS_CLUSTER': ['groups-server'],
'GROUP_KEY_MANAGEMENT_CLUSTER': [],
'GROUPS_CLUSTER': ['groups-server'],
'IAS_ZONE_CLUSTER': ['ias-zone-server'],
'IDENTIFY_CLUSTER': ['identify-server'],
'ILLUMINANCE_MEASUREMENT_CLUSTER': [],
Expand All @@ -58,31 +60,31 @@
'PRESSURE_MEASUREMENT_CLUSTER': [],
'PUMP_CONFIG_CONTROL_CLUSTER': ['pump-configuration-and-control-server'],
'RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER': [],
'ELECTRICAL_MEASUREMENT_CLUSTER': [],
'SCENES_CLUSTER': ['scenes'],
'SOFTWARE_DIAGNOSTICS_CLUSTER': ['software_diagnostics_server'],
'SWITCH_CLUSTER': [],
'TARGET_NAVIGATOR_CLUSTER': ['target-navigator-server'],
'TEMP_MEASUREMENT_CLUSTER': [],
'TEST_CLUSTER': ['test-cluster-server'],
'TV_CHANNEL_CLUSTER': ['tv-channel-server'],
'THERMOSTAT_CLUSTER': ['thermostat-server'],
'THREAD_NETWORK_DIAGNOSTICS_CLUSTER': ['thread_network_diagnostics_server'],
'WINDOW_COVERING_CLUSTER': ['window-covering-server'],
'THERMOSTAT_UI_CONFIG_CLUSTER': ['thermostat-user-interface-configuration-server'],
'WIFI_NETWORK_DIAGNOSTICS_CLUSTER': ['wifi_network_diagnostics_server'],
'THREAD_NETWORK_DIAGNOSTICS_CLUSTER': ['thread_network_diagnostics_server'],
'TV_CHANNEL_CLUSTER': ['tv-channel-server'],
'WAKE_ON_LAN_CLUSTER': [],
'WIFI_NETWORK_DIAGNOSTICS_CLUSTER': ['wifi_network_diagnostics_server'],
'WINDOW_COVERING_CLUSTER': ['window-covering-server'],
'ZLL_COMMISSIONING_CLUSTER': []
}

# List of directories in src/app/clusters to build for client clusters.
CLIENT_CLUSTERS: typing.Dict[str, typing.List[str]] = {
'ALARM_CLUSTER': [],
'ACCESS_CONTROL_CLUSTER': [],
'ACCOUNT_LOGIN_CLUSTER': [],
'ADMINISTRATOR_COMMISSIONING_CLUSTER': [],
'ALARM_CLUSTER': [],
'APPLICATION_BASIC_CLUSTER': [],
'APPLICATION_LAUNCHER_CLUSTER': [],
'AUDIO_OUTPUT_CLUSTER': [],
'APPLICATION_BASIC_CLUSTER': [],
'BARRIER_CONTROL_CLUSTER': [],
'BASIC_CLUSTER': [],
'BINARY_INPUT_BASIC_CLUSTER': [],
Expand All @@ -93,17 +95,18 @@
'COLOR_CONTROL_CLUSTER': [],
'COMMISSIONING_CLUSTER': [],
'CONTENT_LAUNCH_CLUSTER': [],
'DEVICE_TEMP_CLUSTER': [],
'DESCRIPTOR_CLUSTER': [],
'DEVICE_TEMP_CLUSTER': [],
'DIAGNOSTIC_LOGS_CLUSTER': [],
'DOOR_LOCK_CLUSTER': [],
'ELECTRICAL_MEASUREMENT_CLUSTER': [],
'ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER': [],
'FIXED_LABEL_CLUSTER': [],
'FLOW_MEASUREMENT_CLUSTER': [],
'GENERAL_COMMISSIONING_CLUSTER': [],
'GENERAL_DIAGNOSTICS_CLUSTER': [],
'GROUPS_CLUSTER': [],
'GROUP_KEY_MANAGEMENT_CLUSTER': [],
'GROUPS_CLUSTER': [],
'IAS_ZONE_CLUSTER': ['ias-zone-client'],
'IDENTIFY_CLUSTER': [],
'ILLUMINANCE_MEASUREMENT_CLUSTER': [],
Expand All @@ -126,21 +129,20 @@
'PRESSURE_MEASUREMENT_CLUSTER': [],
'PUMP_CONFIG_CONTROL_CLUSTER': ['pump-configuration-and-control-client'],
'RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER': [],
'ELECTRICAL_MEASUREMENT_CLUSTER': [],
'SCENES_CLUSTER': [],
'SOFTWARE_DIAGNOSTICS_CLUSTER': [],
'SWITCH_CLUSTER': [],
'TARGET_NAVIGATOR_CLUSTER': [],
'TEMP_MEASUREMENT_CLUSTER': [],
'TEST_CLUSTER': [],
'TRUSTED_ROOT_CERTIFICATES_CLUSTER': [],
'TV_CHANNEL_CLUSTER': [],
'THERMOSTAT_CLUSTER': ['thermostat-client'],
'THERMOSTAT_UI_CONFIG_CLUSTER': [],
'THREAD_NETWORK_DIAGNOSTICS_CLUSTER': [],
'WINDOW_COVERING_CLUSTER': [],
'WIFI_NETWORK_DIAGNOSTICS_CLUSTER': [],
'TRUSTED_ROOT_CERTIFICATES_CLUSTER': [],
'TV_CHANNEL_CLUSTER': [],
'WAKE_ON_LAN_CLUSTER': [],
'WIFI_NETWORK_DIAGNOSTICS_CLUSTER': [],
'WINDOW_COVERING_CLUSTER': [],
'ZLL_COMMISSIONING_CLUSTER': []
}

Expand Down
82 changes: 82 additions & 0 deletions src/controller/data_model/controller-clusters.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1343,6 +1343,88 @@
}
]
},
{
"name": "Access Control",
"code": 31,
"mfgCode": null,
"define": "ACCESS_CONTROL_CLUSTER",
"side": "client",
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "ClusterRevision",
"code": 65533,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "1",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
}
]
},
{
"name": "Access Control",
"code": 31,
"mfgCode": null,
"define": "ACCESS_CONTROL_CLUSTER",
"side": "server",
"enabled": 0,
"commands": [],
"attributes": [
{
"name": "ACL",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "Extension",
"code": 1,
"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": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
}
]
},
{
"name": "Bridged Actions",
"code": 37,
Expand Down
6 changes: 6 additions & 0 deletions src/controller/java/zap-generated/CHIPCallbackTypes.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/controller/java/zap-generated/CHIPClusters-JNI.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1f484bd

Please sign in to comment.