Skip to content

Commit

Permalink
topotests: all_protocol_startup, add nexthop-group test with nhg group
Browse files Browse the repository at this point in the history
An ECMP configuration is tested with nexthop group.

Signed-off-by: Philippe Guibert <[email protected]>
  • Loading branch information
pguibert6WIND committed Jan 22, 2024
1 parent f3c50c0 commit 27d4fdc
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
12 changes: 12 additions & 0 deletions tests/topotests/all_protocol_startup/r1/ip_nht.ref
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ VRF default:
resolved via connected
is directly connected, r1-eth0 (vrf default)
Client list: pbr(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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ def test_nexthop_groups():
## the nhgroups are removed from a configurable timer (zebra nexthop-group keep XX)

tgen.gears["r1"].vtysh_cmd("sharp remove routes 7.7.7.7 1")
tgen.gears["r1"].vtysh_cmd(
output = tgen.gears["r1"].vtysh_cmd(
"""
configure terminal
nexthop-group CONTROL
Expand All @@ -727,6 +727,61 @@ def test_nexthop_groups():
valid is not None
), "nexthop-group CONTROL 'protocol-controlled' command should not be modified"

## multiple nexthop-group dependencies
tgen.gears["r1"].vtysh_cmd(
"""
configure terminal
nexthop-group GROUP1
group ECMP1
group ECMP2
"""
)
tgen.gears["r1"].vtysh_cmd(
"""
configure terminal
nexthop-group ECMP1
protocol-controlled
nexthop 192.168.0.202 r1-eth0
"""
)
tgen.gears["r1"].vtysh_cmd(
"""
configure terminal
nexthop-group ECMP2
protocol-controlled
nexthop 192.168.0.205 r1-eth0
"""
)
tgen.gears["r1"].vtysh_cmd("sharp install routes 8.8.8.8 nexthop-group GROUP1 1")
verify_route_nexthop_group("8.8.8.8/32", ecmp=2)

tgen.gears["r1"].vtysh_cmd(
"""
configure terminal
nexthop-group GROUP1
no group ECMP2
"""
)
verify_route_nexthop_group("8.8.8.8/32", ecmp=1)
tgen.gears["r1"].vtysh_cmd(
"""
configure terminal
nexthop-group ECMP3
protocol-controlled
nexthop 192.168.0.207 r1-eth0
"""
)
tgen.gears["r1"].vtysh_cmd(
"""
configure terminal
nexthop-group GROUP1
group ECMP3
group ECMP2
nexthop 192.168.0.207 r1-eth0
"""
)
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"')
Expand All @@ -739,6 +794,7 @@ def test_nexthop_groups():
net["r1"].cmd('vtysh -c "sharp remove routes 6.6.6.1 4"')
net["r1"].cmd('vtysh -c "c t" -c "no ip route 6.6.6.0/24 1.1.1.1"')
net["r1"].cmd('vtysh -c "sharp remove routes 7.7.7.7 1"')
net["r1"].cmd('vtysh -c "sharp remove routes 8.8.8.8 1"')


def test_rip_status():
Expand Down

0 comments on commit 27d4fdc

Please sign in to comment.