summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/topotests/all-protocol-startup/r1/ipv4_routes.ref2
-rw-r--r--tests/topotests/all-protocol-startup/r1/zebra.conf5
-rwxr-xr-xtests/topotests/all-protocol-startup/test_all_protocol_startup.py31
3 files changed, 38 insertions, 0 deletions
diff --git a/tests/topotests/all-protocol-startup/r1/ipv4_routes.ref b/tests/topotests/all-protocol-startup/r1/ipv4_routes.ref
index a7d6fe11a6..61d17a61b3 100644
--- a/tests/topotests/all-protocol-startup/r1/ipv4_routes.ref
+++ b/tests/topotests/all-protocol-startup/r1/ipv4_routes.ref
@@ -10,6 +10,8 @@ C>* 192.168.8.0/26 is directly connected, r1-eth8, XX:XX:XX
C>* 192.168.9.0/26 is directly connected, r1-eth9, XX:XX:XX
O 192.168.0.0/24 [110/10] is directly connected, r1-eth0, XX:XX:XX
O 192.168.3.0/26 [110/10] is directly connected, r1-eth3, XX:XX:XX
+S>* 1.1.1.1/32 [1/0] is directly connected, r1-eth0, XX:XX:XX
+S>* 1.1.1.2/32 [1/0] is directly connected, r1-eth1, XX:XX:XX
S>* 4.5.6.10/32 [1/0] via 192.168.0.2, r1-eth0, XX:XX:XX
S>* 4.5.6.11/32 [1/0] via 192.168.0.2, r1-eth0, XX:XX:XX
S>* 4.5.6.12/32 [1/0] is directly connected, r1-eth0, XX:XX:XX
diff --git a/tests/topotests/all-protocol-startup/r1/zebra.conf b/tests/topotests/all-protocol-startup/r1/zebra.conf
index 85c8676964..fbf827604f 100644
--- a/tests/topotests/all-protocol-startup/r1/zebra.conf
+++ b/tests/topotests/all-protocol-startup/r1/zebra.conf
@@ -26,6 +26,11 @@ ipv6 route 4:5::6:12/128 r1-eth0
# by zebra but not installed.
ip route 4.5.6.15/32 192.168.0.2 255
ipv6 route 4:5::6:15/128 fc00:0:0:0::2 255
+
+# Routes to put into a nexthop-group
+ip route 1.1.1.1/32 r1-eth0
+ip route 1.1.1.2/32 r1-eth1
+
!
interface r1-eth0
description to sw0 - no routing protocol
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 9658c080c0..16609221c1 100755
--- a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
+++ b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
@@ -120,6 +120,7 @@ def setup_module(module):
if net['r%s' % i].daemon_available('ldpd'):
# Only test LDPd if it's installed and Kernel >= 4.5
net['r%s' % i].loadConf('ldpd', '%s/r%s/ldpd.conf' % (thisDir, i))
+ net['r%s' % i].loadConf('sharpd')
net['r%s' % i].startRouter()
# For debugging after starting Quagga/FRR daemons, uncomment the next line
@@ -346,6 +347,36 @@ def test_converge_protocols():
# For debugging after starting FRR/Quagga daemons, uncomment the next line
## CLI(net)
+def test_nexthop_groups():
+ global fatal_error
+ global net
+
+ # Skip if previous fatal error condition is raised
+ if (fatal_error != ""):
+ pytest.skip(fatal_error)
+
+ print("\n\n** Verifying Nexthop Groups")
+ print("******************************************\n")
+
+ # Create a lib nexthop-group
+ net["r1"].cmd('vtysh -c "c t" -c "nexthop-group red" -c "nexthop 1.1.1.1" -c "nexthop 1.1.1.2"')
+
+ # Create with sharpd using nexthop-group
+ net["r1"].cmd('vtysh -c "sharp install routes 2.2.2.1 nexthop-group red 1"')
+
+ # Verify route and that zebra created NHGs for and they are valid/installed
+ output = net["r1"].cmd('vtysh -c "show ip route 2.2.2.1/32 nexthop-group"')
+ match = re.search(r"Nexthop Group ID: (\d+)", output);
+ assert match is not None, "Nexthop Group ID not found for sharpd route 2.2.2.1/32"
+
+ nhe_id = int(match.group(1))
+
+ output = net["r1"].cmd('vtysh -c "show nexthop-group rib %d"' % nhe_id)
+ match = re.search(r"Valid", output)
+ assert match is not None, "Nexthop Group ID=%d not marked Valid" % nhe_id
+
+ match = re.search(r"Installed", output)
+ assert match is not None, "Nexthop Group ID=%d not marked Installed" % nhe_id
def test_rip_status():
global fatal_error