Commit Graph

408 Commits

Author SHA1 Message Date
Abtin Keshavarzian a80098bbc1 [toranj] add thread commissioning test (single joiner) (#3792) 2019-05-02 08:45:51 -07:00
Jonathan Hui b7b085c9f9 [fuzz] advance alarm time to cover timer handlers (#3753) 2019-04-11 11:59:20 -07:00
Abtin Keshavarzian 7c3bce3a4f [toranj] verify "RCPVersion" is gettable on posix-app mode (#3735)
This commit updates the `test-001` to allow extra properties to
be verified when running under posix-app model. The new test
ensures "POSIXApp:RCPVersion" is gettable.
2019-04-06 22:57:25 -07:00
Abtin Keshavarzian 8f112eeb5a [locator] adding Get<Type> to InstanceLocator (#3714)
This commit changes how the objects in OpenThread access each other.
It adds a template `Get<Type>()` method in `InstanceLocator`. This
method returns a reference to a given `Type` object belonging to the
OpenThread instance (e.g. `Get<MeshForwarder>()` returns a reference
to `MeshForwarder` object on the OpenThread instance). The
`InstanceLocator` is used as base class of all OpenThread classes so
every class can easily access any other object. This commit also
changes how the main instance is retrieved in `InstanceLocator` for
the single-instance case. The method `GetInstance()` directly uses the
raw buffer `gInstanceRaw`. This change helps make the `GetInstance()`
and in turn all `Get<Type>()` methods in-line. This commit also
removes the existing getters across all classes to use the new
`Get<Type>()` model.
2019-04-02 09:07:25 -07:00
Jonathan Hui 3b41c7ef44 [fuzz] advance alarm time to cover timer handlers (#3710) 2019-03-26 12:17:31 -07:00
Yakun Xu 5f220682cd [tests] add an inspector for travis certification tests (#3700)
This commit adds a debugger to inspect nodes status.
2019-03-22 08:11:39 -07:00
Jonathan Hui aaaae937d3 [style] prefer OT_UNUSED_VARIABLE (#3696) 2019-03-19 21:17:33 -07:00
Irving-cl a637cdccf4 [tests] add test case Cert_9_2_02 (#3589)
1. Add new test case **Cert_9_2_02**. Since the test case contains 2
topologies, added 2 new files:
- `Cert_9_2_02A_MGMTCommissionerSet.py`,
- `Cert_9_2_02B_MGMTCommissionerSet.py`.

2. Add mesh_cop tlvs parsing. The corresponding file is
`mesh_cop.py`. The mesh_cop tlvs are used in many cases. For example,
`CommissionerSessionId` is used in both the parsing of **Commissioning
Data**(in mle) and the parsing of **CoAP**. Collected all mesh_cop
tlvs refered in Thread into this file with some unused tlvs
unimplemented.

3. Reuse `SubTlvsFactory` in `network_data.py`. `SubTlvsFactory` are
used to choose the corresponding factory of specific tlv and do the
parsing of it. The `NetworkLayerTlvsFactory` in `network_layer.py` had
exactly the same function with it (almost the same code). Moved the
`SubTlvsFactory` into a new file `tlvs_parsing.py` and change the
usage in `network_data.py` and `network_layer.py`. This helps us
remove some redundant code.

4. Some format issues. Remove some trailing spaces.
2019-03-19 21:17:15 -07:00
Abtin Keshavarzian 8bddf61ae2 [toranj] add test to cover OT/NCP SLAAC module behavior (#3688)
This commit updates and renames the existing `test-026-slaac-address`
to indicate that it covers the behavior of `wpantund` related to
SLAAC address management (in `test-026` we disable NCP SLAAC module).

It adds a new test `test-030-slaac-address-ncp` to cover behavior of
OpenThread/NCP SLAAC module:

- Verify that adding prefix (with SLAAC flag) causes a corresponding
  SLAAC IPv6 address to be added.
- Verify that removing the prefix would remove the SLAAC address.
- Verify behavior when same prefix is added and removed on multiple nodes
  (with or without SLAAC flag).
- Check behavior when an IPv6 address with the same prefix already exists.
- Check behavior when the address with same prefix is removed (SLAAC module
  should add a SLAAC address upon removal of the address).
- Verify that removal of prefix does not remove user-added addresses with
  same prefix.
- Verify disabling SLAAC module removes any previously added SLAAC
  addresses, and re-enabling it adds them back (with same IID).
- Check behavior when prefix is added while SLAAC module is disabled and
  then enabled later.
2019-03-18 22:58:13 -07:00
Zhanglong Xia 96725a985e [phy] add support for OQPSK modulation in 915MHz band (#3378) 2019-03-08 08:09:55 -08:00
rongli 11339835e4 [mle] do not echo back ML-EID registered by MTD (#3640)
* do not echo back ML-EID registered by MTD
* update the address registration check in Cert_7_1_01 and Cert_7_1_03
2019-03-04 08:36:27 -08:00
wgtdkp d3791348d1 [tests] enhance Cert_8_1_01_Commissioning (#3457) 2019-02-27 19:16:02 -08:00
wgtdkp dc947f0152 [tests] support testing commissioning (#3441)
Add support for testing commissioning process, including:

1. Add DTLS, Thread Discovery and commissioning messages(JOIN_FIN.req etc) parsing;
2. Support parsing log from UART response, and construct decrypted messages;
3. Common commands for commissioning related verification;
2019-02-26 15:49:57 -08:00
Yakun Xu 127e3bb84e [posix-app] clean up posix app defines (#3611) 2019-02-26 13:28:37 -08:00
Jonathan Hui 3eb5a106ff [fuzz] process pending tasklets to increase coverage (#3617) 2019-02-22 09:00:23 -08:00
Jonathan Hui b7a9e7afd7 [tests] add conditionals around unit tests (#3616) 2019-02-22 09:00:01 -08:00
Jonathan Hui 49641e1d4e [lowpan] introduce buffer writer to lowpan compressor (#3597) 2019-02-19 20:46:28 -08:00
Irving-cl cf7bc35bbe [tests] add traffic check in test case Cert_7_1_01 (#3405) 2019-02-18 13:41:30 -08:00
Abtin Keshavarzian 490b5739a8 [toranj] add test-case for data poll transmission and poll interval (#3570) 2019-02-11 21:50:22 -08:00
Irving-cl 2ac8890c41 [tests] fix class name for Cert_9_2_04 (#3572) 2019-02-11 10:50:58 -08:00
Jonathan Hui 362f97df1e [fuzz] return valid radio transmit buffer (#3549) 2019-02-04 10:52:00 -08:00
Yakun Xu b79d5d6a92 [toranj] allow specifying wpantund path (#3544) 2019-02-01 22:13:25 -08:00
Yakun Xu e68e86317e [ci] test with time sync and header ie (#3514)
This commit adds the missing test with ie present by enabling TIME_SYNC
feature, so that IE code are covered.
2019-02-01 16:08:43 -08:00
Jonathan Hui ac89fd5496 [style] return void where code always returns OT_ERROR_NONE (#3543) 2019-02-01 09:03:24 -08:00
Abtin Keshavarzian e71bd6267e [test] fix PRETTY_FILES definition in unit test makefile (#3532)
The `test_string` source is also made "pretty".
2019-01-29 11:55:16 -08:00
Yakun Xu 612d9de236 [posix] fix diagnostics for missing diag alarm (#3494)
This commit fixes a bug that `alarm.c` misses definition of
OPENTHREAD_ENABLE_DIAG for not including `openthread-core-config.h`.
This commit adds the `openthread-core-config.h` to every platform sources.

Also, this commit enhances the `test_diag.py` to make sure diag can send
packets out.
2019-01-23 08:49:27 -08:00
Jonathan Hui f9eb4cb517 [fuzz] add CLI UART input to fuzz tests (#3482) 2019-01-22 09:07:13 -08:00
Jonathan Hui 64e62a5314 [fuzz] add NCP UART input to fuzz tests (#3456) 2019-01-14 13:52:17 -08:00
Abtin Keshavarzian 59385b188b [network-data] use enumeration Type for local vs leader (#3455)
This commit changes `NetworkData` to use an enumeration `Type` to
specify whether a `NetworkData` instance represents local network
data or leader network data.
2019-01-14 13:51:50 -08:00
Irving-cl f5c49e2dd0 [tests] fix mac key id mode parsing (#3448) 2019-01-11 09:02:52 -08:00
Yakun Xu 3018886993 [windows] fix warnings (#3435) 2019-01-07 09:04:50 -08:00
Yakun Xu a42efee470 [script] add script to run cert tests (#3397) 2019-01-07 09:03:36 -08:00
wgtdkp 3f6d50a728 [tests] enhance Cert_7_1_03_BorderRouterAsLeader (#3399) 2018-12-29 11:25:39 -08:00
Irving-cl d34f279e5a [tests] enhance Cert_6_1_02_REEDAttach_MED/SED (#3387) 2018-12-29 09:50:12 -08:00
Abtin Keshavarzian 7dc645a856 [hdlc] report frames smaller than FCS size as error frame (#3395)
This commit changes the `Hdlc::Decoder` implementation to report
non-zero length received frames shorter than FCS size as an error
`OT_ERROR_PARSE` (instead of ignoring such frames during decoding).
Since the recent changes in `Hdlc::Decoder` buffer model delegates
the management of the frame buffer to the user of `Decoder`,
clearing frame buffer after an error should be be performed by the
`Decoder` user from the `FrameHandler` callback. The change in this
commit addresses an issue where a small (single-byte) frame would
not have been cleared from the decoder buffer and included in the
next frame. This commit also updates the `test_hdlc` unit test to
cover small frame error.
2018-12-24 15:12:16 -08:00
wgtdkp 35eaaab653 [tests] enhance Cert_5_1_06_RemoveRouterId (#3379) 2018-12-24 15:08:47 -08:00
Yakun Xu f2e3555a2a [posix-app] simplify UART on POSIX app (#3384) 2018-12-21 14:35:24 -08:00
Abtin Keshavarzian e96cc1b367 [hdlc] update buffer model for Encoder and Decoder (#3371)
This commit updates HDLC implementation to harmonize the buffer model
used by `Hdlc::Encoder` and `Hdlc::Decoder`.

The new model defines a common class `Hdlc::FrameWritePointer` which
provides a minimum set of APIs used by `Encoder/Decoder` for writing
frames, while not defining the underlying buffer space or how the
buffer is managed. `Encoder` or `Decoder` users are expected to use
sub-classes of `FrameWritePointer` to add the buffer space and
implement the frame buffer management scheme.

Two sub-classes `Hdlc::FrameBuffer` and `Hdlc::MultiFrameBuffer` are
also provided which respectively allow storing a single frame or
multiple frames (FIFO queue of frames) in a buffer of given size.

This commit also updates the `NcpUart` code to use the new buffer
model.

Finally, this commit adds an HDLC unit test `test_hdlc.cpp` which
covers the following:

- Verify behavior of `Hdlc::FrameBuffer` (single frame buffer),
- Verify behavior of `Hdlc::MultiFrameBuffer` (FIFO queue),
- Verify behavior of `Hdlc::Encoder` and `Hdlc::Decoder`,
- Test encoder/decoder with randomly generated frames (fuzz test).
2018-12-21 14:33:35 -08:00
Jonathan Hui ce7b65e117 [tests] update 5.2.7 to not require Link Accept from DUT_ROUTER (#3358) 2018-12-13 10:44:30 -08:00
Abtin Keshavarzian 5783c5c4b4 [toranj] adding test-028 for sequential router leader reset recovery (#3334) 2018-11-30 12:27:41 -08:00
Abtin Keshavarzian 1fece5f546 [toranj] update test-603 to use verify_within() (#3306) 2018-11-15 15:57:23 -08:00
Abtin Keshavarzian 08747cf7a7 [toranj] update test-010 to use verify_within (#3297)
This commit changes `test-010-on-mesh-prefix-config-gateway` to use
`wpan.verify_within` instead of using fixed delays.
2018-11-13 15:49:11 -08:00
Zhanglong Xia f8909593a9 [api] update message API to create message with priority (#3199) 2018-11-05 12:48:39 -08:00
Abtin Keshavarzian 9f2c56e620 [posix-app] check RCP capabilities and add support for stream log (#3215)
This commit contains the following changes:

- It adds code to `RadioSpinel::Init()` to get and check the RCP
  capabilities (`SPINEL_PROP_CAPS`) ensuring RCP supports radio/raw
  mode (`SPINEL_CAP_MAC_RAW`).

- It adds support for handling stream log `SPINEL_PROP_STREAM_LOG`
  property from RCP.

- It moves the existing code checking spinel version and radio
  capabilities of RCP into helper methods `CheckSpinelVersion()`
  and `CheckRadioCapabilities()`.
2018-10-29 19:50:25 -07:00
Abtin Keshavarzian 1fa71a6ca2 [toranj] adding build script for different configs: ncp, rcp, posix-app (#3196) 2018-10-24 20:07:47 -07:00
Zhanglong Xia af56b17bca [qos] rename message priority (#3159) 2018-10-23 15:14:49 -07:00
Jonathan Hui 22dd0e0f7d [tests] add python3 support (#3146) 2018-10-12 11:10:18 -07:00
Abtin Keshavarzian 7c8a37263b [posix-app] get RCP (NCP in radio mode) version (#3140)
This commit contains the following changes:

- It adds `otPlatRadioGetVersionString()` as an optional radio
  platform API. If the radio platform does not implement this
  function, OpenThread core provides a default weak implementation
  of this function which return the OpenThread version.

- A public OpenThread API `otGetRadioVersionString()` is added which
  provides the radio version string.

- POSIX App is updated to get the version from its RCP and provide
  `otPlatRadioGetVersionString()`

- A new spinel capability `SPINEL_CAP_POSIX_APP` is added which
  corresponds to `ENABLE_POSIX_APP` configuration.

- A new spinel property `SPINEL_PROP_RCP_VERSION` (only available
  in POSIX_APP) is added which gets the RCP version.
2018-10-12 10:40:57 -07:00
Zhanglong Xia 8e35bf1db8 [qos] reverse message priority level values (#3132) 2018-10-10 23:06:33 -07:00
Abtin Keshavarzian db3aa113cb [toranj] test-case to check child mode change and parent reset recovery (#3129) 2018-10-10 12:43:13 -07:00