diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2021-11-23 07:47:33 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2021-11-24 07:05:19 -0500 |
| commit | bceb50e4aa3a6b65bf828c5abca5c6ac241993dc (patch) | |
| tree | 47473dbc045f3e2ed16277f490fa774cef25a873 /tests/topotests/lib/topojson.py | |
| parent | a335c38bc02372ca78eae18c0747791f618da186 (diff) | |
tests: Add clear event to creation of router for v4 and v6 ospf
When using build_config_from_json there exists a timing
window where neighbors can come up before the router-id
is applied. As a precaution, quickly clear the neighbors
to ensure that we get neighbors with the expected router-id.
This can especially happen under high system load.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'tests/topotests/lib/topojson.py')
| -rw-r--r-- | tests/topotests/lib/topojson.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/topotests/lib/topojson.py b/tests/topotests/lib/topojson.py index 1945ca535b..3ca3353ed3 100644 --- a/tests/topotests/lib/topojson.py +++ b/tests/topotests/lib/topojson.py @@ -352,6 +352,18 @@ def build_config_from_json(tgen, topo=None, save_bkup=True): logger.info("build_config_from_json: failed to configure topology") pytest.exit(1) + logger.info("Built config now clearing ospf neighbors as that router-id might not be what is used") + for ospf in ["ospf", "ospf6"]: + for router in data: + if ospf not in data[router]: + continue + + r = tgen.gears[router] + if ospf == "ospf": + r.vtysh_cmd("clear ip ospf process") + else: + r.vtysh_cmd("clear ipv6 ospf6 process") + def create_tgen_from_json(testfile, json_file=None): """Create a topogen object given a testfile. |
