Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openthread-border-router: Bump firmwares, flasher, and OTBR to latest versions #3808

Merged
merged 12 commits into from
Nov 15, 2024
16 changes: 9 additions & 7 deletions openthread_border_router/0001-support-deleting-the-dataset.patch
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
From 2efa60f83b71402ce0c1ef176be8f88a9bfdefac Mon Sep 17 00:00:00 2001
From a2b607db19b643e63b8a6be84fb95adfbd9ebb47 Mon Sep 17 00:00:00 2001
From: Stefan Agner <[email protected]>
Date: Mon, 5 Jun 2023 23:41:50 +0200
Subject: [PATCH] support deleting the dataset
Subject: [PATCH 1/3] support deleting the dataset

Add REST API to support deleting the active or pending operational
dataset. Deleting the active operational dataset requires the Thread
network to be disabled (just like modifying the active operational
dataset). Subsequent use of the PUT method allows to build entirly
new datasets with values generated by the stack (through
otDatasetCreateNewNetwork).

Signed-off-by: puddly <[email protected]>
---
src/rest/openapi.yaml | 21 +++++++++++++++++++++
src/rest/resource.cpp | 35 +++++++++++++++++++++++++++++++++++
src/rest/resource.hpp | 1 +
3 files changed, 57 insertions(+)

diff --git a/src/rest/openapi.yaml b/src/rest/openapi.yaml
index 2ba2a4dd56f..2edc4af29ad 100644
index 4a033eb7..3cc2ef8f 100644
--- a/src/rest/openapi.yaml
+++ b/src/rest/openapi.yaml
@@ -248,6 +248,18 @@ paths:
Expand Down Expand Up @@ -55,7 +57,7 @@ index 2ba2a4dd56f..2edc4af29ad 100644
schemas:
LeaderData:
diff --git a/src/rest/resource.cpp b/src/rest/resource.cpp
index ce154c2e5b3..1708faf6abc 100644
index ce154c2e..1708faf6 100644
--- a/src/rest/resource.cpp
+++ b/src/rest/resource.cpp
@@ -767,12 +767,47 @@ exit:
Expand Down Expand Up @@ -107,10 +109,10 @@ index ce154c2e5b3..1708faf6abc 100644
GetDataset(aDatasetType, aRequest, aResponse);
break;
diff --git a/src/rest/resource.hpp b/src/rest/resource.hpp
index 0929dbcc50c..cbe1702f2fb 100644
index 7982843b..788dcd87 100644
--- a/src/rest/resource.hpp
+++ b/src/rest/resource.hpp
@@ -150,6 +150,7 @@ private:
@@ -142,6 +142,7 @@ private:
void GetDataRloc(Response &aResponse) const;
void GetDataset(DatasetType aDatasetType, const Request &aRequest, Response &aResponse) const;
void SetDataset(DatasetType aDatasetType, const Request &aRequest, Response &aResponse) const;
Expand All @@ -119,5 +121,5 @@ index 0929dbcc50c..cbe1702f2fb 100644
void DeleteOutDatedDiagnostic(void);
void UpdateDiag(std::string aKey, std::vector<otNetworkDiagTlv> &aDiag);
--
2.46.1
2.46.0

10 changes: 6 additions & 4 deletions openthread_border_router/0002-set-netif-route-metric-lower.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
From afb29a91024247f46e9e75954b930f4518444360 Mon Sep 17 00:00:00 2001
From b1eefc1a7ebcff849b74d314fc367ccd0e782225 Mon Sep 17 00:00:00 2001
From: Stefan Agner <[email protected]>
Date: Sat, 20 Jan 2024 16:31:28 +0100
Subject: [PATCH] set netif route metric lower
Subject: [PATCH 2/3] set netif route metric lower

It seems that routes learned through IPv6 Neighbor Discovery Protocol
get a metric of 128 when NetworkManager is used. Make sure the
OpenThread network interface's own route is lower than that.

Signed-off-by: puddly <[email protected]>
---
third_party/openthread/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/third_party/openthread/CMakeLists.txt b/third_party/openthread/CMakeLists.txt
index eab6e7c6007..9e01d66aefd 100644
index eab6e7c6..9e01d66a 100644
--- a/third_party/openthread/CMakeLists.txt
+++ b/third_party/openthread/CMakeLists.txt
@@ -106,6 +106,7 @@ target_compile_definitions(ot-config INTERFACE
Expand All @@ -23,5 +25,5 @@ index eab6e7c6007..9e01d66aefd 100644
)

--
2.46.1
2.46.0

162 changes: 162 additions & 0 deletions openthread_border_router/0003-Implement-node-coprocessor-version.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
From f5edb2d3ab257e03627461b5fa6ff6332988f75f Mon Sep 17 00:00:00 2001
From: puddly <[email protected]>
Date: Wed, 13 Nov 2024 16:55:53 -0500
Subject: [PATCH 3/3] Implement `/node/coprocessor/version`

---
src/rest/openapi.yaml | 15 +++++++++++++++
src/rest/resource.cpp | 30 ++++++++++++++++++++++++++++++
src/rest/resource.hpp | 2 ++
tests/rest/test_rest.py | 21 +++++++++++++++++++++
4 files changed, 68 insertions(+)

diff --git a/src/rest/openapi.yaml b/src/rest/openapi.yaml
index 3cc2ef8f..8b6c3e87 100644
--- a/src/rest/openapi.yaml
+++ b/src/rest/openapi.yaml
@@ -312,6 +312,21 @@ paths:
responses:
"200":
description: Successfully deleted the active operational dataset.
+ /node/coprocessor/version:
+ get:
+ tags:
+ - node
+ summary: Get the coprocessor version
+ description: Retrieves the NCP or RCP coprocessor version string.
+ responses:
+ "200":
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: string
+ description: Coprocessor version string
+ example: "OPENTHREAD/20210309-00615-g9836b6f18; NRF52840; Mar 9 2021 13:30:04"
components:
schemas:
LeaderData:
diff --git a/src/rest/resource.cpp b/src/rest/resource.cpp
index 1708faf6..076f21ac 100644
--- a/src/rest/resource.cpp
+++ b/src/rest/resource.cpp
@@ -46,6 +46,8 @@
#define OT_REST_RESOURCE_PATH_NODE_EXTPANID "/node/ext-panid"
#define OT_REST_RESOURCE_PATH_NODE_DATASET_ACTIVE "/node/dataset/active"
#define OT_REST_RESOURCE_PATH_NODE_DATASET_PENDING "/node/dataset/pending"
+#define OT_REST_RESOURCE_PATH_NODE_COPROCESSOR "/node/coprocessor"
+#define OT_REST_RESOURCE_PATH_NODE_COPROCESSOR_VERSION "/node/coprocessor/version"
#define OT_REST_RESOURCE_PATH_NETWORK "/networks"
#define OT_REST_RESOURCE_PATH_NETWORK_CURRENT "/networks/current"
#define OT_REST_RESOURCE_PATH_NETWORK_CURRENT_COMMISSION "/networks/commission"
@@ -139,6 +141,7 @@ Resource::Resource(RcpHost *aHost)
mResourceMap.emplace(OT_REST_RESOURCE_PATH_NODE_RLOC, &Resource::Rloc);
mResourceMap.emplace(OT_REST_RESOURCE_PATH_NODE_DATASET_ACTIVE, &Resource::DatasetActive);
mResourceMap.emplace(OT_REST_RESOURCE_PATH_NODE_DATASET_PENDING, &Resource::DatasetPending);
+ mResourceMap.emplace(OT_REST_RESOURCE_PATH_NODE_COPROCESSOR_VERSION, &Resource::CoprocessorVersion);

// Resource callback handler
mResourceCallbackMap.emplace(OT_REST_RESOURCE_PATH_DIAGNOSTICS, &Resource::HandleDiagnosticCallback);
@@ -835,6 +838,33 @@ void Resource::DatasetPending(const Request &aRequest, Response &aResponse) cons
Dataset(DatasetType::kPending, aRequest, aResponse);
}

+void Resource::GetCoprocessorVersion(Response &aResponse) const
+{
+ std::string coprocessorVersion;
+ std::string errorCode;
+
+ coprocessorVersion = mHost->GetCoprocessorVersion();
+ coprocessorVersion = Json::String2JsonString(coprocessorVersion);
+
+ aResponse.SetBody(coprocessorVersion);
+ errorCode = GetHttpStatus(HttpStatusCode::kStatusOk);
+ aResponse.SetResponsCode(errorCode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Typo in method name 'SetResponsCode'

There's a typo in the method name SetResponsCode; it should be SetResponseCode.

Apply this diff to fix the typo:

-    aResponse.SetResponsCode(errorCode);
+    aResponse.SetResponseCode(errorCode);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
+ aResponse.SetResponsCode(errorCode);
aResponse.SetResponseCode(errorCode);

+}
+
+void Resource::CoprocessorVersion(const Request &aRequest, Response &aResponse) const
+{
+ std::string errorCode;
+
+ if (aRequest.GetMethod() == HttpMethod::kGet)
+ {
+ GetCoprocessorVersion(aResponse);
+ }
+ else
+ {
+ ErrorHandler(aResponse, HttpStatusCode::kStatusMethodNotAllowed);
+ }
+}
+
void Resource::DeleteOutDatedDiagnostic(void)
{
auto eraseIt = mDiagSet.begin();
diff --git a/src/rest/resource.hpp b/src/rest/resource.hpp
index 788dcd87..7ee151fb 100644
--- a/src/rest/resource.hpp
+++ b/src/rest/resource.hpp
@@ -127,6 +127,7 @@ private:
void DatasetPending(const Request &aRequest, Response &aResponse) const;
void Diagnostic(const Request &aRequest, Response &aResponse) const;
void HandleDiagnosticCallback(const Request &aRequest, Response &aResponse);
+ void CoprocessorVersion(const Request &aRequest, Response &aResponse) const;

void GetNodeInfo(Response &aResponse) const;
void DeleteNodeInfo(Response &aResponse) const;
@@ -143,6 +144,7 @@ private:
void GetDataset(DatasetType aDatasetType, const Request &aRequest, Response &aResponse) const;
void SetDataset(DatasetType aDatasetType, const Request &aRequest, Response &aResponse) const;
void DeleteDataset(DatasetType aDatasetType, Response &aResponse) const;
+ void GetCoprocessorVersion(Response &aResponse) const;

void DeleteOutDatedDiagnostic(void);
void UpdateDiag(std::string aKey, std::vector<otNetworkDiagTlv> &aDiag);
diff --git a/tests/rest/test_rest.py b/tests/rest/test_rest.py
index b419c2d6..fdccf526 100644
--- a/tests/rest/test_rest.py
+++ b/tests/rest/test_rest.py
@@ -296,6 +296,14 @@ def node_ext_panid_check(data):
return True


+def node_coprocessor_version_check(data):
+ assert data is not None
+
+ assert (type(data) == str)
+
+ return True
+
+
def node_test(thread_num):
url = rest_api_addr + "/node"

@@ -406,6 +414,18 @@ def node_ext_panid_test(thread_num):
print(" /node/ext-panid : all {}, valid {} ".format(thread_num, valid))


+def node_coprocessor_version_test(thread_num):
+ url = rest_api_addr + "/node/coprocessor/version"
+
+ response_data = [None] * thread_num
+
+ create_multi_thread(get_data_from_url, url, thread_num, response_data)
+
+ valid = [node_coprocessor_version_check(data) for data in response_data].count(True)
+
+ print(" /node/coprocessor/version : all {}, valid {} ".format(thread_num, valid))
+
+
def diagnostics_test(thread_num):
url = rest_api_addr + "/diagnostics"

@@ -450,6 +470,7 @@ def main():
node_leader_data_test(200)
node_num_of_router_test(200)
node_ext_panid_test(200)
+ node_coprocessor_version_test(200)
diagnostics_test(20)
error_test(10)

--
2.46.0

5 changes: 5 additions & 0 deletions openthread_border_router/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 2.12.0
- Bump universal-silabs-flasher to 0.0.23
- Bump OTBR firmwares to latest versions
- Bump OTBR POSIX version 580cafc150 (2024-10-21 10:47:10 +0000)
frenck marked this conversation as resolved.
Show resolved Hide resolved

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add missing changelog entries for critical changes

The changelog should document all significant changes. Please add entries for:

  • Installation of dhcpcd
  • Changes to prefix delegation behavior
  • Setting of DHCPV6_PD_REF=0
  • New REST API endpoints for deleting operational datasets and retrieving coprocessor version

Additionally, the date format in the OTBR POSIX version line is inconsistent with previous entries (using +0000 instead of the standard -0700 format used in other entries).

Apply this diff to add the missing entries and fix the date format:

 ## 2.12.0
 - Bump universal-silabs-flasher to 0.0.23
 - Bump OTBR firmwares to latest versions
-  Bump OTBR POSIX version 580cafc150 (2024-10-21 10:47:10 +0000)
+- Bump OTBR POSIX version 580cafc150 (2024-10-21 03:47:10 -0700)
+- Add REST API endpoints for deleting operational datasets and retrieving coprocessor version
+- Install dhcpcd for prefix delegation support
+- Set DHCPV6_PD_REF=0 to ensure correct build
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## 2.12.0
- Bump universal-silabs-flasher to 0.0.23
- Bump OTBR firmwares to latest versions
- Bump OTBR POSIX version 580cafc150 (2024-10-21 10:47:10 +0000)
## 2.12.0
- Bump universal-silabs-flasher to 0.0.23
- Bump OTBR firmwares to latest versions
- Bump OTBR POSIX version 580cafc150 (2024-10-21 03:47:10 -0700)
- Add REST API endpoints for deleting operational datasets and retrieving coprocessor version
- Install dhcpcd for prefix delegation support
- Set DHCPV6_PD_REF=0 to ensure correct build

## 2.11.1

- Fix issue with USB TI CC2652 based devices
Expand Down
3 changes: 3 additions & 0 deletions openthread_border_router/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ ENV PLATFORM debian
ENV RELEASE 1
ENV WEB_GUI 1
ENV REST_API 1
ENV DHCPV6_PD_REF 0
ENV DOCKER 1

COPY 0001-support-deleting-the-dataset.patch /usr/src
COPY 0002-set-netif-route-metric-lower.patch /usr/src
COPY 0003-Implement-node-coprocessor-version.patch /usr/src
COPY 0001-channel-monitor-disable-by-default.patch /usr/src
# Required and installed (script/bootstrap) can be removed after build
ENV OTBR_BUILD_DEPS build-essential ninja-build cmake wget ca-certificates \
Expand Down Expand Up @@ -55,6 +57,7 @@ RUN \
&& ./script/bootstrap \
&& patch -p1 < /usr/src/0001-support-deleting-the-dataset.patch \
&& patch -p1 < /usr/src/0002-set-netif-route-metric-lower.patch \
&& patch -p1 < /usr/src/0003-Implement-node-coprocessor-version.patch \
&& ( \
cd third_party/openthread/repo \
&& patch -p1 < /usr/src/0001-channel-monitor-disable-by-default.patch \
Expand Down
4 changes: 2 additions & 2 deletions openthread_border_router/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ build_from:
aarch64: ghcr.io/home-assistant/aarch64-base-debian:bookworm
amd64: ghcr.io/home-assistant/amd64-base-debian:bookworm
args:
OTBR_VERSION: ff7227ea9a2dc0e50f92ab93bd5c9a29e82fe793
UNIVERSAL_SILABS_FLASHER: 0.0.22
OTBR_VERSION: b041fa52daaa4dfbf6aa4665d8925c1be0350ca5
UNIVERSAL_SILABS_FLASHER: 0.0.25
2 changes: 1 addition & 1 deletion openthread_border_router/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: 2.11.1
version: 2.12.0
slug: openthread_border_router
name: OpenThread Border Router
description: OpenThread Border Router add-on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fi
# Assume to run on Yellow if UART4 is mapped to ttyAMA1
if [ -d /sys/devices/platform/soc/fe201800.serial/tty/ttyAMA1 ] && [ "${device}" == "/dev/ttyAMA1" ]; then
bashio::log.info "Detected Home Assistant Yellow"
firmware="yellow_ot-rcp_2.4.0.0_GitHub-7074a43e4_gsdk_4.4.3.gbl"
firmware="yellow_openthread_rcp_2.4.4.0_GitHub-7074a43e4_gsdk_4.4.4.gbl"
gpio_reset_flag="--bootloader-reset yellow"
else
# Check device manufacturer/product information
Expand All @@ -52,9 +52,9 @@ else

bashio::log.info "Checking ${device} identifying ${usb_product} from ${usb_manufacturer}."
if [[ "${usb_manufacturer}" == "Nabu Casa" && "${usb_product}" == "SkyConnect"* ]]; then
firmware="skyconnect_ot-rcp_2.4.0.0_GitHub-7074a43e4_gsdk_4.4.3.gbl"
firmware="skyconnect_openthread_rcp_2.4.4.0_GitHub-7074a43e4_gsdk_4.4.4.gbl"
elif [[ "${usb_manufacturer}" == "Nabu Casa" && "${usb_product}" == "Home Assistant Connect ZBT-1"* ]]; then
firmware="skyconnect_ot-rcp_2.4.0.0_GitHub-7074a43e4_gsdk_4.4.3.gbl"
firmware="skyconnect_openthread_rcp_2.4.4.0_GitHub-7074a43e4_gsdk_4.4.4.gbl"
elif [[ "${usb_manufacturer}" == "ITEAD" && "${usb_product}" == "SONOFF Zigbee 3.0 USB Dongle Plus V2" ]]; then
firmware="ot-rcp-v2.4.2.0-zbdonglee-460800.gbl"
gpio_reset_flag="--bootloader-reset sonoff"
Expand Down
Binary file not shown.
Binary file not shown.