Skip to content

Commit

Permalink
Initialize thread border router management xml template file and run …
Browse files Browse the repository at this point in the history
…zap_generate_all.py
  • Loading branch information
wqx6 committed May 27, 2024
1 parent 3718e99 commit 1085107
Show file tree
Hide file tree
Showing 66 changed files with 10,922 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ jobs:
src/app/zap-templates/zcl/data-model/chip/test-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/thermostat-user-interface-configuration-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/thread-border-router-management-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/thread-network-diagnostics-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/time-format-localization-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/time-synchronization-cluster.xml \
Expand Down
1 change: 1 addition & 0 deletions docs/zap_clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Generally regenerate using one of:
| 1069 | 0x42D | Pm10ConcentrationMeasurement |
| 1070 | 0x42E | TotalVolatileOrganicCompoundsConcentrationMeasurement |
| 1071 | 0x42F | RadonConcentrationMeasurement |
| 1106 | 0x452 | ThreadBorderRouterManagement |
| 1283 | 0x503 | WakeOnLan |
| 1284 | 0x504 | Channel |
| 1285 | 0x505 | TargetNavigator |
Expand Down
1 change: 1 addition & 0 deletions scripts/rules.matterlint
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/temperature-measurement-clust
load "../src/app/zap-templates/zcl/data-model/chip/test-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/thermostat-user-interface-configuration-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/thread-border-router-management-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/thread-network-diagnostics-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/time-format-localization-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/time-synchronization-cluster.xml";
Expand Down
1 change: 1 addition & 0 deletions src/app/common/templates/config-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ CommandHandlerInterfaceOnlyClusters:
- Device Energy Management Mode
- Electrical Power Measurement
- Electrical Energy Measurement
- Thread Border Router Management

# We need a more configurable way of deciding which clusters have which init functions....
# See https://github.com/project-chip/connectedhomeip/issues/4369
Expand Down
1 change: 1 addition & 0 deletions src/app/zap-templates/zcl/data-model/all.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
<xi:include href="chip/test-cluster.xml" />
<xi:include href="chip/thermostat-user-interface-configuration-cluster.xml" />
<xi:include href="chip/thermostat-cluster.xml" />
<xi:include href="chip/thread-border-router-management-cluster.xml" />
<xi:include href="chip/thread-network-diagnostics-cluster.xml" />
<xi:include href="chip/time-format-localization-cluster.xml" />
<xi:include href="chip/time-synchronization-cluster.xml" />
Expand Down
15 changes: 15 additions & 0 deletions src/app/zap-templates/zcl/data-model/chip/matter-devices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2427,6 +2427,21 @@ limitations under the License.
<include cluster="Descriptor" client="false" server="true" clientLocked="true" serverLocked="true"/>
</clusters>
</deviceType>
<deviceType>
<name>MA-thread-border-router</name>
<domain>HRAP</domain>
<typeName>Matter Thread Border Router</typeName>
<profileId editable="false">0x0103</profileId>
<deviceId editable="false">0xFFF10011</deviceId><!-- TODO: ID-TBD -->
<class>Simple</class>
<scope>Endpoint</scope>
<clusters lockOthers="true">
<include cluster="Descriptor" client="false" server="true" clientLocked="true" serverLocked="true"/>
<include cluster="Thread Network Diagnostics" client="false" server="true" clientLocked="true" serverLocked="true"></include>
<include cluster="Thread Border Router Mangement" client="false" server="true" clientLocked="true" serverLocked="true"></include>
</clusters>
</deviceType>

<deviceType>
<name>MA-all-clusters-app</name>
<domain>CHIP</domain>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2024 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.
-->
<configurator>
<domain name="CHIP"/>

<bitmap name="Feature" type="bitmap32">
<cluster code="0x0452"/>
<field name="PANChange" mask="0x1"/>
</bitmap>

<enum name="RoutingRoleEnum" type="enum8">
<cluster code="0x0452"/>
<item name="Unspecified" value="0x00"/>
<item name="Unassigned" value="0x01"/>
<item name="SleepyEndDevice" value="0x02"/>
<item name="EndDevice" value="0x03"/>
<item name="REED" value="0x04"/>
<item name="Router" value="0x05"/>
<item name="Leader" value="0x06"/>
</enum>

<struct name="NeiborTableStruct">
<cluster code="0x0452"/>
<item fieldId="0" name="ExtAddress" type="int64u"/>
<item fieldId="1" name="Age" type="int32u"/>
<item fieldId="2" name="Rloc16" type="int16u"/>
<item fieldId="3" name="AverageRssi" type="int8s" isNullable="true"/>
<item fieldId="4" name="LastRssi" type="int8s" isNullable="true"/>
<item fieldId="5" name="RoutingRole" type="RoutingRoleEnum"/>
</struct>

<struct name="RouteTableStruct">
<cluster code="0x0452"/>
<item fieldId="0" name="RouterId" type="int8u"/>
<item fieldId="1" name="PathCost" type="int8u"/>
<item fieldId="2" name="LQIIn" type="int8u"/>
<item fieldId="3" name="LQIOut" type="int8u"/>
</struct>

<struct name="ChildTableStruct">
<cluster code="0x0452"/>
<item fieldId="0" name="Rloc16" type="int16u"/>
<item fieldId="1" name="LinkQuality" type="int8u"/>
<item fieldId="2" name="RoutingRole" type="RoutingRoleEnum"/>
</struct>

<struct name="ThreadNodeStruct">
<cluster code="0x0452"/>
<item fieldId="0" name="ExtAddress" type="int64u"/>
<item fieldId="1" name="Rloc16" type="int16u"/>
<item fieldId="2" name="IPv6s" type="octet_string" array="true"/>
<item fieldId="3" name="RoutingRole" type="RoutingRoleEnum"/>
<item fieldId="4" name="RouteTable" type="RouteTableStruct" array="true"/>
<item fieldId="5" name="ChildTable" type="ChildTableStruct" array="true"/>
</struct>

<cluster>
<domain>HRAP</domain>
<name>Thread Border Router Management</name>
<code>0x0452</code>
<define>THREAD_BORDER_ROUTER_MANAGEMENT</define>
<client init="false" tick="false">true</client>
<server init="false" tick="false">true</server>
<description>Thread BR management</description>

<globalAttribute code="0xFFFD" side="either" value="1"/>

<attribute side="server" code="0x0000" define="BORDER_ROUTER_NAME" type="char_string" length="63">BorderRouterName</attribute>

<attribute side="server" code="0x0001" define="BORDER_AGENT_ID" type="octet_string" length="16">BorderAgentId</attribute>

<attribute side="server" code="0x0002" define="THREAD_VERSION" type="int16u">ThreadVersion</attribute>

<attribute side="server" code="0x0003" define="INTERFACE_ENABLED" type="boolean">InterfaceEnabled</attribute>

<attribute side="server" code="0x0004" define="THREAD_NODE" type="ThreadNodeStruct">ThreadNode</attribute>

<attribute side="server" code="0x0005" define="ACTIVE_DATASET_TIMESTAMP" type="int64u" isNullable="true">ActiveDatasetTimestamp</attribute>


<command source="client" code="0x00" name="GetActiveDatasetRequest" response="DatasetResponse" optional="false">
<description>On receipt of this command, the Thread Border Router will read the active operational dataset of the Thread network that it is connaected to, and send the DatasetResponse as the response. This command must be sent over a valid CASE session</description>
<access op="invoke" privilege="manage"/>
</command>

<command source="client" code="0x01" name="GetPendingDatasetRequest" response="DatasetResponse" optional="false">
<description>On receipt of this command, the Thread Border Router will read the pending dataset and send the DatasetResponse as the response. This command must be sent over a valid CASE session</description>
<access op="invoke" privilege="manage"/>
</command>

<command source="server" code="0x02" name="DatasetResponse" optional="false">
<description>Generated response to GetActiveDatasetRequest or GetPendingDatasetRequest commands</description>
<arg name="Dataset" type="octet_string" length="254"/>
</command>

<command source="client" code="0x03" name="SetActiveDatasetRequest" optional="false">
<description>On receipt of this command, the Thread Border Router will set or update the active Dataset of the Thread network that the Stub Router is connected to.</description>
<arg name="ActiveDataset" type="octet_string" length="254"/>
<arg name="Breadcrumb" type="int64u"/>
<access op="invoke" privilege="manage"/>
</command>

<command source="client" code="0x04" name="SetPendingDatasetRequest" optional="true">
<description>On receipt of this command, the Thread Border Router will set or update the pending Dataset</description>
<arg name="PendingDataset" type="octet_string" length="254"/>
<access op="invoke" privilege="manage"/>
</command>

<command source="client" code="0x05" name="TopologyRequest" response="TopologyResponse" optional="false">
<description>On receipt of this command, the Thread Border Router will response the current topology of the Thread network that it is connected to.</description>
<arg name="Count" type="int16u"/>
<arg name="StartIndex" type="int16u"/>
<arg name="Snapshot" type="int8u"/>
<access op="invoke" privilege="administer"/>
</command>

<command source="server" code="0x06" name="TopologyResponse" optional="false">
<description>Generated response to TopologyRequest command</description>
<arg name="Snapshot" type="int8u"/>
<arg name="NumberOfDevices" type="int16u"/>
<arg name="ThreadTopology" type="ThreadNodeStruct" array="true"/>
</command>

</cluster>
</configurator>
10 changes: 10 additions & 0 deletions src/app/zap-templates/zcl/zcl-with-test-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"test-cluster.xml",
"thermostat-cluster.xml",
"thermostat-user-interface-configuration-cluster.xml",
"thread-border-router-management-cluster.xml",
"thread-network-diagnostics-cluster.xml",
"time-format-localization-cluster.xml",
"time-synchronization-cluster.xml",
Expand Down Expand Up @@ -289,6 +290,15 @@
"general_error_boolean",
"cluster_error_boolean"
],
"Thread Border Router Management": [
"BorderRouterName",
"BorderAgentId",
"ThreadVersion",
"InterfaceEnabled",
"ThreadNode",
"ActiveDatasetTimestamp",
"FeatureMap"
],
"Thread Network Diagnostics": [
"Channel",
"RoutingRole",
Expand Down
10 changes: 10 additions & 0 deletions src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
"test-cluster.xml",
"thermostat-cluster.xml",
"thermostat-user-interface-configuration-cluster.xml",
"thread-border-router-management-cluster.xml",
"thread-network-diagnostics-cluster.xml",
"time-format-localization-cluster.xml",
"time-synchronization-cluster.xml",
Expand Down Expand Up @@ -287,6 +288,15 @@
"general_error_boolean",
"cluster_error_boolean"
],
"Thread Border Router Management": [
"BorderRouterName",
"BorderAgentId",
"ThreadVersion",
"InterfaceEnabled",
"ThreadNode",
"ActiveDatasetTimestamp",
"FeatureMap"
],
"Thread Network Diagnostics": [
"Channel",
"RoutingRole",
Expand Down
2 changes: 2 additions & 0 deletions src/app/zap_cluster_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"TEMPERATURE_MEASUREMENT_CLUSTER": [],
"THERMOSTAT_CLUSTER": ["thermostat-client"],
"THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER": [],
"THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER": [],
"THREAD_NETWORK_DIAGNOSTICS_CLUSTER": [],
"TIME_CLUSTER": [],
"TIME_FORMAT_LOCALIZATION_CLUSTER": [],
Expand Down Expand Up @@ -286,6 +287,7 @@
"THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLUSTER": [
"thermostat-user-interface-configuration-server"
],
"THREAD_BORDER_ROUTER_MANAGEMENT_CLUSTER": [],
"THREAD_NETWORK_DIAGNOSTICS_CLUSTER": [
"thread-network-diagnostics-server"
],
Expand Down
99 changes: 99 additions & 0 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -7654,6 +7654,105 @@ cluster RadonConcentrationMeasurement = 1071 {
readonly attribute int16u clusterRevision = 65533;
}

/** Thread BR management */
cluster ThreadBorderRouterManagement = 1106 {
revision 1;

enum RoutingRoleEnum : enum8 {
kUnspecified = 0;
kUnassigned = 1;
kSleepyEndDevice = 2;
kEndDevice = 3;
kREED = 4;
kRouter = 5;
kLeader = 6;
}

bitmap Feature : bitmap32 {
kPANChange = 0x1;
}

struct ChildTableStruct {
int16u rloc16 = 0;
int8u linkQuality = 1;
RoutingRoleEnum routingRole = 2;
}

struct RouteTableStruct {
int8u routerId = 0;
int8u pathCost = 1;
int8u LQIIn = 2;
int8u LQIOut = 3;
}

struct ThreadNodeStruct {
int64u extAddress = 0;
int16u rloc16 = 1;
octet_string IPv6s[] = 2;
RoutingRoleEnum routingRole = 3;
RouteTableStruct routeTable[] = 4;
ChildTableStruct childTable[] = 5;
}

struct NeiborTableStruct {
int64u extAddress = 0;
int32u age = 1;
int16u rloc16 = 2;
nullable int8s averageRssi = 3;
nullable int8s lastRssi = 4;
RoutingRoleEnum routingRole = 5;
}

readonly attribute char_string<63> borderRouterName = 0;
readonly attribute octet_string<16> borderAgentId = 1;
readonly attribute int16u threadVersion = 2;
readonly attribute boolean interfaceEnabled = 3;
readonly attribute ThreadNodeStruct threadNode = 4;
readonly attribute nullable int64u activeDatasetTimestamp = 5;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

response struct DatasetResponse = 2 {
octet_string<254> dataset = 0;
}

request struct SetActiveDatasetRequestRequest {
octet_string<254> activeDataset = 0;
int64u breadcrumb = 1;
}

request struct SetPendingDatasetRequestRequest {
octet_string<254> pendingDataset = 0;
}

request struct TopologyRequestRequest {
int16u count = 0;
int16u startIndex = 1;
int8u snapshot = 2;
}

response struct TopologyResponse = 6 {
int8u snapshot = 0;
int16u numberOfDevices = 1;
ThreadNodeStruct threadTopology[] = 2;
}

/** On receipt of this command, the Thread Border Router will read the active operational dataset of the Thread network that it is connaected to, and send the DatasetResponse as the response. This command must be sent over a valid CASE session */
command access(invoke: manage) GetActiveDatasetRequest(): DatasetResponse = 0;
/** On receipt of this command, the Thread Border Router will read the pending dataset and send the DatasetResponse as the response. This command must be sent over a valid CASE session */
command access(invoke: manage) GetPendingDatasetRequest(): DatasetResponse = 1;
/** On receipt of this command, the Thread Border Router will set or update the active Dataset of the Thread network that the Stub Router is connected to. */
command access(invoke: manage) SetActiveDatasetRequest(SetActiveDatasetRequestRequest): DefaultSuccess = 3;
/** On receipt of this command, the Thread Border Router will set or update the pending Dataset */
command access(invoke: manage) SetPendingDatasetRequest(SetPendingDatasetRequestRequest): DefaultSuccess = 4;
/** On receipt of this command, the Thread Border Router will response the current topology of the Thread network that it is connected to. */
command access(invoke: administer) TopologyRequest(TopologyRequestRequest): TopologyResponse = 5;
}

/** This cluster provides an interface for managing low power mode on a device that supports the Wake On LAN protocol. */
cluster WakeOnLan = 1283 {
revision 1;
Expand Down
Loading

0 comments on commit 1085107

Please sign in to comment.