diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/topotests/all-protocol-startup/r1/ip_nht.ref | 12 | ||||
| -rw-r--r-- | tests/topotests/all-protocol-startup/test_all_protocol_startup.py | 52 | ||||
| -rw-r--r-- | tests/topotests/lib/snmptest.py | 5 | ||||
| -rw-r--r-- | tests/topotests/pytest.ini | 2 |
4 files changed, 66 insertions, 5 deletions
diff --git a/tests/topotests/all-protocol-startup/r1/ip_nht.ref b/tests/topotests/all-protocol-startup/r1/ip_nht.ref index 098e3bf387..1da4da4df5 100644 --- a/tests/topotests/all-protocol-startup/r1/ip_nht.ref +++ b/tests/topotests/all-protocol-startup/r1/ip_nht.ref @@ -39,6 +39,18 @@ 4.4.4.2 unresolved Client list: pbr(fd XX) +6.6.6.1 + unresolved + Client list: pbr(fd XX) +6.6.6.2 + unresolved + Client list: pbr(fd XX) +6.6.6.3 + unresolved + Client list: pbr(fd XX) +6.6.6.4 + unresolved + Client list: pbr(fd XX) 192.168.0.2 resolved via connected is directly connected, r1-eth0 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 24bef07ec2..5942aca71d 100644 --- a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py +++ b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py @@ -82,6 +82,7 @@ class NetworkTopo(Topo): ## ##################################################### + @pytest.mark.isis @pytest.mark.ospf @pytest.mark.rip @@ -344,7 +345,7 @@ def test_converge_protocols(): actual = ( net["r%s" % i] .cmd( - 'vtysh -c "show ip route" | /usr/bin/tail -n +7 | env LC_ALL=en_US.UTF-8 sort 2> /dev/null' + 'vtysh -c "show ip route" | sed -e \'/^Codes: /,/^\s*$/d\' | env LC_ALL=en_US.UTF-8 sort 2> /dev/null' ) .rstrip() ) @@ -375,7 +376,7 @@ def test_converge_protocols(): actual = ( net["r%s" % i] .cmd( - 'vtysh -c "show ipv6 route" | /usr/bin/tail -n +7 | env LC_ALL=en_US.UTF-8 sort 2> /dev/null' + 'vtysh -c "show ipv6 route" | sed -e \'/^Codes: /,/^\s*$/d\' | env LC_ALL=en_US.UTF-8 sort 2> /dev/null' ) .rstrip() ) @@ -537,6 +538,51 @@ def test_nexthop_groups(): verify_route_nexthop_group("5.5.5.1/32") + ## 4-way ECMP Routes Pointing to Each Other + + # This is to check for a bug with NH resolution where + # routes would infintely resolve to each other blowing + # up the resolved-> nexthop pointer. + + net["r1"].cmd( + 'vtysh -c "c t" -c "nexthop-group infinite-recursive" -c "nexthop 6.6.6.1" -c "nexthop 6.6.6.2" \ + -c "nexthop 6.6.6.3" -c "nexthop 6.6.6.4"' + ) + + # static route nexthops can recurse to + + net["r1"].cmd('vtysh -c "c t" -c "ip route 6.6.6.0/24 1.1.1.1"') + + # Make routes that point to themselves in ecmp + + net["r1"].cmd( + 'vtysh -c "sharp install routes 6.6.6.4 nexthop-group infinite-recursive 1"' + ) + + net["r1"].cmd( + 'vtysh -c "sharp install routes 6.6.6.3 nexthop-group infinite-recursive 1"' + ) + + net["r1"].cmd( + 'vtysh -c "sharp install routes 6.6.6.2 nexthop-group infinite-recursive 1"' + ) + + net["r1"].cmd( + 'vtysh -c "sharp install routes 6.6.6.1 nexthop-group infinite-recursive 1"' + ) + + # Get routes and test if has too many (duplicate) nexthops + nhg_id = route_get_nhg_id("6.6.6.1/32") + output = net["r1"].cmd('vtysh -c "show nexthop-group rib %d"' % nhg_id) + + dups = re.findall(r"(via 1\.1\.1\.1)", output) + + # Should find 3, itself is inactive + assert len(dups) == 3, ( + "Route 6.6.6.1/32 with Nexthop Group ID=%d has wrong number of resolved nexthops" + % nhg_id + ) + ##CLI(net) ## Remove all NHG routes @@ -548,6 +594,8 @@ def test_nexthop_groups(): net["r1"].cmd('vtysh -c "sharp remove routes 4.4.4.1 1"') net["r1"].cmd('vtysh -c "sharp remove routes 4.4.4.2 1"') 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 "c t" -c "no ip route 6.6.6.0/24 1.1.1.1"') def test_rip_status(): diff --git a/tests/topotests/lib/snmptest.py b/tests/topotests/lib/snmptest.py index 910e901ade..1bf83c2aea 100644 --- a/tests/topotests/lib/snmptest.py +++ b/tests/topotests/lib/snmptest.py @@ -118,7 +118,7 @@ class SnmpTester(object): def test_oid_walk(self, oid, values, oids=None): results_dict, results_list = self.walk(oid) - print("res {}".format(results_dict)) + print("test_oid_walk: {} {}".format(oid, results_dict)) if oids is not None: index = 0 for oid in oids: @@ -127,4 +127,5 @@ class SnmpTester(object): index += 1 return True - return results_list == values + # Return true if 'values' is a subset of 'results_list' + return results_list[: len(values)] == values diff --git a/tests/topotests/pytest.ini b/tests/topotests/pytest.ini index 0c45a09445..f400e51b92 100644 --- a/tests/topotests/pytest.ini +++ b/tests/topotests/pytest.ini @@ -1,6 +1,6 @@ # Skip pytests example directory [pytest] -norecursedirs = .git example-test example-topojson-test lib docker +norecursedirs = .git example-test example-topojson-test lib docker isis-lsp-bits-topo1 # Markers # |
