Commit Graph

128 Commits

Author SHA1 Message Date
kangping 995ad66846 [border-router] initial implementation of prefix/route management (#5856)
This is the initial implementation of Thread Border Router
prefix/route management with:

- Create & publish off-mesh routable (OMR) prefix for Thread network
  - configure the BR as default route.
  - converge to the smallest OMR prefix if multiple prefixes are
    present at the same time.
- Create & advertise on-link prefix for infrastructure network
  - monitor RA messages on infra link and stops myself if there is
    someone else advertising an on-link prefix.

It currently supports single infrastructure link with possibly
multiple BRs. Support for multiple infrastructure links is left for
future.
2020-12-23 15:19:12 -08:00
Simon Lin 24ed1ffd37 [cli] router table command to output Link (#5997)
This commit enhance OT CLI command router table to output whether Link
Established in Link field.
2020-12-22 22:52:14 -08:00
Jing Ma 0e105524cb [thread-cert] add case 5.8.4 SecurityPolicyTLV using pktverify (#5967) 2020-12-18 08:05:08 -08:00
Jing Ma 69e97581e7 [thread-cert] add case 8.1.6 using pktverify (#5898) 2020-12-14 23:24:43 -08:00
Jing Ma bd00cafbec [thread-cert] add case 9.2.19 PendingDatasetGet using pktverify (#5951) 2020-12-14 11:49:24 -08:00
Jing Ma 98e70c425c [thread-cert] add case 9.2.3 ActiveDatasetGet using pktverify (#5949) 2020-12-14 08:36:33 -08:00
Jing Ma 234562a577 [thread-cert] add case 9.2.1 MGMTCommissionerGet using pktverify (#5952) 2020-12-14 08:34:39 -08:00
Jing Ma 3cb8c7b03d [thread-cert] add case 8.3.1 CommissionerPetition using pktverify (#5904)
Also fix wrong COMMISSIONING_DATA_TLV const in cases 5.6.6 and 5.6.9.
2020-12-11 07:35:44 -08:00
Li Cao ae07fe27ff [low-power] implement enhanced-ack based probing (#5780)
This commit implements Enhanced-ACK Probing (on simulation platform).

- Add a new public API otLinkMetricsConfigEnhAckProbing which sends
  Link Metrics Management Request to configure the probing. This is
  called on Probing Initiator side.

- Add a new radio platform API otPlatRadioConfigureEnhAckProbing. This
  API should be called on Probing Subject side when handling the
  requests from Initiators. This API notifies the radio to start/stop
  aggregating link metrics info and include the data into Vendor IE in
  enhanced-ACK for the specific neighbor. As discussed in #5746, the
  code for doing such thing should be put in radio driver.

- Add a util module util/link_metrics, which provides a group of APIs
  to implement Probing Subject side logic for Enh-ACK Probing. Any
  platform could use this module to implement the feature easily in
  radio driver.

- Add new util APIs in util/mac_frame to generate Enh-ACK Probing IE
  (Vendor IE with Thread OUI and SubType = 0) and set value for this
  IE.

- Update the implementation in simulation/radio.c to support Probing
  Subject side logic for Enh-ACK Probing, using APIs in
  util/link_metrics and util/mac_frame.

- Add a test
  v1_2_LowPower_7_1_01_SingleProbeLinkMetricsWithEnhancedAcks.py for
  testing.

Misc:

  - Add check for all the public Link Metrics APIs (Initiator side) to
    ensure that the Subject is a neighbor of the Initiator. If the
    address is not link-local or the neighbor is not found, an error
    UNKNOWN_NEIGHBOR would be returned.

  - Update PrepareEmptyFrame so that when it's called for reference
    device, its frame version would be set to 2015.
2020-12-10 23:31:41 -08:00
Simon Lin 9380ffd07c [scripts] test multicast routing across Thread and Backbone (#5852)
- This commit fixes some issue in multicast forwarding from Thread to
  Backbone.
- It also adds a test to verify that multicast forwarding works across
  Thread and Backbone.
  - Test script tests/scripts/thread-cert/mcast6.py is added for Host
    to subscribe to a multicast address

The ping reply can not reach ROUTER1 since DUA feature is not
complete.
2020-12-09 08:49:07 -08:00
Yakun Xu 7a7390b9ee [test] separate code coverage data files (#5920)
This commit ensures each node create its own profile data, so that they
can be merged after tests to produce more accurate profile data.

This commit also prints the coverage data of message.cpp after all
profile data are merged.
2020-12-07 13:23:26 -08:00
Zhanglong Xia 0d14e85439 [mle] let the command partitionid return the current partition id (#5872)
If user doesn't set the Partition Id using the command
'leaderpartitionid xxx', the current cli command 'leaderpartitionid'
always return 0. This commit renames the command 'leaderpartitionid'
to partitionid and let the command partitionid returns the current
leader Partition Id and add command partitionid preferred to set or
get preferred Partition Id.
2020-11-30 21:15:18 -08:00
Simon Lin 61cf7c9a48 [dua] implement ND Proxy callbacks (#5595)
This commit:
- Add callback for Domain Prefix events
- Add callback for ND Proxy events
- Add corresponding test to verify ND Proxy works
- Some misc enhancements to the Backbone tests
  - Run sudo modprobe ip6table_filter in Docker host so that ip6tables
    works in ubuntu docker instances.
  - Use -DOTBR_REST=OFF -DOTBR_WEB=OFF for building OTBR Docker image
    since these features are not used in tests.
  - Setup radvd on Host to send Router Advertisements for the Domain
    Prefix using configuration: AdvOnLink on; AdvAutonomous off;
    AdvRouterAddr off;
  - Set sysctl net.ipv6.conf.eth0.accept_ra=2 for BBR and Host
2020-11-02 08:06:45 -08:00
Simon Lin 903f677215 [dua] implement Backbone query and answer (#5664)
This commit implements DUA features of Thread 1.2 DUA that involves
sending and processing Backbone query and answer:

- Extend address query to the Backbone Link
  - Send BB.qry for Thread address query
  - Send ADDR_ANS.ntf for BB.ans
- DAD process
  - PBBR to send BB.qry on the Backbone link (3 times if not answered)
  - PBBR to receive and handle BB.qry and sends BB.ans
  - PBBR to receive BB.ans and sends ADDR_ERR.ntf if duplicated
- PRO_BB.ntf
  - Send PRO_BB.ntf when DUA registration is updated
  - Handle PRO_BB.ntf
- Add test_dua_dad.py to test the DAD process when it was successful
  or duplicated
  - Verify the normal DAD process
  - Verify Address Query can be extended to the Backbone link
  - Verify DAD duplicate is handled correctly
  - Verify PRO_BB.ntf for duplicated DUA is handled correctly
2020-10-30 11:18:05 -07:00
Li Cao 42fb2e44be [low-power] implement forward tracking series (#5608)
This commit implements the Forward Tracking Series feature in Link Metrics.

- Two new apis are added:
  - otLinkMetricsSendMgmtRequestForwardTrackingSeries, which is used
    to send an MLE Link Metrics Management Request
  - otLinkMetricsSendLinkProbe, which is used to send an MLE Link Probe

- A new class LinkMetricsSeriesInfo is used to maintain the data of
  one Series configured by a neighbor. This class inherits
  LinkedListEntry and each Neighbor has a list of
  LinkMetricsSeriesInfo. All LinkedListEntrys are allocated and freed
  by a Pool in LinkMetrics.

- To specify SeriesFlags in cli command for Forward Tracking Series, a
  similar approach with LinkMetricsFlags is used. Another character
  flags is used to represent SeriesFlags.

- Whenever the node receives a frame (including ACK) from a neighbor,
  it would call Neighbor::AggregateLinkMetrics which goes through each
  LinkMetricsSeriesInfo entry in the neighbor's list and aggregate the
  data if the frame type matches the entry.

- Two test scripts are added to test this function:
  - v1_2_LowPower_7_2_01_ForwardTrackingSeries.py
  - v1_2_LowPower_test_forward_tracking_series.py
2020-10-29 20:04:39 -07:00
Moandor 713662bf80 [continuous-integration] use lcov to generate coverage data (#5635) 2020-10-29 08:34:37 -07:00
Simon Lin 8707b63894 [scripts] add MLR Backbone multicast routing test (#5578)
- backbone/test_mlr_multicast_routing.py verifies the basic features
  of Backbone multicast routing

- backbone/test_mlr_multicast_routing_timeout.py verifies that MLR
  timeout works

- backbone/test_mlr_multicast_routing_commissioner_timeout.py verifies
  that Commissioner MLR timeout works
2020-10-26 22:46:48 -07:00
Simon Lin 8642f998cc [thread-cert] set node addr64 to EXTENDED_ADDRESS_BASE + nodeid (#5601)
This commit sets nodes' extaddrs to 0x166e0a0000000000 + nodeid, which
does not change node behavior but makes it easier for us to analyze
pcaps.
2020-10-11 23:02:29 -07:00
Jing Ma f01f4d96a3 [thread-cert] refactor case 9.2.7 using pktverify (#5459) 2020-10-11 16:26:13 -07:00
Li Cao a4368909ff [low-power] add cli command macsend for certification (#5573)
This command allows an Rx-Off-When-Idle device to send an empty mac
data frame or mac datarequest to its parent. This command is only used
for certification.
2020-10-11 10:46:20 -07:00
Simon Lin 809947e1f9 [mlr] send BMLR.ntf on Backbone link (#5388)
This commit enhances Backbone Router to send BMLR.ntf on the backbone
link for Multicast Listeners.
- Send BMLR.ntf to the Backbone link
- Add Backbone test with packet verification
- Includes some revision to the Thread 1.2 Backbone CI scripts to make
  it more stable
2020-09-29 22:37:33 -07:00
Simon Lin 81996b0f3b [dua] handle coap error code for DUA.rsp (#5523)
- Configure next response to 5.00 for Reference Device
- Handle 5.00 (and other COAP error codes) in DUA.rsp (required by 1.2
  Test Spec)
- Update DUA test to handle COAP code 5.00
2020-09-27 22:30:15 -07:00
Simon Lin fad92841e7 [dua] handle AddressError (#5516)
This commit enhances DUA feature to handle Address Error by increasing
the DAD counter and generating new DUA address if a DUA conflict is
detected.
2020-09-27 11:32:33 -07:00
Simon Lin efccfe2252 [scripts] fix test_route_table.py (#5558) 2020-09-26 20:22:50 -07:00
Li Cao dc94758e84 [low-power] implement link metrics - single probe (#5481)
This commit is the first part in link metrics. It implements single
probe function.

An overview of major changes:
- Add link metrics apis which allow apps to send a single probe and
  set report callback.
- Add cli commands for calling link metrics api and related README
  doc.
- Add a new module link_metrics to implement the query process and
  handle the report.
- Add related tlv types.
- Add simple script test to run single probe process.
2020-09-25 09:50:09 -07:00
Simon Lin cd80f94a81 [reference-device] send fake ADDR_NTF.ntf (#5537) 2020-09-24 20:31:25 -07:00
Simon Lin ce336257ee [thread-cert] Thread 1.2 CI with OTBR and Backbone link (#5489)
Thread 1.2 CI with OTBR and Backbone link:
- Run OTBR in Dockers with Backbone link
- Enhance node.py to work with OTBR Docker
- Add Packet Verification for 5.11.1
  - incomplete, some steps can not pass yet, just to make sure
    Backbone traffic verification works
- Support running multiple tests simultaneously (default: each test
  run 3 instances)
- Build OTBR Docker using OpenThread PR code
- Upload code coverage in Docker

Some implementation details:
- Most existing code of node.py is shared by OTBR Docker
- Backbone related test scripts are found in
  tests/scripts/thread-cert/backbone
- A new script tests/scripts/thread-cert/run_bbr_tests.py is added to
  manage multiple running tests
- Test configuration differs according to PORT_OFFSET
  - Backbone interface name: Backbone{PORT_OFFSET}
  - Backbone network prefix: 91{PORT_OFFSET:02x}::/64
  - Docker instance name: otbr_{PORT_OFFSET}_{nodeid}
  - Output Files:
    - Pcap:
      - Thread: {test_name}_{PORT_OFFSET}.pcap
      - Backbone: {test_name}_{PORT_OFFSET}_backbone.pcap
      - Merged: {test_name}_{PORT_OFFSET}_merged.pcap
    - Log: {test_name}_{PORT_OFFSET}.log
2020-09-24 20:16:27 -07:00
Li Cao f77c5d4653 [thread-cert] add low power case 6_1_07 (#5557) 2020-09-23 08:33:50 -07:00
Jing Ma f787275eee [thread-cert] refactor case 9.2.4 using pktverify (#5412)
1. add timestamp parse and check
2. add leader aloc parse and check
2020-09-22 09:41:39 -07:00
Jonathan Hui 0d8a99bd05 [cli] implement network data print (#5543)
- Print human-readable network data.
- Create network data sub-command.
2020-09-19 10:28:17 -07:00
Jonathan Hui 42d76a0a4e [cli] change 'binary' arg to '-x' for consistency (#5543) (#5549) 2020-09-19 08:53:34 -07:00
Jonathan Hui 5bffd8bc4d [mac-filter] change whitelist/blacklist to allowlist/denylist (#5507)
To promote inclusivity and eliminate any unintentional bias.
2020-09-11 16:03:39 -07:00
Simon Lin 8b842d39a6 [scripts] fix test_router_reattach (#5517)
Fix test_router_attach.py failing by a small chance.

Root cause: routerdowngradethreshold restored back to default (23)
after node reset, so the test had 5/120 chance to downgrade. We should
set it back to 32 before starting it.

This commit also enhances the test for a little bit:
- Make sure the node reattached as Router within 1 second
- Make sure the node does not downgrade after Router Selection Jitter
  (3s)
2020-09-11 08:56:53 -07:00
Jing Ma 1e08cea585 [thread-cert] refactor case 5.6.6 and 5.6.9 using pktverify (#5371) 2020-09-11 08:49:48 -07:00
Simon Lin 7266e1b909 [mlr] add Commissioner API to register Multicast Listeners (#5346) 2020-08-29 08:52:29 -07:00
Simon Lin c3845e72ff [mlr] configure MLR.req response status (#5350) 2020-08-27 14:13:07 -07:00
Simon Lin c73320ff3e [mlr] add MulticastListenersTable on BBR (#5292)
This commit adds the Multicast Listener Table for BBR:

- Implements Multicast Listener Table on BBR
  - Adds registered MAs to MulticastListenerTable
  - Reject when the table is full or the multicast address is invalid
    and return failed status
  - Respond with unsuccessful status along with failed addresses
  - Expire Listeners from MulticastListenerTable per second (using
    MinHeap for better performance)
- MLR enhancement
  - Re-register only failed multicast addresses (used to register all
    registering multicast addresses)
- Reference Device only APIs
  - Some APIs are defined for reference devices and tests.
- Add tests
  - Add unit test: test_multicast_listener_table.cpp (runs for 1.2-bbr
    only)
  - Add functional tests
2020-08-21 08:40:58 -07:00
Li Cao 7db8c6815c [low-power] add csl feature for Thread 1.2 (#4557)
This commit implements the CSL feature in Thread 1.2.

- Add macro definitions for low power to control the compiling of
  source code.

- Add data and methods for running CSL in Mac and SubMac. This mainly
  includes setting CSL parameters, starting/stopping CSL, and the
  timer handling process.

- Add otPlatTimeGetAPI and implementation.

- Add CSL transmission implementation. CSL transmission is a new kind
  of transmission, the related definition and implementaion for the
  whole transmitting process is added.

- Add calling of start/stop CSL in certain cases.

- Implement CSL synchronization maintainence. If a CSL cordinator
  didn't get a frame containing CSL IE for CSLTimeout, the CSL
  receiver is regarded as de-synchronized.

- Add Cli interface for using CSL.

- Implement enhanced Ack with IE. The original code can only generate
  auto ack for Imm-Ack. As CSL requires CSL IE included in enhanced
  ack. This PR implements it.

- Add basic functional test for CSL transmission. More tests
  corresponding to test plan would be added later.
2020-08-18 10:55:33 -07:00
Simon Lin ecd9436427 [scripts] add packet verification framework (#4428)
This commit introduces the packet verification (PV) framework for
certification tests.

- Add packet verification framework code

- Implement packet verification for cert 5.1.7 as a minimal
  example. There will be more 1.1/1.2 tests with PV submitted in the
  future.

- Download pre-built thread-wireshark binaries from
  openthread/wireshark/releases for packet dissecting (used by
  pyshark)

- Added a Github Action job for Packet Verification
2020-08-11 09:26:28 -07:00
Simon Lin d7343c877b [style] change python yapf column_limit to 119 (#5339) 2020-08-06 21:40:24 -07:00
Rongli Sun 82e7e32bb5 [dua] dua registration and re-registration (#5276)
- registration workflow framework
- registration and reregistration
- registration and reregistration on behalf of children
- add pseudo response status for test/certification purpose
- add unit test
2020-07-30 14:10:22 -07:00
Simon Lin 00f3043a06 [mlr] send MLR.req for local multicast addresses (#5248)
This commit includes:

- Adding compile configurations necessary for MLR features
- Adding source/header files necessary for MLR features
- Send MLR.req for local MAs on ThreadNetif
  - At most one MLR.req is outstanding
  - Reregistration according to PBBR configuration
  - Renewing periods according to PBBR configuration
- BBRs receive MLR.req with minimal processing and send MLR.rsp
- Add a test to verify that MLR.req is sent for local MAs.
2020-07-22 08:38:05 -07:00
Yakun Xu 8248c3d9df [posix] use real time signal for microsecond timer (#5122) 2020-06-19 16:12:55 -07:00
Simon Lin 44f1a8bf29 [tests] use longer timeouts for simulation tests (#5094)
* use longer duration for pexpect and socket
* use 10s timeouts
2020-06-15 18:11:34 -07:00
Rongli Sun b51d9100e6 [dua] support to specify iid for domain unicast address (#4900) 2020-06-09 10:38:13 -07:00
Yakun Xu f8f75d6d05 [posix] clean up for radio url (#5027)
* fix max-power-table documentation
* rename `baudrate` to `uart-baudrate`, `arg` to `forkpty-arg`
* update command line enumeration
* update README
* remove trailing argument from node.py
2020-06-01 08:13:46 -07:00
Jiacheng Guo 115616c6bf [posix] add radio url (#4935)
Radio url provides a unified interface for users to specify the radio
peripheral device and arguments to the OpenThread core stack.
2020-05-29 17:34:29 -07:00
Yakun Xu 3bc67ee6f9 [posix] get node id from command line argument (#5000)
This simplify manually running posix virtual time mode when debugging.
2020-05-25 16:03:27 -07:00
kangping 80285206d2 [tests] add 5_7_01 network diagnostic test cases (#4663)
This commit adds Network Diagnostic TLV parsing and 5.7.01 test case.
2020-04-28 13:37:21 -07:00
Yakun Xu be48ea648c [thread-cert] use the same mesh local prefix as Thread harness (#4089) 2020-04-24 17:24:53 -07:00