diff options
author | Björn Hemfjäll <25451914+bgh88@users.noreply.github.com> | 2021-06-22 23:51:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-22 21:51:01 +0000 |
commit | 86b6d04c3d00e93e391bdbc1c7788789a9d4c8fe (patch) | |
tree | 68db4f3955a36a02b20a86211da1c7ddda4e14c4 | |
parent | a8e806d61fc1e4fd88592bee7e501fbe259cca99 (diff) | |
download | vyos.vyos-86b6d04c3d00e93e391bdbc1c7788789a9d4c8fe.tar.gz vyos.vyos-86b6d04c3d00e93e391bdbc1c7788789a9d4c8fe.zip |
static route fixes (#165)
static route fixes
Reviewed-by: https://github.com/apps/ansible-zuul
3 files changed, 11 insertions, 4 deletions
diff --git a/changelogs/fragments/fix_static_routes_next_hop_interface.yaml b/changelogs/fragments/fix_static_routes_next_hop_interface.yaml new file mode 100644 index 00000000..03168b71 --- /dev/null +++ b/changelogs/fragments/fix_static_routes_next_hop_interface.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - change interface to next-hop-interface while generating static_routes nexthop command. diff --git a/plugins/module_utils/network/vyos/config/static_routes/static_routes.py b/plugins/module_utils/network/vyos/config/static_routes/static_routes.py index 61cb4ad5..bd7fd15e 100644 --- a/plugins/module_utils/network/vyos/config/static_routes/static_routes.py +++ b/plugins/module_utils/network/vyos/config/static_routes/static_routes.py @@ -375,7 +375,7 @@ class Static_routes(ConfigBase): key="next-hop", attrib=hop["forward_router_address"] + " " - + element, + + "next-hop-interface", value=hop[element], opr=opr, ) @@ -482,7 +482,7 @@ class Static_routes(ConfigBase): key="next-hop", attrib=hop["forward_router_address"] + " " - + element, + + "next-hop-interface", value=hop[element], remove=True, ) diff --git a/tests/unit/modules/network/vyos/test_vyos_static_routes.py b/tests/unit/modules/network/vyos/test_vyos_static_routes.py index d284b660..d92efa26 100644 --- a/tests/unit/modules/network/vyos/test_vyos_static_routes.py +++ b/tests/unit/modules/network/vyos/test_vyos_static_routes.py @@ -94,7 +94,8 @@ class TestVyosStaticRoutesModule(TestVyosModule): admin_distance=10, ), dict( - forward_router_address="192.0.2.10" + forward_router_address="192.0.2.10", + interface="eth0", ), ], ) @@ -111,6 +112,7 @@ class TestVyosStaticRoutesModule(TestVyosModule): "set protocols static route 192.0.2.48/28 next-hop '192.0.2.9'", "set protocols static route 192.0.2.48/28 next-hop 192.0.2.9 distance '10'", "set protocols static route 192.0.2.48/28 next-hop '192.0.2.10'", + "set protocols static route 192.0.2.48/28 next-hop 192.0.2.10 next-hop-interface 'eth0'", ] self.execute_module(changed=True, commands=commands) @@ -157,7 +159,8 @@ class TestVyosStaticRoutesModule(TestVyosModule): dest="192.0.2.48/28", next_hops=[ dict( - forward_router_address="192.0.2.9" + forward_router_address="192.0.2.9", + interface="eth0", ), dict( forward_router_address="192.0.2.10", @@ -176,6 +179,7 @@ class TestVyosStaticRoutesModule(TestVyosModule): commands = [ "set protocols static route 192.0.2.48/28", "set protocols static route 192.0.2.48/28 next-hop '192.0.2.9'", + "set protocols static route 192.0.2.48/28 next-hop 192.0.2.9 next-hop-interface 'eth0'", "set protocols static route 192.0.2.48/28 next-hop '192.0.2.10'", "set protocols static route 192.0.2.48/28 next-hop 192.0.2.10 distance '10'", ] |