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

Conversation

puddly
Copy link
Collaborator

@puddly puddly commented Oct 21, 2024

@agners I've also bumped OTBR itself. It looks like dhcpcd is now installed and prefix delegation is in use, probably for Thread 1.4. Is this something we want to disable?

Summary by CodeRabbit

Release Notes for Version 2.12.0

  • New Features

    • Enhanced OTBR discovery process with additional configuration parameters for improved device and firmware information.
    • Support for auto firmware updates for specific devices.
  • Updates

    • Universal SiLabs flasher updated to version 0.0.25.
    • OTBR firmware versions updated to the latest releases.
    • Configuration files updated to reflect the new version 2.12.0.
    • Radio firmware version added to discovery information.
  • Bug Fixes

    • Resolved issues with log output buffering and ipset errors when the firewall is disabled.

@puddly
Copy link
Collaborator Author

puddly commented Oct 21, 2024

I've set DHCPV6_PD_REF=0 in this PR for now to at least get it building. Untested.

@agners
Copy link
Member

agners commented Oct 21, 2024

It looks like dhcpcd is now installed and prefix delegation is in use, probably for Thread 1.4. Is this something we want to disable?

What do yo mean by "dhcpcd is now installed"? With this change? We don't really use the regular installation script with the add-on, so I don't think that gets installed just like that no?

Afaik, dhcpcd was an option since a while.

Hm, Apple BRs use PD addresses already since a while, even with Thread 1.3. Not sure if this is directly related to 1.4.

@puddly
Copy link
Collaborator Author

puddly commented Oct 21, 2024

so I don't think that gets installed just like that no?

It's installed by bootstrap, which we run: https://github.com/openthread/ot-br-posix/blob/580cafc150946bc418aa6790a416bd2c951bae24/script/bootstrap#L110-L121

@agners
Copy link
Member

agners commented Oct 24, 2024

It's installed by bootstrap, which we run: https://github.com/openthread/ot-br-posix/blob/580cafc150946bc418aa6790a416bd2c951bae24/script/bootstrap#L110-L121

Hm, I see that changed just recently with openthread/ot-br-posix@3b145fa. We could opt-out of PD at this point, which might make sense.

I think there are two things we need to decide here:
a) Do we want to update to Thread 1.4 (e.g. set OT_THREAD_VERSION=1.4)
b) Do we want to enable IPv6 PD by default

I tend to say no to b). For a) I am a bit less certain. I'll check what setting Thread version to 1.4 exactly entails.

openthread_border_router/Dockerfile Outdated Show resolved Hide resolved
@puddly
Copy link
Collaborator Author

puddly commented Nov 14, 2024

I've reverted the advertised Thread version back to 1.3 and included the OTBR coprocessor version API patch.

@agners agners marked this pull request as ready for review November 14, 2024 18:01
Copy link
Contributor

coderabbitai bot commented Nov 14, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes in this pull request include updates to the OpenThread Border Router (OTBR) components, with a new version entry for 2.12.0 added to the changelog, reflecting various enhancements and fixes. The Dockerfile introduces a new environment variable, while the build configuration files update specific version numbers for the OTBR and the Universal Silabs Flasher. Additionally, firmware version strings in scripts have been updated for specific devices, and new parameters have been added to a discovery script to enhance information sent to Home Assistant.

Changes

File Path Change Summary
openthread_border_router/CHANGELOG.md Added new version entry ## 2.12.0, detailing updates and fixes including firmware and log enhancements.
openthread_border_router/Dockerfile Added new environment variable: ENV DHCPV6_PD_REF 0.
openthread_border_router/build.yaml Updated OTBR_VERSION from ff7227ea9a2dc0e50f92ab93bd5c9a29e82fe793 to b041fa52daaa4dfbf6aa4665d8925c1be0350ca5 and UNIVERSAL_SILABS_FLASHER from 0.0.22 to 0.0.25.
openthread_border_router/config.yaml Updated version from 2.11.1 to 2.12.0.
openthread_border_router/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up Updated firmware version strings for Home Assistant Yellow and Nabu Casa USB devices.
openthread_border_router/rootfs/etc/s6-overlay/scripts/otbr-agent-rest-discovery.sh Added new fields device and firmware to the JSON object for OTBR discovery.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant OTBR
    participant HomeAssistant

    User->>OTBR: Request device discovery
    OTBR->>OTBR: Retrieve configuration
    OTBR->>OTBR: Get firmware version
    OTBR->>HomeAssistant: Send discovery information (device, firmware)
    HomeAssistant-->>OTBR: Acknowledge discovery
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d4d12ca and bc15777.

📒 Files selected for processing (1)
  • openthread_border_router/CHANGELOG.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
openthread_border_router/CHANGELOG.md (6)

Pattern */**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'

Pattern */**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.

Pattern */**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"


Pattern */**(html|markdown|md): - Use sentence-style capitalization also in headings.


Pattern */**(html|markdown|md): do not comment on HTML used for icons


Pattern */**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

🔇 Additional comments (1)
openthread_border_router/CHANGELOG.md (1)

6-6: Verify the OTBR POSIX version commit hash and timestamp

Let's verify that the OTBR POSIX version commit hash and timestamp are accurate.

✅ Verification successful

OTBR POSIX version commit hash and timestamp are accurate

The commit hash b041fa52daa in the changelog corresponds to a real commit in the ot-br-posix repository with timestamp "2024-11-14T16:18:28Z", which matches the changelog entry's timestamp "2024-11-14 08:18:28 -0800" (both represent the same moment in different time zones).

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the OTBR POSIX version commit hash and timestamp

# Test: Search for the commit hash in the repository
gh api repos/openthread/ot-br-posix/commits/b041fa52daa --jq '.commit.committer.date' || echo "Commit not found"

Length of output: 106


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (9)
openthread_border_router/0002-set-netif-route-metric-lower.patch (1)

4-9: LGTM! Well-documented routing preference change.

The commit message clearly explains the rationale for setting a lower route metric. This is an important architectural change that affects route selection.

Consider testing this change with:

  • Different NetworkManager configurations
  • Various network topologies
  • Multiple border routers in the same network
openthread_border_router/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up (1)

35-35: Consider documenting firmware compatibility matrix

Given the version disparity between devices (2.4.4.0 for Yellow/SkyConnect vs 2.4.2.0 for SONOFF/SMLIGHT), it would be helpful to document the compatibility matrix and any known limitations.

Consider adding a comment block at the top of the script documenting:

  • Supported firmware versions for each device
  • Known compatibility issues
  • Reasons for version differences across devices

Also applies to: 55-55, 57-57

openthread_border_router/0001-support-deleting-the-dataset.patch (3)

Line range hint 21-60: OpenAPI specification needs minor improvements.

  1. Fix typo in descriptions: "Deletes the the" should be "Deletes the"
  2. Add missing 500 error response to align with implementation

Apply this diff to fix the issues:

       description: |-
-        Deletes the the active operational dataset on the current node. Only allowed if the Thread node
+        Deletes the active operational dataset on the current node. Only allowed if the Thread node
         is inactive.
       responses:
         "200":
           description: Successfully deleted the active operational dataset.
         "409":
           description: Deleting active operational dataset rejected because Thread network is active.
+        "500":
+          description: Internal server error occurred while deleting the dataset.

Similar changes needed for the pending dataset endpoint.


Line range hint 60-111: Fix typo in response code setter and enhance error handling.

  1. The method name has a typo: SetResponsCode should be SetResponseCode
  2. The error handling could be more specific about what failed

Apply this diff to improve the implementation:

-    aResponse.SetResponsCode(errorCode);
+    aResponse.SetResponseCode(errorCode);

     if (error == OTBR_ERROR_INVALID_STATE)
     {
-        ErrorHandler(aResponse, HttpStatusCode::kStatusConflict);
+        ErrorHandler(aResponse, HttpStatusCode::kStatusConflict, "Thread network must be disabled to delete active dataset");
     }
     else if (error != OTBR_ERROR_NONE)
     {
-        ErrorHandler(aResponse, HttpStatusCode::kStatusInternalServerError);
+        ErrorHandler(aResponse, HttpStatusCode::kStatusInternalServerError, "Failed to set dataset TLVs");
     }

Line range hint 112-124: Add documentation for the new method.

Consider adding documentation to describe the method's purpose, parameters, and error conditions.

Add this documentation above the method declaration:

+    /**
+     * Deletes the active or pending operational dataset.
+     *
+     * @param[in]  aDatasetType  The type of dataset to delete (active or pending).
+     * @param[out] aResponse     The response to return to the client.
+     */
     void DeleteDataset(DatasetType aDatasetType, Response &aResponse) const;
openthread_border_router/0003-Implement-node-coprocessor-version.patch (4)

79-80: Remove unused variable 'errorCode' in 'CoprocessorVersion' method

The variable errorCode is declared but not used in the CoprocessorVersion method. Consider removing it to clean up the code.

Apply this diff to remove the unused variable:

     void Resource::CoprocessorVersion(const Request &aRequest, Response &aResponse) const
     {
-        std::string errorCode;

         if (aRequest.GetMethod() == HttpMethod::kGet)

21-35: Consider returning the version in a JSON object for consistency

The /node/coprocessor/version endpoint currently returns a raw string. For consistency with other API endpoints and to allow for future extensibility, consider returning the version string within a JSON object.

Modify the OpenAPI specification accordingly:

             application/json:
               schema:
-                type: string
-                description: Coprocessor version string
-                example: "OPENTHREAD/20210309-00615-g9836b6f18; NRF52840; Mar 9 2021 13:30:04"
+                type: object
+                properties:
+                  version:
+                    type: string
+                    description: Coprocessor version string
+                    example: "OPENTHREAD/20210309-00615-g9836b6f18; NRF52840; Mar 9 2021 13:30:04"

66-75: Add error handling for failed version retrieval

Currently, there's no error handling if GetCoprocessorVersion() fails or returns an empty string. Consider adding error handling to return an appropriate error response.

For example:

     coprocessorVersion = mHost->GetCoprocessorVersion();
+    if (coprocessorVersion.empty())
+    {
+        ErrorHandler(aResponse, HttpStatusCode::kStatusInternalServerError, "Failed to retrieve coprocessor version");
+        return;
+    }
     coprocessorVersion = Json::String2JsonString(coprocessorVersion);

     aResponse.SetBody(coprocessorVersion);

122-128: Enhance test validation for coprocessor version

The test currently checks only that the version is a string. Consider adding validation to ensure the version string contains expected patterns or substrings.

Apply this diff to enhance the test:

 def node_coprocessor_version_check(data):
     assert data is not None

-    assert (type(data) == str)
+    assert isinstance(data, str)
+    # Check that the version string contains expected substrings
+    expected_substrings = ["OPENTHREAD", "NRF"]
+    for substring in expected_substrings:
+        assert substring in data.upper()

     return True
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d678e93 and d883e81.

📒 Files selected for processing (8)
  • openthread_border_router/0001-support-deleting-the-dataset.patch (4 hunks)
  • openthread_border_router/0002-set-netif-route-metric-lower.patch (2 hunks)
  • openthread_border_router/0003-Implement-node-coprocessor-version.patch (1 hunks)
  • openthread_border_router/CHANGELOG.md (1 hunks)
  • openthread_border_router/Dockerfile (2 hunks)
  • openthread_border_router/build.yaml (1 hunks)
  • openthread_border_router/config.yaml (1 hunks)
  • openthread_border_router/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • openthread_border_router/config.yaml
🧰 Additional context used
📓 Path-based instructions (6)
openthread_border_router/0001-support-deleting-the-dataset.patch (6)

Pattern */**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'

Pattern */**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.

Pattern */**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"


Pattern */**(html|markdown|md): - Use sentence-style capitalization also in headings.


Pattern */**(html|markdown|md): do not comment on HTML used for icons


Pattern */**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

openthread_border_router/0002-set-netif-route-metric-lower.patch (6)

Pattern */**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'

Pattern */**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.

Pattern */**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"


Pattern */**(html|markdown|md): - Use sentence-style capitalization also in headings.


Pattern */**(html|markdown|md): do not comment on HTML used for icons


Pattern */**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

openthread_border_router/0003-Implement-node-coprocessor-version.patch (6)

Pattern */**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'

Pattern */**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.

Pattern */**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"


Pattern */**(html|markdown|md): - Use sentence-style capitalization also in headings.


Pattern */**(html|markdown|md): do not comment on HTML used for icons


Pattern */**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

openthread_border_router/CHANGELOG.md (6)

Pattern */**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'

Pattern */**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.

Pattern */**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"


Pattern */**(html|markdown|md): - Use sentence-style capitalization also in headings.


Pattern */**(html|markdown|md): do not comment on HTML used for icons


Pattern */**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

openthread_border_router/Dockerfile (6)

Pattern */**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'

Pattern */**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.

Pattern */**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"


Pattern */**(html|markdown|md): - Use sentence-style capitalization also in headings.


Pattern */**(html|markdown|md): do not comment on HTML used for icons


Pattern */**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

openthread_border_router/build.yaml (6)

Pattern */**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'

Pattern */**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.

Pattern */**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"


Pattern */**(html|markdown|md): - Use sentence-style capitalization also in headings.


Pattern */**(html|markdown|md): do not comment on HTML used for icons


Pattern */**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

🔇 Additional comments (10)
openthread_border_router/build.yaml (2)

6-6: Verify OTBR version changes and implications

Given the discussions about Thread 1.4 and prefix delegation in the PR, we should verify the changes in this OTBR commit.

#!/bin/bash
# Description: Analyze changes in the OTBR commit and its implications

# Fetch the commit details from OpenThread Border Router repository
gh api repos/openthread/ot-br-posix/commits/b041fa52daaa4dfbf6aa4665d8925c1be0350ca5 | jq -r '.commit.message'

# Check for Thread version related changes
gh api repos/openthread/ot-br-posix/compare/ff7227ea9a2dc0e50f92ab93bd5c9a29e82fe793...b041fa52daaa4dfbf6aa4665d8925c1be0350ca5 | \
  jq -r '.files[].patch' | grep -i "thread.*version"

# Check for dhcpcd related changes
gh api repos/openthread/ot-br-posix/compare/ff7227ea9a2dc0e50f92ab93bd5c9a29e82fe793...b041fa52daaa4dfbf6aa4665d8925c1be0350ca5 | \
  jq -r '.files[].patch' | grep -i "dhcpcd"

7-7: Verify Universal Silabs Flasher changelog

The version bump from 0.0.22 to 0.0.25 needs verification of changes and compatibility.

openthread_border_router/0002-set-netif-route-metric-lower.patch (1)

Line range hint 106-106: Verify the route metric value across configurations.

The chosen metric of 64 provides good separation from the NDP-learned routes (128), but we should verify this works consistently.

✅ Verification successful

Route metric configuration is appropriate and verified

The metric value of 64 is correctly chosen as it:

  • Is lower than the NDP-learned routes (128) as required
  • Is documented in the changelog (v2.4.4) as fixing device reachability issues when operating with other TBRs
  • No conflicting metric configurations were found in the codebase
  • The change is properly integrated via the patch system and CMake configuration
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for other route metric configurations that might conflict

# Look for other route metric definitions
rg -l "NETIF_PREFIX_ROUTE_METRIC|route[^a-zA-Z].*metric" 

# Look for NetworkManager configuration files that might override metrics
fd -e conf -e yaml -e ini | xargs rg "metric"

Length of output: 243


Script:

#!/bin/bash
# Let's examine the actual content of these files to understand the metric configurations

# Check the patch file first
cat openthread_border_router/0002-set-netif-route-metric-lower.patch

# Check Dockerfile for any metric configurations
cat openthread_border_router/Dockerfile

# Check CHANGELOG for any relevant history
cat openthread_border_router/CHANGELOG.md

# Let's also search for any numeric values near route configurations that might be metrics
rg -A 2 -B 2 'route.*[0-9]+' openthread_border_router/

Length of output: 12112

openthread_border_router/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up (2)

35-35: Verify version consistency and potential breaking changes

The firmware updates introduce significant changes:

  1. Version bump from 2.4.0.0 to 2.4.4.0
  2. GSDK update from 4.4.3 to 4.4.4
  3. Naming convention change from 'ot-rcp' to 'openthread_rcp'

Note that SONOFF and SMLIGHT devices remain at version 2.4.2.0, creating a version disparity across devices.

Let's verify the version compatibility and changelog:

Also applies to: 55-55, 57-57

✅ Verification successful

Version update is consistent and part of planned upgrade

Based on the changelog and firmware version checks:

  1. The firmware update from 2.4.0.0 to 2.4.4.0 is part of a planned upgrade in OTBR version 2.12.0 that "Bumps OTBR firmwares to latest versions"
  2. The version change is consistent across Yellow, SkyConnect, and Connect ZBT-1 devices
  3. SONOFF and SMLIGHT devices remain at 2.4.2.0 as they use different hardware platforms and firmware variants (indicated by different baudrates and reset flags)
  4. The naming convention change from 'ot-rcp' to 'openthread_rcp' is consistent with the firmware upgrade
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for breaking changes in firmware versions

# Search for version references in the codebase
echo "=== Searching for version references ==="
rg "2\.4\.[0-4]\.[0-9]" -A 2

# Look for migration guides or breaking changes
echo -e "\n=== Searching for migration or breaking changes documentation ==="
fd -g "*CHANGELOG*" -g "*README*" -g "*BREAKING*" -X rg -i "2\.4\.[0-4]|breaking|migration"

Length of output: 8579


Script:

#!/bin/bash
# Let's check for version references specifically in the firmware files and configuration
echo "=== Checking firmware versions in universal-silabs-flasher-up ==="
rg -A 2 "firmware=" openthread_border_router/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up

echo -e "\n=== Checking OpenThread Border Router changelog ==="
cat openthread_border_router/CHANGELOG.md

echo -e "\n=== Looking for version compatibility documentation ==="
fd -g "README.md" -g "DOCS.md" -X rg -i "version|compatibility|requirement" openthread_border_router/

Length of output: 7071


35-35: Verify impact of naming convention change

The firmware naming pattern has changed from ot-rcp to openthread_rcp. This change should be verified against any external tools or documentation that might reference these files.

Let's check for potential impacts:

Also applies to: 55-55, 57-57

✅ Verification successful

Let me generate additional scripts to specifically search for any references to the old naming pattern in configuration files and scripts:


Let me try one final search with corrected commands:


No impact from firmware naming convention change

The change from ot-rcp to openthread_rcp in the firmware name is localized and properly handled. The script shows that:

  • The new naming convention is consistently used for Yellow/SkyConnect devices (yellow_openthread_rcp_2.4.4.0_GitHub-7074a43e4_gsdk_4.4.4.gbl)
  • The old ot-rcp prefix is still maintained for specific third-party devices (SONOFF, SMLIGHT)
  • All firmware files are properly referenced in the script and exist in the filesystem
  • No external tools or documentation directly reference the specific firmware filenames
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for references to the old naming convention

# Search for old naming pattern references
echo "=== Searching for old firmware naming pattern ==="
rg "ot-rcp" --type yaml --type md --type sh

# Check if any documentation needs updating
echo -e "\n=== Checking documentation for firmware references ==="
fd -e md -e rst -X rg -i "firmware|ot-rcp|openthread.*rcp"

Length of output: 8579


Script:

#!/bin/bash
# Search for any references to the old and new firmware naming patterns
echo "=== Searching for firmware naming patterns in scripts and configs ==="
rg -i "yellow.*rcp.*gbl|ot-rcp|openthread.*rcp" --type=sh --type=conf --type=yaml

# Search specifically in the universal-silabs-flasher directory
echo -e "\n=== Checking universal-silabs-flasher directory ==="
fd . openthread_border_router/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher -X rg -i "firmware|rcp"

# Check for any GBL firmware references
echo -e "\n=== Checking for GBL firmware references ==="
rg "\.gbl" --type=sh --type=conf --type=yaml

Length of output: 839


Script:

#!/bin/bash
# Search for firmware patterns in all files
echo "=== Searching for firmware patterns ==="
rg -i "yellow.*rcp.*gbl|ot-rcp|openthread.*rcp"

# Check the specific file content
echo -e "\n=== Checking the specific file content ==="
cat openthread_border_router/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up

# Search for .gbl files
echo -e "\n=== Searching for .gbl files ==="
fd -e gbl

Length of output: 5474

openthread_border_router/Dockerfile (3)

22-22: LGTM: New patch follows established patterns

The addition of the coprocessor version API patch follows the existing patch naming convention and is properly sequenced in the Dockerfile.


60-60: LGTM: Patch application is properly sequenced

The new patch is applied at the correct point in the build process, maintaining consistency with the existing patch application pattern.


17-17: Document and test the DHCPV6_PD_REF setting

The environment variable is set to disable IPv6 prefix delegation, which aligns with the discussion. However, this setting is noted as untested in the PR description.

Please verify the impact of this setting:

openthread_border_router/0001-support-deleting-the-dataset.patch (2)

1-13: Well-structured commit message with clear explanation.

The commit message effectively communicates the feature addition, constraints, and subsequent usage patterns.


Line range hint 1-124: Verify authentication for DELETE endpoints.

Since this adds destructive operations, we should ensure proper authentication is in place.

Comment on lines 3 to 7
## 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)

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

+
+ 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);

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d883e81 and d4d12ca.

📒 Files selected for processing (2)
  • openthread_border_router/Dockerfile (1 hunks)
  • openthread_border_router/rootfs/etc/s6-overlay/scripts/otbr-agent-rest-discovery.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • openthread_border_router/Dockerfile
🔇 Additional comments (2)
openthread_border_router/rootfs/etc/s6-overlay/scripts/otbr-agent-rest-discovery.sh (2)

10-10: LGTM: Device configuration field added correctly

The device information is properly retrieved using the bashio configuration helper.


Line range hint 1-24: Verify script execution timing

Since this script retrieves the RCP firmware version, we should ensure it runs after the OTBR initialization is complete.

✅ Verification successful

Script execution timing is properly managed

The verification shows that the script's execution timing is correctly handled through the s6-overlay system:

  • The script is only enabled when OTBR is enabled (controlled by otbr-enable-check.sh)
  • It runs as a separate service after the main otbr-agent is up, as evidenced by:
    • The script using ot-ctl which requires the OTBR socket to be available
    • The presence of a readiness check that verifies the OTBR socket exists before proceeding (test -S /run/openthread-wpan0.sock)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if there are any dependencies or ordering in the s6-overlay configuration

# Look for service dependencies and startup order
fd -t f . /etc/s6-overlay/s6-rc.d/ -x grep -l "otbr-agent-rest-discovery" {} \;

# Check if there's a longrun service definition
fd -t f "run" /etc/s6-overlay/s6-rc.d/ -x grep -l "ot-ctl" {} \;

Length of output: 372


Script:

#!/bin/bash
# Let's check the repository structure first to locate s6 service definitions
fd -t d "s6-" .

# Then look for any files related to otbr-agent or service dependencies
fd -t f . -x grep -l "otbr-agent|ot-ctl" {} \;

# Check if the script is referenced in any other files
rg "otbr-agent-rest-discovery" -l

Length of output: 1491


Script:

#!/bin/bash
# Let's check the content of the service definitions to understand dependencies
cat openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent-rest-discovery/up

# Check for otbr-agent service definition
fd -t f . openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/ -x cat {} \; | grep -A 5 "otbr-agent"

# Check the enable check script for additional context
cat silabs-multiprotocol/rootfs/etc/s6-overlay/scripts/otbr-enable-check.sh

Length of output: 3380

@@ -7,6 +7,8 @@ declare config
config=$(bashio::var.json \
host "$(bashio::addon.hostname)" \
port "^8081" \
device "$(bashio::config 'device')" \
firmware "$(ot-ctl rcp version | head -n 1)" \
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add error handling for firmware version retrieval

The current implementation might fail silently if ot-ctl is not available or returns an error. Consider adding error handling and validation.

Here's a suggested improvement:

-    firmware "$(ot-ctl rcp version | head -n 1)" \
+    firmware "$(if output=$(ot-ctl rcp version 2>/dev/null); then echo "$output" | head -n 1; else echo "unknown"; fi)" \

This change will:

  1. Capture potential errors from ot-ctl
  2. Return "unknown" if the command fails
  3. Prevent the JSON construction from failing due to command errors
📝 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
firmware "$(ot-ctl rcp version | head -n 1)" \
firmware "$(if output=$(ot-ctl rcp version 2>/dev/null); then echo "$output" | head -n 1; else echo "unknown"; fi)" \

Copy link
Member

@agners agners left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

openthread_border_router/CHANGELOG.md Outdated Show resolved Hide resolved
@frenck frenck merged commit 5a91f7a into home-assistant:master Nov 15, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants