mirror of
https://github.com/espressif/openthread.git
synced 2026-06-05 21:14:49 +00:00
[test] support multiple backbone interfaces in otbr docker test (#10550)
In previous otbr docker tests, when creating docker containers, all the
containers(otbr nodes) are connected to the same docker network bridge `backbone0`
(when the env PORT_OFFSET is not set or set to 0), this means all the
otbr nodes are connected to the same infrastructures.
This commit adds support to enable user to config otbr instance
infrastructures seperately in `TOPOLOGY` when defining test cases, this
provides flexibility to run multi-ail related test cases.
The format to define backbone interface per node is:
```
class NewTestCase(thread_cert.TestCase):
...
BR = 1
...
TOPOLOGY = {
BR: {
...
'is_otbr': True,
'backbone': <backbone-name>,
...
}
...
}
...
```
`'backbone': <backbone-name>` is optional, when it's not given when
defining a otbr node, the backbone is default as
`BACKBONE_DOCKER_NETWORK_NAME`. The `<backbone-name>` is suggested to be
defined as `backbone[0-9]` to make it more easy to read and understand.
This commit also adds test_multi_ail.py as an example test case to use
this new method, this test case checks the two otbr nodes are connected
to the different infra and are in the same Thread mesh network.
This commit is contained in:
@@ -64,8 +64,9 @@ class OtbrDocker:
|
||||
_docker_proc = None
|
||||
_border_routing_counters = None
|
||||
|
||||
def __init__(self, nodeid: int, **kwargs):
|
||||
def __init__(self, nodeid: int, backbone_network: str, **kwargs):
|
||||
self.verbose = int(float(os.getenv('VERBOSE', 0)))
|
||||
self.backbone_network = backbone_network
|
||||
try:
|
||||
self._docker_name = config.OTBR_DOCKER_NAME_PREFIX + str(nodeid)
|
||||
self._prepare_ot_rcp_sim(nodeid)
|
||||
@@ -121,7 +122,7 @@ class OtbrDocker:
|
||||
'--name',
|
||||
self._docker_name,
|
||||
'--network',
|
||||
config.BACKBONE_DOCKER_NETWORK_NAME,
|
||||
self.backbone_network,
|
||||
] + dns + [
|
||||
'-i',
|
||||
'--sysctl',
|
||||
@@ -151,7 +152,7 @@ class OtbrDocker:
|
||||
try:
|
||||
subprocess.check_call(f'docker exec -i {self._docker_name} ot-ctl state', shell=True)
|
||||
launch_ok = True
|
||||
logging.info("OTBR Docker %s Is Ready!", self._docker_name)
|
||||
logging.info("OTBR Docker %s on %s Is Ready!", self._docker_name, self.backbone_network)
|
||||
break
|
||||
except subprocess.CalledProcessError:
|
||||
time.sleep(5)
|
||||
|
||||
Reference in New Issue
Block a user