Commit Graph

428 Commits

Author SHA1 Message Date
whd bbbeee17fb [ping-sender] show ping reply statistics (#6341) 2021-03-30 09:54:14 -07:00
kangping fbdafacbc7 [srp-server] do not use platform UDP for SRP server (#6322)
This commit binds SRP Server to Thread netif.

This also adds a configuration option for the SRP server UDP port to
allow using a specific/static port.
2021-03-23 12:45:53 -07:00
Jintao Lin f38ec1ed8a [tests] add allowlist after reset to restore same network topology (#6309) 2021-03-18 08:15:10 -07:00
Jintao Lin a79eb0f723 [simulation] do not update CSL IE in retransmission (#6275) 2021-03-17 10:15:35 -07:00
kangping e500c296f9 [tests] wait longer after updating SRP host address (#6295) 2021-03-17 10:13:34 -07:00
kangping 762c3c4d1e [border-router] add random delay before chaning routing policies (#6247)
Also fixes an issue that a border router may adds the OMR prefix of
current network as an external route.
2021-03-16 08:35:45 -07:00
kangping e992b8461c [srp-server] notify advertising proxy of host/service expiration (#6248)
There is an issue that the SRP host or service are not deregistered by
the Advertising Proxy when the host or service is expired. This is
because we didn't notifies the Advertising Proxy of the host/service
expiration. This commit fixes this issue and adds tests for it.
2021-03-15 08:32:14 -07:00
Jintao Lin 6c9d4b3f9e [tests] add radio metadata in sniffer log using TAP TLVs (#6279) 2021-03-15 08:23:55 -07:00
kangping dcc9472ba1 [tests] fix advertising proxy tests (#6276)
zeroconf is not able to discover the services after updating the host
address. We fixed this issue by replacing zeroconf with dns-sd.
2021-03-12 08:00:01 -08:00
Simon Lin 2aa8775c88 [posix] fix socket issues (#6268)
- Fix Multicast Routing failed to initialize MRT6 after reset.
- Fix DHCP6 client failed to stop the trickle timer.
2021-03-11 09:08:33 -08:00
kangping 21cd2d18d7 [tests] test updating SRP host address (#6246)
Test if we can update the host address.
2021-03-09 10:47:47 -08:00
Jonathan Hui 1e6e9ec8c2 [tests] add test for dataset updater (#6227) 2021-03-08 08:48:04 -08:00
kangping 244d3e5aa2 [border-router] test host leaves and rejoins (#6216)
This commit tests if a host is still reachable after leaving and
rejoining the infrastructure network. This makes sure that the routing
manager handles router solicitations.
2021-03-04 08:21:20 -08:00
Simon Lin a46b565cbf [tests] add test to verify DHCP6 client works after reset (#6204) 2021-03-03 11:21:44 -08:00
Simon Lin 0eb14bf5d9 [thread-cert] remove border_routing directory (#6210) 2021-03-01 07:28:54 -08:00
kangping da0d9f66b6 [posix] handle dynamic infra if status (#6186)
This commit includes below changes:

- handles dynamic infrastructure interface status changes. The Routing
  Manager will be started if the infra interface status turns to be
  RUNNING and a valid link-local address is present. Otherwise, the
  Routing Manager will be stopped.

- changes the default status of the Routing Manager from enabled to
  disabled and it is initially enabled for the posix platform.

- the posix implementation now doesn't require the presence of the
  link-local address at initialization stage. In this case, the
  Routing Manager will not be started before a link-local address is
  added to the infra interface.

- add CI tests for the new behavior.
2021-02-25 13:19:31 -08:00
Simon Lin da626caa6d [thread-cert] reduce simulator UDP buffer size (#6196)
UDP buffer size was increased to 10M so as to avoid potential UDP
packet loss. However the buffer size is too large to run thread-cert
tests on macOS.

This commit reduces the UDP buffer size to 2M.
2021-02-22 23:25:07 -08:00
Abtin Keshavarzian 14ef4e4082 [dns-header] add common TXT record entry parsing API (#6157)
This commit adds a new public `ot` API for parsing an encoded DNS TXT
record data into `TxtEntry` key/value pairs. It also updates the TXT
data iterator model used for going through all TXT entries. The new
iterator definition provides a small buffer to store the key string.
This helps simplify the definition of `otDnsTxtEntry` to use
null-terminated C string for the key. The new parsing APIs are used in
CLI module.

This commit also fixes an issue with `TxtEntry::AppendEntries()` using
incorrect value for the key length.

Finally, this commit adds a test covering the behavior of all
`TxtEntry` related methods (encoding and parsing TXT data) in the unit
test `test_dns`.
2021-02-19 16:17:35 -08:00
Abtin Keshavarzian ef259cdd6b [srp-client] adding auto-start feature (#6140)
This commit adds auto-start SRP client feature. Config option
`OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE` adds support for
this feature in SRP client allowing auto-start mode to be enabled or
disabled. When enabled, the SRP client will monitor the Thread Network
Data for SRP Server Service entries and automatically start and stop
the client when an SRP server is detected. If multiple SRP servers are
found, a random one will be selected. If the selected SRP server is no
longer detected (not longer present in the Thread Network Data), the
SRP client will be stopped and then it may switch to another SRP
server (if available).

This commit also adds support for the new feature in CLI and adds a
new test `test_srp_auto_start_mode.py` covering the behavior of this
feature.
2021-02-19 10:00:19 -08:00
Simon Lin c261cf2dff [dns-server] handle multiple questions (#6155)
This commit enhances the DNS-SD server to handle multiple questions.

Specifically for DNS service resolving query with SRV+TXT questions,
this commit would reply with SRV+TXT+AAAA RRs, so that the service
instance can be fully resolved with one query.

More implementation details:
- This commit enhances NameCompressInfo so that question names can be
  compressed together with RR names.
  - Full compression is limited to only one instance / service / host
    name.
- For any RR type in the question, this commit will exclude it in
  additional RRs. For example, if the query contains a AAAA question,
  the response won't include any additional AAAA RR, but will only
  have AAAA answer(s). The purpose is to avoid duplicate RRs in answer
  section and additional section.
2021-02-19 09:38:25 -08:00
Jintao Lin d8b5a3ee51 [test] add posix verification for OT 1.2 (#6070)
This change:
1. Adds new github action to verify posix app for OT 1.2.
2. Only enable compile flag OT_SIMULATION_VIRTUAL_TIME_UART in
   script/test for ot-rcp build target.
3. Allow mix use of posix node and ot-cli-mtd node by changing python
   test script to accept node type as parameter.
4. Remove CSL test from expect as it is covered by thread-1-2-posix
   tests.
2021-02-18 09:05:29 -08:00
Abtin Keshavarzian 4538a5fb7c [cli] add support for DNS-SD command (#6116)
This commit adds new commands in CLI to support DNS-SD browse and
service resolution.
2021-02-12 11:27:11 -08:00
Simon Lin 89aacf5dd7 [dns-sd] DNS-SD server implementation (#6103)
This commit implements the DNS-SD server:
- Handle Standard DNS Query from clients
  - Supported resource records: PTR, SRV, TXT, AAAA
- Query services from SRP server
- Add tests
  - simulation test using DNS client (only test AAAA query)
  - OTBR test using dig command to verify all resource records can be
    queried successfully
2021-02-09 20:25:26 -08:00
kangping 282f8a4a8b [dns-sd] add CI tests for SRP server & Advertising Proxy (#6131)
This commit includes basic service registration & advertising function
verification. More tests including name conflicts and multiple devices
cases will be in future commits.

We changed the border_routing test scripts directory to border_router
as there will be more tests about Thread border router but not only
the routing feature.
2021-02-09 12:18:16 -08:00
Simon Lin ad5dd8ecd8 [thread-cert] fix python syntax warning (#6150) 2021-02-08 11:38:38 -08:00
kangping 099dfa2731 [tests] fix test_srp_name_confclicts.py (#6143)
The SRP service may be in different intermediate states when rejected
by the server and we only need to make sure that the state is not
Registered.
2021-02-05 10:11:07 -08:00
kangping 46f796d4f0 [srp] get parsed TXT entry from SRP server (#6113)
This commit returns parsed TXT entries for service from the SRP
server, it enables prettier CLI output and easier Advertising Proxy
processing. We moved the otSrpTxtEntry to include/openthread/dns.h
because this structure can ( and will) also be used by DNS-SD
client. We also added one more mKeyLength field in otDnsTxtEntry for
saving length of the TXT key so that we can iterate over the encoded
TXT data without dynamically allocating memory for each entry.
2021-01-28 21:12:56 -08:00
Simon Lin b87abb9e3c [udp] fix UDP not accessible via RLOC/ALOC with PLAT_UDP (#6111)
This commit makes sure that UDP servers are accessible via all IPv6
addresses when PLAT_UDP is on.

We still need to pass the messages with ALOC/RLOC destinations to the
tun interface when PLAT_UDP is used. Otherwise, UDP servers can not
receive any message when PLAT_UDP is enabled.
2021-01-27 11:15:09 -08:00
Aurelio Schellenbaum 02d6d49a5e [coap] add CoAP(s) block-wise transfer support to CoAP(s) client and server (#4247)
Implemented CoAP/-s block-wise transfer according to RFC 7959. The
implementation includes methods and functions available to the
application layer to add Block1 and Block2 option values to a coap
message and an automatic block-wise transfer enabled by the compile
switch "COAP_BLOCK".
2021-01-26 13:27:32 -08:00
Simon Lin f7825b9647 [scripts] allow virtual time simulator to go less than 1 second (#6112) 2021-01-25 09:02:20 -08:00
kangping 7cd85bfe5d [tests] add CI tests for SRP server & client (#6074) 2021-01-22 13:19:21 -08:00
Simon Lin 42633b19a8 [thread-cert] ignore CLI log lines (#6102)
This commit allows node.py to ignore log lines from node CLI output.

Only if _expect_command_output is used.
2021-01-21 08:14:10 -08:00
kangping 5fa21ddbbd [border-router] add external route for on-link prefix and external OMR prefixes (#6008)
This commit includes the enhancement that

1. Adds non-default external route for on-link prefixes.

2. Add external route for OMR prefixes advertised by BRs in other
   Thread Networks.

3. A new API to disable/enable the Border Routing manager at run
   time. CLI commands are added for testing.

4. A new platform API to get the link-local address of the infra
   interface so that we can filter out the ICMPv6 packets from myself
   by the Border Routing Manager rather than the platform
   implementation.
2021-01-20 08:23:24 -08:00
kangping 763eeea91c [tests] use dedicated _expect_done method for success commands (#6073)
We see self._expect('Done') in many places, looks like it's worth a
dedicated method.
2021-01-17 09:29:12 -08:00
kangping 4d50cbadbc [tests] fix expecting command output (#6072)
The _expect_command_output(self, ...) doesn't match exactly one line,
it may return a line in several splits. This commit fixes this issue.
2021-01-14 21:08:51 -08:00
Simon Lin 9fcdb290ae [simulation] increase simulator UDP buffer size (#6006) 2021-01-05 10:27:42 -08:00
Simon Lin 22b043bf62 [otci] add OpenThread Controller Interface library (#5779)
This commit introduces the Proof of Concept implementation of the
OpenThread Controller Interface (OTCI) which can be used to connect
and manage various kinds of OT devices.

This commit also adds the tests to verify that OTCI works for both
simulation and real OT devices.

- Device Connectors
  - CLI Virtual Time Simulation
  - CLI Real Time Simulation
  - CLI SOC Device
  - NCP Virtual Time Simulation (not all APIs work)
  - Real device via SSH
- OTCI tests of simulation devices are executed in Github Actions
- OTCI tests of real devices can be executed like below:

# Install otci python library
cd tests/scripts/thread-cert/otci && python3 setup.py install --user
# Test OT CLI SOC device at /dev/ttyACM0
REAL_DEVICE=1 OT_CLI_SERIAL=/dev/ttyACM0 python3 tests/test_otci.py
# Test OTBR device via SSH
REAL_DEVICE=1 OTBR_SSH=172.16.243.151 python3 tests/test_otci.py
2020-12-30 11:29:27 -08:00
Moandor 069e26b51e [key-manager] remove default master key (#5998)
When initializing, we should use randomly generated network parameters
instead of default ones, to eliminate the possibility of unintentional
use of default credentials.
2020-12-30 11:25:48 -08:00
Li Cao 82c682fbc9 [low-power] fix test case Low Power 5_3_01 (#6022) 2020-12-30 11:20:03 -08:00
Simon Lin 471cf8bedf [ip6] use ALOC source address (#6007)
CoAP requires that the source address of a response must match the
destination addresses of the request. So, if a device sends a TMF
request using ALOC as destination address, the TMF response SHOULD use
the ALOC as source address. Otherwise, CoAP implementations (beside
OpenThread) may fail to match the request and response.
2020-12-24 11:00:03 -08:00
Jing Ma e0bff3641f [thread-cert] fix case 7.1.5 intermittent failure (#5973) 2020-12-23 15:45:01 -08:00
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 7d2d228fa7 [thread-cert] relax time difference to less than 1.1 for case 5.1.13 to fix issue #5979 (#5987) 2020-12-21 07:12:25 -08:00
Jing Ma cd355d499e [thread-cert] remove deprecated case 6.1.9 referring to testplan v67 (#5984) 2020-12-20 16:27:50 -08:00
Jing Ma 3b832ef470 [thread-cert] add case 7.1.7 using pktverify (#5881) 2020-12-19 19:00:41 -08:00
Jing Ma 6583a3d8cf [thread-cert] fix case 8.3.1 intermittent failure (#5975) 2020-12-19 08:23:36 -08:00
Jing Ma 1811223a25 [thread-cert] fix case 7.1.6 intermittent failure (#5974)
An issue is caused by tiny time difference as well between step 5 and
step 6, step 6 occasionally is sent out ahead of step5.
2020-12-19 08:22:20 -08:00
Jing Ma ae43f3fda2 [thread-cert] fix case 5.1.12 intermittent failure (#5976)
An issue is caused by The Challenge TLV and TLV Request TLV MUST be
included if the response is an Accept and Request message in Step 4,
delete these two TLV checks when the response is a Link Accept
message.
2020-12-19 08:20:53 -08:00
Jing Ma 3166f6a0ed [thread-cert] add case 9.2.6 DatasetDissemination using pktverify (#5972) 2020-12-18 20:24:49 -08:00