Skip to content

Worth taking a look at pyspinel CLI as a reference? #3

@Hedda

Description

@Hedda

While the pyspinel is not made for Zigbee but for OpenThread NCPs instead, concepts in the Spinel CLI might however still be interesting as it is a relatively mature CLI for an NCP and actively maintained so might cover a lot of the same wishlist that developers and users would want?

A Python CLI tool called "Pyspinel" is available for testing purposes (and it is an active project so still being developed):

https://openthread.io/guides/pyspinel

Pyspinel, available on the pyspinel GitHub repository, is a Python CLI for the Spinel protocol.

The Spinel CLI exposes the OpenThread configuration and management APIs running on an NCP build via a command line interface. Spinel CLI is primarily targeted for driving the automated continuous integration tests, and is suitable for manual experimentation with controlling OpenThread NCP instances.

Pyspinel is used to:

  • Add simulated Co-Processor testing to continuous integration.
  • Automate testing of testbeds running Co-Processor firmware on hardware.
  • Debug Co-Processor builds of OpenThread.
  • Convert an OpenThread Co-Processor into a packet sniffer.

Use the CLI to play with NCP builds of OpenThread on a Linux or Mac OS platform, including starting a basic tunnel interface to allow IPv6 applications to run on the HOST and use the Thread network.

The power of this tool is threefold:

  1. As a path to add testing of the NCP in simulation to continuous integration
  2. As a path to automated testing of testbeds running NCP firmware on hardware
  3. As a simple debugging tool for NCP builds of OpenThread

For more information, see the Internet-Draft for the Spinel Host-Controller Protocol:

https://datatracker.ietf.org/doc/html/draft-rquattle-spinel-unified

This full protocol source code is also included with OpenThread at /src/lib/spinel in openthread repo:

https://github.com/openthread/openthread/tree/master/src/lib/spinel

For a production grade host driver that uses the Spinel CLI , see the "wpantund" project:

https://github.com/openthread/wpantund

One specific concept it had is "Vendor package" extension of the Spinel CLI with custom properties and commands:

https://github.com/openthread/pyspinel#vendor-package

"This plugin-like extension adds vendor-specific commands and properties to pyspinel in a way that does not impact the implementation of core pyspinel functionalities."

Just noticed this when Elelabs (maker of the Elelabs and Popp Zigbee sticks) forked it and made a vendor package for it:

https://github.com/Elelabs/pyspinel/tree/elelabs/elelabs

With that they have started by including "btl", "data", and "help" as Elelabs Pyspinel vendor package commands:

https://github.com/Elelabs/pyspinel/blob/elelabs/elelabs/README.md

https://github.com/Elelabs/pyspinel/tree/elelabs/elelabs#btl

https://github.com/Elelabs/pyspinel/tree/elelabs/elelabs#data

https://github.com/Elelabs/pyspinel/tree/elelabs/elelabs#help

I guess that "MFG_LAUNCH_BOOTLOADER" command to could maybe be ported first as command to enter Silabs bootloader?

https://github.com/Elelabs/pyspinel/tree/elelabs/elelabs#elelabs-thread-spinel-commands

"Launch Bootloader NCP command. Causes the NCP to perform a software reset and enter XMODEM bootloader mode"

$ cd <path-to-pyspinel>
$ spinel-cli.py -u /dev/ttyS1 -b 115200 --vendor-path=elelabs
spinel-cli > version
SL-OPENTHREAD/1.1.2.0_GitHub-5c2ad91cf; EFR32; Jun 16 2021 22:54:45
Done
spinel-cli > vendor data
Elelabs
Done
ELU013
Done
spinel-cli > vendor btl
spinel-cli > exit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions