diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2020-04-14 23:37:47 -0300 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-14 23:37:47 -0300 | 
| commit | 260616d55d96fab302c678ee78e0a58ca60b0aa1 (patch) | |
| tree | 5d501d61bffbd389b46342988f8710c087a723ab /tests | |
| parent | 5b894ab01f1a11801961268121c50148f74790bc (diff) | |
| parent | 41fce07c34dcf7746a4ca6888ce0cf6ce2222d70 (diff) | |
Merge pull request #6154 from donaldsharp/check_interface_working
tests: Add a route-map test to ensure it accepts an unknown intf name
Diffstat (limited to 'tests')
8 files changed, 122 insertions, 0 deletions
diff --git a/tests/topotests/all-protocol-startup/r1/bgpd.conf b/tests/topotests/all-protocol-startup/r1/bgpd.conf index 4614287f27..34cbd086dd 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 941d3016c7..5c6f071644 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 549f36fab4..bac9f61620 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 4b35630b36..ace7608873 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 199fe15ab9..2e0aef3a14 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 0000000000..25786081d1 --- /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 f283590ddf..858a8a585d 100644 --- a/tests/topotests/all-protocol-startup/r1/zebra.conf +++ b/tests/topotests/all-protocol-startup/r1/zebra.conf @@ -109,3 +109,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 a671e14e07..5f23525a1b 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  | 
