Commit 66b83ad
committed
tests: topotests/ospf_topo1: clean up YANG-side OSPF state contamination
The YANG mutation tests in this suite drive OSPF state transitions
that the protocol can't fully reconcile on its own, and the leftovers
break downstream read-only tests:
* test_ospf_yang_router_id_config sets r1's router-id to a temporary
value and restores. Each change calls ospf_router_id_update which
re-originates self-LSAs locally but doesn't bounce remote
adjacencies. Old-router-id LSAs the test originated stay in r2's
and r3's LSDBs, then flood back to r1 after the restore, inflating
every LSDB-count assertion downstream.
* test_ospf_yang_area_interface_b3b_leaves_config sets priority=13
on r1-eth1, which makes r1 DR on segment s3. After the round-trip
r3 wins the next election, but r1's self-originated Network LSA
survives at MaxAge in the LSDB:
ospf_lsa_maxage_walker_remover explicitly skips self-originated
MaxAge LSAs, expecting the originator to drive the flush itself,
and the post-state-change flush path doesn't always cover this
case.
These produce phantom Router / Network LSAs that lsa-count assertions
in test_ospf_json see as off-by-one. test_ospf_convergence used to
fail (downstream regression in the B3c per-interface CLI conversion
left r1-eth1 with default hello/dead instead of the configured 2 / 10
values), masking the json failure by skipping. Once
test_ospf_per_iface_cli_routes_through_yang restores the original
timings, convergence passes and json then surfaces the LSA-count
phantoms.
This change:
1. Extracts the inner expect_ospfv{2,3}_neighbor_full helpers from
test_wait_protocol_convergence into module-level functions so
other tests can reuse them.
2. Adds _expect_ospfv2_lsdb_equal: poll show ip ospf json for the
exact LSA count in an area, so callers can wait for the LSDB to
settle rather than just for NSM Full (which signals DBD complete
but not LSU flood complete after a process reset).
3. Adds _force_ospf_reconvergence_to_steady_state: a hard restart
of ospfd and ospf6d on every router. `clear ip ospf process`
is not enough -- the phantoms survive via flooding back from
neighbours that also kept them. Full daemon restart re-reads
frr.conf and gives every node an empty LSDB simultaneously.
4. Calls the helper at the end of test_ospf_yang_router_id_config
(immediately after the disruptive router-id round-trip) and at
the end of test_ospf_yang_area_delete_recreate_cleanup (the last
YANG mutation test before the downstream read-only suite).
5. Restores hello-interval=2 / dead-interval=10 on r1-eth1 at the
end of test_ospf_per_iface_cli_routes_through_yang. The
`no ip ospf hello-interval` and `no ip ospf dead-interval` forms
route through YANG-destroy callbacks and revert to OSPF protocol
defaults (10 / 40), not the original CLI-configured values, so
the test must re-apply them to preserve adjacency for downstream
tests.
Suite is now 26 passed, 1 skipped, stable across three consecutive
full runs.
Signed-off-by: Eric Parsonage <eric@eparsonage.com>1 parent ecb8022 commit 66b83ad
1 file changed
Lines changed: 221 additions & 137 deletions
0 commit comments