diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/topotests/all_protocol_startup/test_all_protocol_startup.py | 84 | ||||
-rw-r--r-- | tests/topotests/ospf6_topo1_vrf/README.md | 10 | ||||
-rw-r--r-- | tests/topotests/ospf6_topo1_vrf/r1/ospf6d.conf | 8 | ||||
-rw-r--r-- | tests/topotests/ospf6_topo1_vrf/r2/ospf6d.conf | 8 | ||||
-rw-r--r-- | tests/topotests/ospf6_topo1_vrf/r3/ospf6d.conf | 12 | ||||
-rw-r--r-- | tests/topotests/ospf6_topo1_vrf/r4/ospf6d.conf | 8 |
6 files changed, 71 insertions, 59 deletions
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 597e23069..2d75428f1 100644 --- a/tests/topotests/all_protocol_startup/test_all_protocol_startup.py +++ b/tests/topotests/all_protocol_startup/test_all_protocol_startup.py @@ -906,17 +906,25 @@ def test_bgp_summary(): # Read expected result from file expected_original = open(refTableFile).read().rstrip() - for filter in ["", "remote-as internal", "remote-as external", + for arguments in ["", "remote-as internal", "remote-as external", "remote-as 100", "remote-as 123", "neighbor 192.168.7.10", "neighbor 192.168.7.10", "neighbor fc00:0:0:8::1000", - "neighbor 10.0.0.1"]: + "neighbor 10.0.0.1", + "terse", + "remote-as internal terse", + "remote-as external terse", + "remote-as 100 terse", "remote-as 123 terse", + "neighbor 192.168.7.10 terse", "neighbor 192.168.7.10 terse", + "neighbor fc00:0:0:8::1000 terse", + "neighbor 10.0.0.1 terse"]: # Actual output from router actual = ( net["r%s" % i] - .cmd('vtysh -c "show ip bgp summary ' + filter + '" 2> /dev/null') + .cmd('vtysh -c "show ip bgp summary ' + arguments + '" 2> /dev/null') .rstrip() ) + # Mask out "using XXiXX bytes" portion. They are random... actual = re.sub(r"using [0-9]+ bytes", "using XXXX bytes", actual) # Mask out "using XiXXX KiB" portion. They are random... @@ -928,48 +936,55 @@ def test_bgp_summary(): actual = re.sub(r"Total number.*", "", actual) actual = re.sub(r"Displayed.*", "", actual) # Remove IPv4 Unicast Summary (Title only) - actual = re.sub(r"IPv4 Unicast Summary:", "", actual) + actual = re.sub(r"IPv4 Unicast Summary \(VRF default\):", "", actual) # Remove IPv4 Multicast Summary (all of it) - actual = re.sub(r"IPv4 Multicast Summary:", "", actual) + actual = re.sub(r"IPv4 Multicast Summary \(VRF default\):", "", actual) actual = re.sub(r"No IPv4 Multicast neighbor is configured", "", actual) # Remove IPv4 VPN Summary (all of it) - actual = re.sub(r"IPv4 VPN Summary:", "", actual) + actual = re.sub(r"IPv4 VPN Summary \(VRF default\):", "", actual) actual = re.sub(r"No IPv4 VPN neighbor is configured", "", actual) # Remove IPv4 Encap Summary (all of it) - actual = re.sub(r"IPv4 Encap Summary:", "", actual) + actual = re.sub(r"IPv4 Encap Summary \(VRF default\):", "", actual) actual = re.sub(r"No IPv4 Encap neighbor is configured", "", actual) # Remove Unknown Summary (all of it) - actual = re.sub(r"Unknown Summary:", "", actual) + actual = re.sub(r"Unknown Summary \(VRF default\):", "", actual) actual = re.sub(r"No Unknown neighbor is configured", "", actual) - actual = re.sub(r"IPv4 labeled-unicast Summary:", "", actual) + actual = re.sub(r"IPv4 labeled-unicast Summary \(VRF default\):", "", actual) actual = re.sub( r"No IPv4 labeled-unicast neighbor is configured", "", actual ) expected = expected_original - # apply filters on expected output - if "internal" in filter or "remote-as 100" in filter: + # apply argumentss on expected output + if "internal" in arguments or "remote-as 100" in arguments: expected = re.sub(r".+\s+200\s+.+", "", expected) - elif "external" in filter: + elif "external" in arguments: expected = re.sub(r".+\s+100\s+.+Active.+", "", expected) - elif "remote-as 123" in filter: + elif "remote-as 123" in arguments: expected = re.sub( r"(192.168.7.(1|2)0|fc00:0:0:8::(1|2)000).+Active.+", "", expected ) - elif "192.168.7.10" in filter: + expected = re.sub(r"\nNeighbor.+Desc", "", expected) + expected = expected + "% No matching neighbor\n" + elif "192.168.7.10" in arguments: expected = re.sub( r"(192.168.7.20|fc00:0:0:8::(1|2)000).+Active.+", "", expected ) - elif "fc00:0:0:8::1000" in filter: + elif "fc00:0:0:8::1000" in arguments: expected = re.sub( r"(192.168.7.(1|2)0|fc00:0:0:8::2000).+Active.+", "", expected ) - elif "10.0.0.1" in filter: - expected = "No such neighbor in this view/vrf" + elif "10.0.0.1" in arguments: + expected = "No such neighbor in VRF default" + + if "terse" in arguments: + expected = re.sub(r"BGP table version .+", "", expected) + expected = re.sub(r"RIB entries .+", "", expected) + expected = re.sub(r"Peers [0-9]+, using .+", "", expected) # Strip empty lines actual = actual.lstrip().rstrip() @@ -978,13 +993,17 @@ def test_bgp_summary(): expected = re.sub(r"\n+", "\n", expected) # reapply initial formatting - actual = re.sub(r"KiB of memory\n", "KiB of memory\n\n", actual) - expected = re.sub(r"KiB of memory\n", "KiB of memory\n\n", expected) + if "terse" in arguments: + actual = re.sub(r" vrf-id 0\n", " vrf-id 0\n\n", actual) + expected = re.sub(r" vrf-id 0\n", " vrf-id 0\n\n", expected) + else: + actual = re.sub(r"KiB of memory\n", "KiB of memory\n\n", actual) + expected = re.sub(r"KiB of memory\n", "KiB of memory\n\n", expected) # realign expected neighbor columns if needed try: - idx_actual = re.search(r"\n(Neighbor\s+V\s+)", actual).group(1).find("V") - idx_expected = re.search(r"\n(Neighbor\s+V\s+)", expected).group(1).find("V") + idx_actual = re.search(r"(Neighbor\s+V\s+)", actual).group(1).find("V") + idx_expected = re.search(r"(Neighbor\s+V\s+)", expected).group(1).find("V") idx_diff = idx_expected - idx_actual if idx_diff > 0: # Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd @@ -1002,8 +1021,8 @@ def test_bgp_summary(): diff = topotest.get_textdiff( actual, expected, - title1="actual SHOW IP BGP SUMMARY " + filter.upper() , - title2="expected SHOW IP BGP SUMMARY " + filter.upper(), + title1="actual SHOW IP BGP SUMMARY " + arguments.upper() , + title2="expected SHOW IP BGP SUMMARY " + arguments.upper(), ) # Empty string if it matches, otherwise diff contains unified diff @@ -1020,13 +1039,6 @@ def test_bgp_summary(): diff, ) - # Actual output from router - actual = ( - net["r%s" % i] - .cmd('vtysh -c "show ip bgp summary" 2> /dev/null') - .rstrip() - ) - # Make sure that all daemons are running for i in range(1, 2): fatal_error = net["r%s" % i].checkRouterRunning() @@ -1074,22 +1086,22 @@ def test_bgp_ipv6_summary(): actual = re.sub(r"Total number.*", "", actual) actual = re.sub(r"Displayed.*", "", actual) # Remove IPv4 Unicast Summary (Title only) - actual = re.sub(r"IPv6 Unicast Summary:", "", actual) + actual = re.sub(r"IPv6 Unicast Summary \(VRF default\):", "", actual) # Remove IPv4 Multicast Summary (all of it) - actual = re.sub(r"IPv6 Multicast Summary:", "", actual) + actual = re.sub(r"IPv6 Multicast Summary \(VRF default\):", "", actual) actual = re.sub(r"No IPv6 Multicast neighbor is configured", "", actual) # Remove IPv4 VPN Summary (all of it) - actual = re.sub(r"IPv6 VPN Summary:", "", actual) + actual = re.sub(r"IPv6 VPN Summary \(VRF default\):", "", actual) actual = re.sub(r"No IPv6 VPN neighbor is configured", "", actual) # Remove IPv4 Encap Summary (all of it) - actual = re.sub(r"IPv6 Encap Summary:", "", actual) + actual = re.sub(r"IPv6 Encap Summary \(VRF default\):", "", actual) actual = re.sub(r"No IPv6 Encap neighbor is configured", "", actual) # Remove Unknown Summary (all of it) - actual = re.sub(r"Unknown Summary:", "", actual) + actual = re.sub(r"Unknown Summary \(VRF default\):", "", actual) actual = re.sub(r"No Unknown neighbor is configured", "", actual) # Remove Labeled Unicast Summary (all of it) - actual = re.sub(r"IPv6 labeled-unicast Summary:", "", actual) + actual = re.sub(r"IPv6 labeled-unicast Summary \(VRF default\):", "", actual) actual = re.sub( r"No IPv6 labeled-unicast neighbor is configured", "", actual ) diff --git a/tests/topotests/ospf6_topo1_vrf/README.md b/tests/topotests/ospf6_topo1_vrf/README.md index 3ed0b8fbe..18bca5c54 100644 --- a/tests/topotests/ospf6_topo1_vrf/README.md +++ b/tests/topotests/ospf6_topo1_vrf/README.md @@ -54,10 +54,12 @@ Simplified `R1` config (R1 is similar) hostname r1 ! interface r1-stubnet vrf r1-cust1 + ipv6 ospf6 area 0.0.0.0 ipv6 address fc00:1:1:1::1/64 ipv6 ospf6 network broadcast ! interface r1-sw5 vrf r1-cust1 + ipv6 ospf6 area 0.0.0.0 ipv6 address fc00:a:a:a::1/64 ipv6 ospf6 network broadcast ! @@ -65,8 +67,6 @@ Simplified `R1` config (R1 is similar) router-id 10.0.0.1 log-adjacency-changes detail redistribute static - interface r1-stubnet area 0.0.0.0 - interface r1-sw5 area 0.0.0.0 ! ipv6 route fc00:1111:1111:1111::/64 fc00:1:1:1::1234 vrf r1-cust1 @@ -75,14 +75,17 @@ Simplified `R3` config hostname r3 ! interface r3-stubnet vrf r3-cust1 + ipv6 ospf6 area 0.0.0.0 ipv6 address fc00:3:3:3::3/64 ipv6 ospf6 network broadcast ! interface r3-sw5 vrf r3-cust1 + ipv6 ospf6 area 0.0.0.0 ipv6 address fc00:a:a:a::3/64 ipv6 ospf6 network broadcast ! interface r3-sw6 vrf r3-cust1 + ipv6 ospf6 area 0.0.0.1 ipv6 address fc00:b:b:b::3/64 ipv6 ospf6 network broadcast ! @@ -90,9 +93,6 @@ Simplified `R3` config router-id 10.0.0.3 log-adjacency-changes detail redistribute static - interface r3-stubnet area 0.0.0.0 - interface r3-sw5 area 0.0.0.0 - interface r3-sw6 area 0.0.0.1 ! ipv6 route fc00:3333:3333:3333::/64 fc00:3:3:3::1234 vrf r3-cust1 diff --git a/tests/topotests/ospf6_topo1_vrf/r1/ospf6d.conf b/tests/topotests/ospf6_topo1_vrf/r1/ospf6d.conf index ed480354e..83bdfb7c8 100644 --- a/tests/topotests/ospf6_topo1_vrf/r1/ospf6d.conf +++ b/tests/topotests/ospf6_topo1_vrf/r1/ospf6d.conf @@ -9,12 +9,14 @@ debug ospf6 neighbor debug ospf6 route table debug ospf6 flooding ! -interface r1-stubnet vrf r1-cust1 +interface r1-stubnet + ipv6 ospf6 area 0.0.0.0 ipv6 ospf6 network broadcast ipv6 ospf6 hello-interval 2 ipv6 ospf6 dead-interval 10 ! -interface r1-sw5 vrf r1-cust1 +interface r1-sw5 + ipv6 ospf6 area 0.0.0.0 ipv6 ospf6 network broadcast ipv6 ospf6 hello-interval 2 ipv6 ospf6 dead-interval 10 @@ -23,8 +25,6 @@ router ospf6 vrf r1-cust1 ospf6 router-id 10.0.0.1 log-adjacency-changes detail redistribute static - interface r1-stubnet area 0.0.0.0 - interface r1-sw5 area 0.0.0.0 ! line vty exec-timeout 0 0 diff --git a/tests/topotests/ospf6_topo1_vrf/r2/ospf6d.conf b/tests/topotests/ospf6_topo1_vrf/r2/ospf6d.conf index 485771e7d..7fd01aa0c 100644 --- a/tests/topotests/ospf6_topo1_vrf/r2/ospf6d.conf +++ b/tests/topotests/ospf6_topo1_vrf/r2/ospf6d.conf @@ -9,12 +9,14 @@ debug ospf6 neighbor debug ospf6 route table debug ospf6 flooding ! -interface r2-stubnet vrf r2-cust1 +interface r2-stubnet + ipv6 ospf6 area 0.0.0.0 ipv6 ospf6 network broadcast ipv6 ospf6 dead-interval 10 ipv6 ospf6 hello-interval 2 ! -interface r2-sw5 vrf r2-cust1 +interface r2-sw5 + ipv6 ospf6 area 0.0.0.0 ipv6 ospf6 network broadcast ipv6 ospf6 dead-interval 10 ipv6 ospf6 hello-interval 2 @@ -23,8 +25,6 @@ router ospf6 vrf r2-cust1 ospf6 router-id 10.0.0.2 log-adjacency-changes detail redistribute static - interface r2-stubnet area 0.0.0.0 - interface r2-sw5 area 0.0.0.0 ! line vty exec-timeout 0 0 diff --git a/tests/topotests/ospf6_topo1_vrf/r3/ospf6d.conf b/tests/topotests/ospf6_topo1_vrf/r3/ospf6d.conf index f5837bf6f..df5aed3a6 100644 --- a/tests/topotests/ospf6_topo1_vrf/r3/ospf6d.conf +++ b/tests/topotests/ospf6_topo1_vrf/r3/ospf6d.conf @@ -9,17 +9,20 @@ debug ospf6 neighbor debug ospf6 route table debug ospf6 flooding ! -interface r3-stubnet vrf r3-cust1 +interface r3-stubnet + ipv6 ospf6 area 0.0.0.0 ipv6 ospf6 network broadcast ipv6 ospf6 dead-interval 10 ipv6 ospf6 hello-interval 2 ! -interface r3-sw5 vrf r3-cust1 +interface r3-sw5 + ipv6 ospf6 area 0.0.0.0 ipv6 ospf6 network broadcast ipv6 ospf6 dead-interval 10 ipv6 ospf6 hello-interval 2 ! -interface r3-sw6 vrf r3-cust1 +interface r3-sw6 + ipv6 ospf6 area 0.0.0.1 ipv6 ospf6 network broadcast ipv6 ospf6 dead-interval 10 ipv6 ospf6 hello-interval 2 @@ -28,9 +31,6 @@ router ospf6 vrf r3-cust1 ospf6 router-id 10.0.0.3 log-adjacency-changes detail redistribute static - interface r3-stubnet area 0.0.0.0 - interface r3-sw5 area 0.0.0.0 - interface r3-sw6 area 0.0.0.1 ! line vty exec-timeout 0 0 diff --git a/tests/topotests/ospf6_topo1_vrf/r4/ospf6d.conf b/tests/topotests/ospf6_topo1_vrf/r4/ospf6d.conf index ab67d06ff..465defb40 100644 --- a/tests/topotests/ospf6_topo1_vrf/r4/ospf6d.conf +++ b/tests/topotests/ospf6_topo1_vrf/r4/ospf6d.conf @@ -9,12 +9,14 @@ debug ospf6 neighbor debug ospf6 route table debug ospf6 flooding ! -interface r4-stubnet vrf r4-cust1 +interface r4-stubnet + ipv6 ospf6 area 0.0.0.1 ipv6 ospf6 network broadcast ipv6 ospf6 hello-interval 2 ipv6 ospf6 dead-interval 10 ! -interface r4-sw6 vrf r4-cust1 +interface r4-sw6 + ipv6 ospf6 area 0.0.0.1 ipv6 ospf6 network broadcast ipv6 ospf6 hello-interval 2 ipv6 ospf6 dead-interval 10 @@ -23,8 +25,6 @@ router ospf6 vrf r4-cust1 ospf6 router-id 10.0.0.4 log-adjacency-changes detail redistribute static - interface r4-stubnet area 0.0.0.1 - interface r4-sw6 area 0.0.0.1 ! line vty exec-timeout 0 0 |