* ncp: Added spinel-cli and initial travis CI test suite integration.
This PR adds a command line tool, named spinel-cli, that converts ot-cli shell commands (as documented in https://github.com/openthread/openthread/blob/master/src/cli/README.md) to spinel NCP commands (as documented in https://github.com/openthread/openthread/blob/master/src/ncp/PROTOCOL.md).
Also added is a patch to node.py that provides a way to run the existing continuous integration certification test suite against an NCP build rather than a CLI build (by prefacing the command to start the test with the environment variable setting NODE_TYPE=ncp-sim):
cd tests/scripts/thread-cert
NODE_TYPE=ncp-sim top_builddir=../../.. python Cert_5_1_02_ChildAddressTimeout.py
The power of this tool is three fold:
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
openthread$ cd tools/spinel-cli/
spinel-cli$ ./spinel-cli.py
Opening pipe to ../../examples/apps/ncp/ot-ncp 1
spinel-cli > help
Available commands (type help <name> for more information):
============================================================
channel extaddr mode route
child extpanid netdataregister router
childtimeout h networkidtimeout routerupgradethreshold
clear help networkname scan
contextreusedelay history panid state
counter ifconfig ping thread
debug ipaddr prefix v
debug-term keysequence q version
eidcache leaderdata quit whitelist
enabled leaderweight releaserouterid
exit masterkey rloc16
spinel-cli > version
OPENTHREAD/gd4d4e9d-dirty; Aug 11 2016 14:40:44
Done
spinel-cli > thread start
Done
spinel-cli > state
leader
Done
spinel-cli >
The tool provides three ways to connect to an NCP image:
1) pipe to stdin/stdout of a command line tool (default): -p ./ot-ncp
2) serial connection to a hardware device: -u /dev/ttyUSB0
3) socket connection to the port of a helper tool such as ncp-spi-driver: -s 1234
spinel-cli$ ./spinel-cli.py --help
Options:
-h, --help show this help message and exit
-u UART, --uart=UART
-p PIPE, --pipe=PIPE
-s SOCKET, --socket=SOCKET
-n NODEID, --nodeid=NODEID
-q, --quiet
-v, --verbose
* update poll data period to 15s to keep consistent with other vendors.
* fix return value of isOpenThreadRunning().
* set ROUTER_UPGRADE_THRESHOLD to 32 for Leader/Router to support maximum active routers in network.
* do not send server data ntf proactively if prefx configured before starting openthread stack.
* Add new commissionerUnregsiter() method to ensure compile pass temporarily.
* Return None instead of first configured global IPv6 unicast address if
parameter 'filterPrefix' does not match with any of GUAs on thread interface.
* Add new Device Role MED/FED support in joinNetwork()
* Set default data poll rate for sleepy end device to 10s
* Add forceSetSlaac() method support
* Add 'int' type parameter support in removeRouter() for AUTO DUT
* Update README.md with 'pexpect' dependency module
This commit includes some revisions to the spinel protocol, including
the addition of several new properties. It also includes some minor
updates to the SPI protocol, which should reduce ambiguity.
The new properties haven't been implemented in `ncp_base.cpp` yet,
but that will be comming soon.
`syslog()` and `fprintf()` are not async-signal-safe. They can (and
do) cause deadlocks under various circumstances.
This change replaces the calls to these functions with calls to
`write()`. It also adds a watchdog of sorts to the `signal_critical()`
handler to make sure that even if we call some functions that
are not async-signal-safe that we will at least terminate eventually.
This commit makes sure that the specified delay period between
the assertion of C̅S̅ and the start of the SPI clock is enforced.
In order for this to work, both the delay part and the data part
must be in the same `ioctl()` call. The previous code (which used
two `ioctl()` calls) was entirely broken.
The trick is that not all Linux SPI drivers support multi-part
SPI transactions. When `spi-hdlc-adapter` is used with such
devices, the `--spi-cs-delay=0` argument must be added. This causes
the delay part of the transaction to be omitted entirely.
This change contains changes to both `ncp_spi.*` and
`spi-hdlc-adapter.c`, based on experience with using both on actual
hardware. These changes fix a handful of critical bugs and also adds a
work-around (`--spi-align-allowance`) for naughty SPI-slave hardware.
A more through code review with @abtink revealed several bugs
in the previous implementation. This commit addresses these issues.
Additional changes will likely be necessary once we are able to test.
`spi-hdlc-adapter` is an adapter tool for using a SPI interface as if
it were an HDLC-lite encoded bidirectional asynchronous serial stream.
It uses the SPI protocol outlined in [Appendix A.2][1] of the Spinel
protocol document.
Note that since we don't have a slave implementation of this protocol,
this adapter hasn't been well tested yet. You have to start somewhere.
[1]: https://goo.gl/bwHt5r