mirror of
https://github.com/espressif/openthread.git
synced 2026-07-30 15:47:46 +00:00
[test] fix potential backbone name conflict when running cert suite (#10596)
### Background https://github.com/openthread/openthread/pull/10550 introduced a new way to support multiple backbone nework in otbr docker test. Though it works good while running a single test, a bug exists when running cert-suite, which runs a batch of tests in parallel. cert-suite allocates the name of the backbone interfaces dynamically by setting env PORT_OFFSET for each test, so there is potentially conflict exists if we hard code the `backbone_network` name in TOPOLOGY. This PR is targeting to fix this potential naming conflict. ### Fix We fix it by assigning a number for `backbone_network_id` in each BR definition in TOPOLOGY, instead of setting a fixed `backbone network` name. The final backbone network name is decided by both `PORT_OFFSET` env and the number of `backbone_network` (in `backbone{PORT_OFFSET}.{backbone_network}` format) For example, if `PORT_OFFSET` is 0 and `backbone_network_id` is 1, then backbone network name will be `backbone0.1`. For the tests that only use one backbone network and the `backbone_network_id` is not given, the backbone network name is by default `backbone{PORT_OFFSET}.0`. ### New test case format ``` class NewTestCase(thread_cert.TestCase): ... BR = 1 ... TOPOLOGY = { BR: { ... 'is_otbr': True, 'backbone_network_id': <backbone-id>, ... } ... } ... ``` `<backbone-id>` is any integer from 0, for each BR inside a single test, if `<backbone-id>` is different, the BR use different backbone interfaces; the same `<backbone-id>` inside a single test case means the same backbone network interface. `'backbone_network_id': <backbone-id>` is optional for single backbone test cases, when it's not given while defining a otbr node, the backbone is default as `backbone{PORT_OFFSET}.0`. For developers, if you are defining a new test which has multiple backbone interfaces, please ensure `backbone_network_id` is explicitly defined in each BR, otherwize an error is reported.
This commit is contained in:
@@ -66,6 +66,8 @@ class OtbrDocker:
|
||||
|
||||
def __init__(self, nodeid: int, backbone_network: str, **kwargs):
|
||||
self.verbose = int(float(os.getenv('VERBOSE', 0)))
|
||||
|
||||
assert backbone_network is not None
|
||||
self.backbone_network = backbone_network
|
||||
try:
|
||||
self._docker_name = config.OTBR_DOCKER_NAME_PREFIX + str(nodeid)
|
||||
|
||||
Reference in New Issue
Block a user