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

[rest] Add REST JSON:API for commissioner and diagnostics #2514

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

martinzi
Copy link
Contributor

@martinzi martinzi commented Sep 27, 2024

In this PR, we propose an extended REST API functionality providing capabilities for commissioning and on-mesh diagnostics to generic off-mesh http clients. The implementation is guided by the JSON:API specification and provides following parts

  • api/node - pointing to api/devices/thisdevice
  • api/devices - a collection of discovered devices
  • api/actions - indirect processing of tasks, in particular for those that may need more time
    • addThreadDeviceTask - starts the on-mesh commissioner and adds the joiner candidate into the joiner table
    • getNetworkDiagnosticTask - sends diagnostic requests and diagnostic queries to the destination
    • resetNetworkDiagCounterTask - resets the network diagnostic mle and/or mac counter
    • getEnergyScanTask - starts the commissioner and sends energy scan requests to the destination
  • api/diagnostics
    • networkDiagnostic - all the Diagnostic TLV details
    • energyScanReport - results of energy scans

The PR provides integration tests for local validation, see tests/restjsonapi.

The Readme provides more details and descriptions in src/rest/extensions/README.md.

- api/node
- api/devices
- api/actions
    . addThreadDeviceTask
    . getNetworkDiagnosticsTask
    . resetNetworkDiagCounterTask
    . getEnergyScanTask
- api/diagnostics
    . networkDiagnostic
    . energyScanReport

The commit also provides integration tests, see tests/restjsonapi.
For more details see Readme in src/rest/extensions.
Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 39.33%. Comparing base (2b41187) to head (6c1622b).
Report is 816 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2514       +/-   ##
===========================================
- Coverage   55.77%   39.33%   -16.44%     
===========================================
  Files          87       92        +5     
  Lines        6890    10275     +3385     
  Branches        0      745      +745     
===========================================
+ Hits         3843     4042      +199     
- Misses       3047     6032     +2985     
- Partials        0      201      +201     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@martinzi
Copy link
Contributor Author

Happy to discuss thoughts and improvements. Note: we will add a commit fixing the broken topology browser in otbr-web service asap.

@wgtdkp
Copy link
Member

wgtdkp commented Sep 30, 2024

It looks #2515 is also adding the REST commissioner API.

@wgtdkp
Copy link
Member

wgtdkp commented Sep 30, 2024

Happy to discuss thoughts and improvements. Note: we will add a commit fixing the broken topology browser in otbr-web service asap.

@martinzi Thanks for this contribution! But this PR is about 12K lines of change that it's too hard to review. Could you help split this PR by creating a separate smaller PR for each feature? For example, one PR for commissioner API and another PR for network diagnostic.

@martinzi
Copy link
Contributor Author

@martinzi Thanks for this contribution! But this PR is about 12K lines of change that it's too hard to review. Could you help split this PR by creating a separate smaller PR for each feature? For example, one PR for commissioner API and another PR for network diagnostic.

Agree, it became quite large. See a first part split into PR2517. More to follow ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants