From 41fce07c34dcf7746a4ca6888ce0cf6ce2222d70 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 4 Apr 2020 08:14:03 -0400 Subject: [PATCH] tests: Add a route-map test to ensure it accepts an unknown intf name Add a test to route-amps to ensure that it accepts an unknown interface name. Signed-off-by: Donald Sharp --- .../all-protocol-startup/r1/bgpd.conf | 3 + .../all-protocol-startup/r1/ospf6d.conf | 3 + .../all-protocol-startup/r1/ospfd.conf | 3 + .../all-protocol-startup/r1/ripd.conf | 3 + .../all-protocol-startup/r1/ripngd.conf | 3 + .../r1/show_route_map.ref | 73 +++++++++++++++++++ .../all-protocol-startup/r1/zebra.conf | 3 + .../test_all_protocol_startup.py | 31 ++++++++ 8 files changed, 122 insertions(+) create mode 100644 tests/topotests/all-protocol-startup/r1/show_route_map.ref diff --git a/tests/topotests/all-protocol-startup/r1/bgpd.conf b/tests/topotests/all-protocol-startup/r1/bgpd.conf index 4614287f27f9..34cbd086dd68 100644 --- a/tests/topotests/all-protocol-startup/r1/bgpd.conf +++ b/tests/topotests/all-protocol-startup/r1/bgpd.conf @@ -45,3 +45,6 @@ route-map bgp-map permit 20 line vty ! +route-map LIES deny 10 + match interface notpresent +! \ No newline at end of file diff --git a/tests/topotests/all-protocol-startup/r1/ospf6d.conf b/tests/topotests/all-protocol-startup/r1/ospf6d.conf index 941d3016c77a..5c6f071644e0 100644 --- a/tests/topotests/all-protocol-startup/r1/ospf6d.conf +++ b/tests/topotests/all-protocol-startup/r1/ospf6d.conf @@ -14,3 +14,6 @@ router ospf6 ! line vty ! +route-map LIES deny 10 + match interface notpresent +! diff --git a/tests/topotests/all-protocol-startup/r1/ospfd.conf b/tests/topotests/all-protocol-startup/r1/ospfd.conf index 549f36fab430..bac9f616205d 100644 --- a/tests/topotests/all-protocol-startup/r1/ospfd.conf +++ b/tests/topotests/all-protocol-startup/r1/ospfd.conf @@ -11,3 +11,6 @@ router ospf ! line vty ! +route-map LIES deny 10 + match interface notpresent +! diff --git a/tests/topotests/all-protocol-startup/r1/ripd.conf b/tests/topotests/all-protocol-startup/r1/ripd.conf index 4b35630b3664..ace76088738a 100644 --- a/tests/topotests/all-protocol-startup/r1/ripd.conf +++ b/tests/topotests/all-protocol-startup/r1/ripd.conf @@ -10,3 +10,6 @@ router rip line vty ! +route-map LIES deny 10 + match interface notpresent +! diff --git a/tests/topotests/all-protocol-startup/r1/ripngd.conf b/tests/topotests/all-protocol-startup/r1/ripngd.conf index 199fe15ab9cd..2e0aef3a1457 100644 --- a/tests/topotests/all-protocol-startup/r1/ripngd.conf +++ b/tests/topotests/all-protocol-startup/r1/ripngd.conf @@ -9,3 +9,6 @@ router ripng line vty ! +route-map LIES deny 10 + match interface notpresent +! diff --git a/tests/topotests/all-protocol-startup/r1/show_route_map.ref b/tests/topotests/all-protocol-startup/r1/show_route_map.ref new file mode 100644 index 000000000000..25786081d1d7 --- /dev/null +++ b/tests/topotests/all-protocol-startup/r1/show_route_map.ref @@ -0,0 +1,73 @@ +ZEBRA: +route-map: LIES Invoked: 0 Optimization: enabled + deny, sequence 10 Invoked 0 + Match clauses: + interface notpresent + Set clauses: + Call clause: + Action: + Exit routemap +RIP: +route-map: LIES Invoked: 0 Optimization: enabled + deny, sequence 10 Invoked 0 + Match clauses: + interface notpresent + Set clauses: + Call clause: + Action: + Exit routemap +RIPNG: +route-map: LIES Invoked: 0 Optimization: enabled + deny, sequence 10 Invoked 0 + Match clauses: + interface notpresent + Set clauses: + Call clause: + Action: + Exit routemap +OSPF: +route-map: LIES Invoked: 0 Optimization: enabled + deny, sequence 10 Invoked 0 + Match clauses: + interface notpresent + Set clauses: + Call clause: + Action: + Exit routemap +OSPF6: +route-map: LIES Invoked: 0 Optimization: enabled + deny, sequence 10 Invoked 0 + Match clauses: + interface notpresent + Set clauses: + Call clause: + Action: + Exit routemap +BGP: +route-map: LIES Invoked: 0 Optimization: enabled + deny, sequence 10 Invoked 0 + Match clauses: + interface notpresent + Set clauses: + Call clause: + Action: + Exit routemap +route-map: bgp-map Invoked: 0 Optimization: enabled + permit, sequence 10 Invoked 0 + Match clauses: + Set clauses: + community 100:100 additive + local-preference 100 + Call clause: + Action: + Exit routemap + permit, sequence 20 Invoked 0 + Match clauses: + Set clauses: + metric 10 + local-preference 200 + Call clause: + Action: + Exit routemap +ISIS: +SHARP: diff --git a/tests/topotests/all-protocol-startup/r1/zebra.conf b/tests/topotests/all-protocol-startup/r1/zebra.conf index fbf827604f2f..48799bf5dfb9 100644 --- a/tests/topotests/all-protocol-startup/r1/zebra.conf +++ b/tests/topotests/all-protocol-startup/r1/zebra.conf @@ -100,3 +100,6 @@ ipv6 forwarding line vty ! +route-map LIES deny 10 + match interface notpresent +! 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 a671e14e07f0..5f23525a1b0e 100755 --- a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py +++ b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py @@ -891,7 +891,38 @@ def test_bgp_ipv6(): # For debugging after starting FRR/Quagga daemons, uncomment the next line # CLI(net) +def test_route_map(): + global fatal_error + global net + + if (fatal_error != ""): + pytest.skip(fatal_error) + + thisDir = os.path.dirname(os.path.realpath(__file__)) + + print("\n\n** Verifying some basic routemap forward references\n") + print("*******************************************************\n") + failures = 0 + for i in range(1, 2): + refroutemap = '%s/r%s/show_route_map.ref' % (thisDir, i) + if os.path.isfile(refroutemap): + expected = open(refroutemap).read().rstrip() + expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) + + actual = net['r%s' %i].cmd('vtysh -c "show route-map" 2> /dev/null').rstrip() + actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) + + diff = topotest.get_textdiff(actual, expected, + title1="actual show route-map", + title2="expected show route-map") + + if diff: + sys.stderr.write('r%s failed show route-map command Check:\n%s\n' % (i, diff)) + failures += 1 + else: + print("r%s ok" %i) + assert failures == 0, "Show route-map command failed for router r%s:\n%s" % (i, diff) def test_mpls_interfaces(): global fatal_error