diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2021-08-26 18:10:41 +0200 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2021-08-26 20:05:53 +0200 |
commit | 476e957517c18b8dec53ba0fac9b3f4778f4ed78 (patch) | |
tree | 098374ee9c3c56337b0e9e779ed3d57728f432d3 /tests/topotests/ospf6_topo2 | |
parent | Merge pull request #9331 from idryzhov/explicit-exit (diff) | |
download | frr-476e957517c18b8dec53ba0fac9b3f4778f4ed78.tar.xz frr-476e957517c18b8dec53ba0fac9b3f4778f4ed78.zip |
ospf6d: extend the "redistribute" command with more options
Add the "metric" and "metric-type" options to the "redistribute"
command.
This is a small commit since the logic of setting the metric
value and type of external routes was already present due to the
implementation of the "default-information originate" command months
ago. This commit merely extends the "redistribute" command to
leverage that functionality.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'tests/topotests/ospf6_topo2')
-rw-r--r-- | tests/topotests/ospf6_topo2/test_ospf6_topo2.py | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/tests/topotests/ospf6_topo2/test_ospf6_topo2.py b/tests/topotests/ospf6_topo2/test_ospf6_topo2.py index b6c8cf3e7..8c5f1e6f6 100644 --- a/tests/topotests/ospf6_topo2/test_ospf6_topo2.py +++ b/tests/topotests/ospf6_topo2/test_ospf6_topo2.py @@ -73,15 +73,20 @@ def expect_lsas(router, area, lsas, wait=5, extra_params=""): assert result is None, assertmsg -def expect_ospfv3_routes(router, routes, wait=5): +def expect_ospfv3_routes(router, routes, wait=5, detail=False): "Run command `ipv6 ospf6 route` and expect route with type." tgen = get_topogen() + if detail == False: + cmd = "show ipv6 ospf6 route json" + else: + cmd = "show ipv6 ospf6 route detail json" + logger.info("waiting OSPFv3 router '{}' route".format(router)) test_func = partial( topotest.router_json_cmp, tgen.gears[router], - "show ipv6 ospf6 route json", + cmd, {"routes": routes} ) _, result = topotest.run_and_expect(test_func, None, count=wait, wait=1) @@ -236,6 +241,51 @@ def test_ospf6_default_route(): expect_route("r1", "::/0", metric + 10) +def test_redistribute_metrics(): + """ + Test that the configured metrics are honored when a static route is + redistributed. + """ + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Add new static route on r3. + config = """ + configure terminal + ipv6 route 2001:db8:500::/64 Null0 + """ + tgen.gears["r3"].vtysh_cmd(config) + + route = { + "2001:db8:500::/64": { + "metricType":2, + "metricCost":10, + } + } + logger.info("Expecting AS-external route 2001:db8:500::/64 to show up with default metrics") + expect_ospfv3_routes("r2", route, wait=30, detail=True) + + # Change the metric of redistributed routes of the static type on r3. + config = """ + configure terminal + router ospf6 + redistribute static metric 50 metric-type 1 + """ + tgen.gears["r3"].vtysh_cmd(config) + + # Check if r3 reinstalled 2001:db8:500::/64 using the new metric type and value. + route = { + "2001:db8:500::/64": { + "metricType":1, + "metricCost":60, + } + } + logger.info("Expecting AS-external route 2001:db8:500::/64 to show up with updated metric type and value") + expect_ospfv3_routes("r2", route, wait=30, detail=True) + + + def test_nssa_lsa_type7(): """ Test that static route gets announced as external route when redistributed |