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 joiner to commissioner joiner table and get status of joiner … #2517

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Commits on Sep 30, 2024

  1. [rest] add joiner to commissioner joiner table, get status of joiner …

    …by indirect 'addThreadDeviceTask' processing
    
    This commit implements
    - POST `addThreadDeviceTask` on api/actions/
    - GET api/actions/<actionId>
    - DELETE api/actions
    
    The commit also provides integration tests, see tests/restjsonapi.
    
    Please follow the following steps to install/build OTBR.
    
    1. Checkout this PR
    
    2. Build and Install OTBR as usual, e.g. on a Raspberry Pi
    
    3. Restart the OTBR. `sudo systemctl restart otbr-agent`
    
    4. To monitor the log [Errors|Warnings|Info] please open a different terminal instance and use following command:
    
    ```
    tail -f /var/log/syslog | grep otbr
    ```
    
    5. Send POST request using BRUNO or CURL, e.g. to join a new device into your network.
    
    ```
    curl -X POST -H 'Content-Type: application/vnd.api+json' http://localhost:8081/api/actions -d '{"data": [{"type": "addThreadDeviceTask", "attributes": {"eui": "6234567890AACDEA", "pskd": "J01NME", "timeout": 3600}}]}' | jq
    ```
    
    should return
    
    ```
    {
      "data": [
        {
          "id": "2d5a8844-b1bc-4f02-93f0-d87b8c3b4e92",
          "type": "addThreadDeviceTask",
          "attributes": {
            "eui": "6234567890AACDEB",
            "pskd": "J01NME",
            "timeout": 3600,
            "status": "pending"
          },
        }
      ]
    }
    ```
    
    6. You may check the status and get the full collection of actions.
    
    ```
    curl -X GET -H 'Accept: application/vnd.api+json' http://localhost:8081/api/actions | jq
    ```
    
    should return
    
    ```
    {
      "data": [
        {
          "id": "2d5a8844-b1bc-4f02-93f0-d87b8c3b4e92",
          "type": "addThreadDeviceTask",
          "attributes": {
            "eui": "6234567890AACDEB",
            "pskd": "J01NME",
            "timeout": 3600,
            "status": "pending"
          }
        }
      ],
      "meta": {
        "collection": {
          "offset": 0,
          "limit": 100,
          "total": 1
        }
      }
    }
    ```
    
    7. View the entry added to the commissioner's table `sudo ot-ctl commissioner joiner table` and expect
    
    ```
    | ID                    | PSKd                             | Expiration |
    +-----------------------+----------------------------------+------------+
    |      6234567890aacdea |                           J01NME |    3459027 |
    Done
    ```
    
    8. Start your joiner and after a few seconds repeat above steps 6. and 7.
    
    9. For running the included test script install Bruno-Cli and run the bash script on your border router
    
    ```
    cd tests/restjsonapi
    source ./install_bruno_cli
    ./test-restjsonapi-server
    ```
    martinzi committed Sep 30, 2024
    Configuration menu
    Copy the full SHA
    594a975 View commit details
    Browse the repository at this point in the history

Commits on Nov 5, 2024

  1. [rest] add api/actions 'addThreadDeviceTask' in openapi.yaml specific…

    …ation
    
    also includes bug fixes.
    martinzi committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    3c37296 View commit details
    Browse the repository at this point in the history