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
# 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
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
# 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