445 Commits

Author SHA1 Message Date
Martin Turon 3ea74a1977 ncp: Added sniffer host tool. (#773)
*     ncp: Added sniffer host tool.

    Split spinel-cli out into a general spinel python library module.
    Added sniffer.py tool that leverages the spinel library module.
    Added some initial unit tests of spinel.py module using MockStream.

    From openthread root:

    ./tools/spinel-cli/sniffer.py -c 11 -n 1 -u /dev/ttyUSB0 | wireshark -k -i -
2016-10-14 15:08:59 -07:00
Lu Wang 7fe4ee6d29 THCI: set active operational dataset (#793) 2016-10-12 09:25:52 -07:00
Shu Chen 10f9204da2 THCI: start commissioner before adding joiner's data (#777) 2016-10-09 12:26:46 -07:00
Xiao Ma 75e7882e87 THCI: update thci with allowCommission() and setActiveTimestamp(). (#776) 2016-10-08 22:29:56 -07:00
Lu Wang 78bc4a245a Dataset Mgmt Certificate test clean up (#739)
* Dataset Mgmt Certificate test clean up

- Fix bug of reading commissioner session id after rx MGMT_ACTIVE_SET/MGMT_PENDING_SET
- Restore ML16 address after modifying meshlocal prefix if the node keeps attaching
- Fix bug of THCI
2016-10-03 20:55:51 -07:00
Shu Chen a6d2f19c9b THCI: support joiner list and enhance log feature (#738) 2016-10-03 08:56:10 -07:00
Xiao Ma 1ebed3d9bc THCI: update thci with MGMT_PANID_QUERY method. (#727) 2016-09-29 11:26:11 -07:00
Lu Wang ef4ebfaf39 Add Operational Dataset and Commissioning Data THCI (#721) 2016-09-28 21:30:50 -07:00
Buke Po 5aa9ff75bb Remove deprecated cases (#707)
* remove deprecated test cases

* try to recovery from serial port failures
2016-09-28 09:10:20 -07:00
Xiao Ma dfd5fbd54f THCI: update thci with MGMT_ED_SCAN method. (#696) 2016-09-27 20:07:08 -07:00
Martin Turon 625e4adde4 spinel-cli: Add router timing commands. (#705)
Adds support for routerselectionjitter, routerdowngradethreshold, and masterkey to fixe the slew of ncp-sim failures from recent thread-cert test updates.  Also added missing otInstance parameter to the new APIs..

Added otInstance to new APIs.
2016-09-27 18:19:47 -07:00
Abtin Keshavarzian 4a06d7ac01 Remove extra white space at end of line and typo fixes (#699)
This commit contains  only style change: It removes extra white
space chars at the end of line, and fixes typos in the comments.
2016-09-27 09:56:54 -07:00
Shu Chen b4e4d4e678 THCI: APIs for commissioning certification tests (#591) 2016-09-27 08:44:57 -07:00
Xiao Ma 33dba76918 THCI: update the thci with new methods for Harness 1.1-R23. (#683)
* add enableAutoDUTObjectFlag() and getChildTimeoutValue().
* add __setRouterSelectionJitter() for quick test.
2016-09-24 21:59:22 -07:00
Buke Po d283c29f23 Support network diagnostic feature. (#652)
* support network diagnostic

* add network diagnostic THCI implementation
2016-09-23 21:06:08 -07:00
Martin Turon a853ffc784 spinel-cli: Add ipaddr removal to prefix change handler. (#669)
Fixes Cert_5_6_06 and Cert_5_6_08.  Fixes #517.
Collapse fcs16 into Hdlc class.
Add and correct subcommand completion handlers.
Move prefix handler to separate worker thread and task queue.
Channelize blocking spinel property change handlers to allow parallel
reuse across multiple threads.
2016-09-22 22:58:37 -07:00
Martin Turon ad0efaf72d spinel-cli: Add timestamp to ping. (#658)
Now calculates real round-trip times for ping6 reply:

    12 bytes from fdde:ad00:beef::3388:cc1e:5e44:6150: icmp_seq=0 hlim=63 time=891ms

Increased pexpect timeout for ncp-sim to 4 sec to handle ping responses >2 sec.
Makes Cert_5_3_10_AddressQuery pass reliably, even on low memory Travis VMs.
Added initial stub for commissioner command.
Add env variable control of ncp-sim DEBUG output.
2016-09-21 15:30:36 -07:00
Jonathan Hui 43330259f1 Run configure through scan-build and die on error. (#657)
- Fix bugs reported by scan-build.
- Add --enable-ncp to configure.
- Add -analyze-headers to scan-build.
2016-09-21 15:14:48 -07:00
Martin Turon 1ec2e76ecd Add asynchronous handling of prefix changes -- add slaac ipaddr on each prefix. NCP now passes 13 more thread-cert tests. (#641) 2016-09-20 18:12:57 -07:00
Xiao Ma c100be7ccb THCI: update thci with new methods. (#602)
* Add setRouterDowngradeThreshold() method support.
* Add new sendBeacons() method to ensure compile pass temporarily.
2016-09-15 23:09:43 -07:00
Jonathan Hui 44350178ad Change copyright to The OpenThread Authors. (#583)
- Add a top-level file named AUTHORS which identifies the copyright
holders of the project.
2016-09-13 15:57:11 -07:00
Nick Banks ffbe65c6dd otInstance Declarations (#473)
* Add otInstance type declaration and update ot APIs to take it as input.
2016-09-12 14:29:43 -07:00
Martin Turon bb84b9a1f2 spinel-cli: Stability improvements to ping (#561)
* Improve ping reliability by making it fully async. Eliminate 5_1_07 from XFAIL list.
* Some non-core changes: readd missing StreamSocket class, improve handling of  command.
2016-09-12 09:50:25 -07:00
Jonathan Hui 563685e187 travis: enable code coverage reporting. (#516) 2016-09-08 14:14:25 -07:00
Buke Po a7ed23c16c support Thread Harness 1.1 R19 (#520) 2016-09-06 09:33:19 -07:00
Martin Turon 73060ae8e1 spinel-cli: Add NCP build to TravisCI (#364)
* 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
2016-09-02 15:32:17 -07:00
Xiao Ma 69eb23cd0c THCI: update thci with bug fix and enhancement. (#513)
* 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.
2016-09-02 09:08:39 -07:00
Xiao Ma 8beb042328 THCI: Update thci to keep the consistency with Harness V1.1-R16 and bug fix. (#482)
* 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.
2016-08-29 09:32:15 -07:00
Xiao Ma a2580e8346 THCI: update openthread thci with new fix and support. (#427)
* 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
2016-08-19 10:13:45 -07:00
Xiao Ma 35afd8f4b5 Add OpenThread THCI python script for Thread Certification testing. (#374) 2016-08-14 08:54:02 -07:00
Jonathan Hui 4050c68577 Enable -Wconversion on clang and fix all warnings. (#358) 2016-08-10 11:52:22 -07:00
Buke Po ba813c2ac3 create harness automation (#355) 2016-08-10 10:02:42 -07:00
Robert Quattlebaum c1917179f7 ncp(spinel/SPI): Various additions and documentation updates (#342)
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.
2016-08-08 15:19:46 -07:00
Robert Quattlebaum 6587132ff2 spi-hdlc-adapter: Don't call syslog() or fprintf() from signal handlers. (#339)
`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.
2016-08-04 18:14:05 -07:00
Robert Quattlebaum 3a694016a1 spi-hdlc-adapter: Fixes for C̅S̅ delay (#338)
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.
2016-08-04 18:12:45 -07:00
Robert Quattlebaum 3f67c16faf spi-hdlc-adapter: Added better debugging capabilities. (#337) 2016-08-04 16:31:41 -07:00
Robert Quattlebaum 1613de62c4 spi-hdlc-adapter: Fix for HDLC parser state machine. (#335)
We were forgetting to turn off the `unescape_next_byte` flag.

Also changes the default log level from `LOG_WARNING` to
`LOG_NOTICE`.
2016-08-04 13:40:59 -07:00
Robert Quattlebaum fd00339d68 ncp_spi: Updates and fixes (#328)
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.
2016-08-03 18:24:08 -07:00
Robert Quattlebaum 2e31f499d6 spi-hdlc-adapter: Variable naming changes to adhere to style guide (#302) 2016-07-29 17:51:22 -07:00
Robert Quattlebaum 8f8273273d ncp-spi: Add padding byte to SPI header. (#300)
Also fixex HDLC decoding in `spi-hdlc-adapter`.
2016-07-28 21:34:32 -07:00
Robert Quattlebaum 9c0ddf8dda spi-hdlc-adapter: Make interrupt pin active low and add additional logging. (#293) 2016-07-27 23:26:55 -07:00
Marcin K Szczodrak 318fe4b415 turn on warnings and errors (#280) 2016-07-25 21:19:07 -07:00
Robert Quattlebaum c70a3c37ab spi-hdlc-adapter: Bug fixes and updates (#274)
Fixes issues with parsing command line arguments and
also makes the reset pin behavior work properly.
2016-07-22 08:45:54 -07:00
Robert Quattlebaum a36aea4935 spi-hdlc-adapter: Various fixes. (#261)
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.
2016-07-11 19:31:35 -07:00
Robert Quattlebaum 862edfb1de spi-hdlc-adapter: New Linux userspace SPI-HDLC adapter (#232)
`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
2016-07-06 18:53:33 -07:00