From 195ef69bd6ea82b11772991d55f19ed2d1349afc Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Tue, 28 Nov 2023 15:06:55 +0100 Subject: [PATCH] topotests: all_protocol_startup, add nexthop-group test for child groups Add a test for hierarchical nexthop groups. A nexthop group with child nexthop groups is added and modified. Signed-off-by: Philippe Guibert --- .../all_protocol_startup/r1/ip_nht.ref | 12 +++++++ .../test_all_protocol_startup.py | 33 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/tests/topotests/all_protocol_startup/r1/ip_nht.ref b/tests/topotests/all_protocol_startup/r1/ip_nht.ref index 658e39aba9ca..8c4e2d5173df 100644 --- a/tests/topotests/all_protocol_startup/r1/ip_nht.ref +++ b/tests/topotests/all_protocol_startup/r1/ip_nht.ref @@ -73,6 +73,18 @@ VRF default: resolved via connected is directly connected, r1-eth0 (vrf default), weight 1 Client list: static(fd XX) +192.168.0.202 + resolved via connected + is directly connected, r1-eth0 (vrf default) + Client list: pbr(fd XX) +192.168.0.205 + resolved via connected + is directly connected, r1-eth0 (vrf default) + Client list: pbr(fd XX) +192.168.0.207 + resolved via connected + is directly connected, r1-eth0 (vrf default) + Client list: pbr(fd XX) 192.168.0.208 resolved via connected is directly connected, r1-eth0 (vrf default), weight 1 diff --git a/tests/topotests/all_protocol_startup/test_all_protocol_startup.py b/tests/topotests/all_protocol_startup/test_all_protocol_startup.py index 078c9f044d11..6676021a6691 100644 --- a/tests/topotests/all_protocol_startup/test_all_protocol_startup.py +++ b/tests/topotests/all_protocol_startup/test_all_protocol_startup.py @@ -882,6 +882,38 @@ def test_nexthop_groups(): net["r1"].cmd('vtysh -c "sharp remove routes 10.10.10.10 1"') + ## child-group configration + net["r1"].cmd( + 'vtysh -c "configure terminal" \ + -c "nexthop-group GROUP1" \ + -c "child-group ECMP1" \ + -c "child-group ECMP2" \ + -c "exit" \ + -c "nexthop-group ECMP1" \ + -c "nexthop 192.168.0.202 r1-eth0" \ + -c "exit" \ + -c "nexthop-group ECMP2" \ + -c "nexthop 192.168.0.205 r1-eth0"' + ) + net["r1"].cmd('vtysh -c "sharp install routes 8.8.8.8 nexthop-group GROUP1 1\n"') + verify_route_nexthop_group("8.8.8.8/32", ecmp=2) + + net["r1"].cmd( + 'vtysh -c "configure terminal" \ + -c "nexthop-group GROUP1" \ + -c "no child-group ECMP2\n"' + ) + verify_route_nexthop_group("8.8.8.8/32", ecmp=1) + net["r1"].cmd( + 'vtysh -c "configure terminal" \ + -c "nexthop-group ECMP3" \ + -c "nexthop 192.168.0.207 r1-eth0" \ + -c "nexthop-group GROUP1" \ + -c "child-group ECMP3" \ + -c "child-group ECMP2"' + ) + verify_route_nexthop_group("8.8.8.8/32", ecmp=3) + ## Remove all NHG routes net["r1"].cmd('vtysh -c "sharp remove routes 2.2.2.1 1"') @@ -893,6 +925,7 @@ def test_nexthop_groups(): net["r1"].cmd('vtysh -c "sharp remove routes 5.5.5.1 1"') net["r1"].cmd('vtysh -c "sharp remove routes 6.6.6.1 4"') net["r1"].cmd('vtysh -c "sharp remove routes 9.9.9.9 1"') + net["r1"].cmd('vtysh -c "sharp remove routes 8.8.8.8 1"') net["r1"].cmd('vtysh -c "c t" -c "no ip route 6.6.6.0/24 1.1.1.1"')