tests: Fix zebra_vrf_netns topotest - #21741
Conversation
This test is installing configuration in a netns based system and immediately sending mac address additions to the system. Under heavy load interfaces are not fully read in when the neighbor table entry is added causing issues. Modify the test to ensure that the moved interfaces are actually in the appropriate vrf and actually up. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Greptile SummaryThis PR adds a
Confidence Score: 3/5The race-condition fix is sound in intent, but the The logic and framing of the fix are correct (poll until interfaces are up, then add neighbours). However, the format used for the tests/topotests/zebra_vrf_netns/test_zebra_vrf_netns.py β specifically the Important Files Changed
Sequence DiagramsequenceDiagram
participant M as setup_module
participant FRR as FRR/zebra
participant K as Kernel (netns)
M->>K: add_netns(vrf), set_intf_netns(ifname, vrf, up=True)
M->>FRR: load_frr_config + start_router()
Note over FRR: zebra registers interfaces<br/>per netns (async)
loop run_and_expect (count=30, wait=1s) [NEW]
M->>FRR: show interface vrf all json
FRR-->>M: interface state
M->>M: check adminUp, operUp, vrfName, ipAddresses
end
alt all interfaces ready
M->>K: ip netns exec vrf ip neigh add
else timeout (30 s)
M->>M: assert fails β setup_module aborts
end
Prompt To Fix All With AIThis is a comment left during a code review.
Path: tests/topotests/zebra_vrf_netns/test_zebra_vrf_netns.py
Line: 97
Comment:
**`ipAddresses` format may not match FRR output**
The wait barrier checks `"ipAddresses": [{"address": OVERLAP_PREFIX}]`, which assumes addresses are returned as a list of dicts. However, the already-existing `test_same_ip_per_vrf()` defensively handles *both* dict (`{"address": ...}`) and string (`"10.0.0.1/24"`) forms in its loop β strongly suggesting the actual FRR JSON format is not guaranteed. If `show interface vrf all json` returns addresses as plain strings, `router_json_cmp` will never find a match, the 30-second polling loop will always exhaust itself, and `setup_module` will fail unconditionally (not just under heavy load), breaking every test in this file.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "tests: Fix zebra_vrf_netns topotest" | Re-trigger Greptile |
|
ci:rerun |
This test is installing configuration in a netns based system and immediately sending mac address additions to the system. Under heavy load interfaces are not fully read in when the neighbor table entry is added causing issues. Modify the test to ensure that the moved interfaces are actually in the appropriate vrf and actually up.