From 41e4b0734ca961d18c0a016a50b3c6e598a10dff Mon Sep 17 00:00:00 2001 From: omnom62 <75066712+omnom62@users.noreply.github.com> Date: Mon, 3 Mar 2025 09:10:38 +1000 Subject: T6829 (area interfaces in OSPFv3 1.3-1.5) re-init (#399) * T6829 re-init * re-init T6829 ospfv3 area interface for 1.3- * changelog * changelog fix * Doc is updated * adding 1.4+ support * ospfv3 area interfaces for 1.4+ * fixed ospfv3 facts and added area interface unit test for 1.4 * ospfv3 clean-up * doc updates --- .../unit/modules/network/vyos/test_vyos_ospfv3.py | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'tests/unit') diff --git a/tests/unit/modules/network/vyos/test_vyos_ospfv3.py b/tests/unit/modules/network/vyos/test_vyos_ospfv3.py index 1cf02601..bdd93612 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ospfv3.py +++ b/tests/unit/modules/network/vyos/test_vyos_ospfv3.py @@ -60,6 +60,20 @@ class TestVyosOspfv3Module(TestVyosModule): self.execute_show_command = self.mock_execute_show_command.start() + self.mock_get_os_version = patch( + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.config.ospfv3.ospfv3.get_os_version", + ) + + self.test_version = "1.3" + self.get_os_version = self.mock_get_os_version.start() + self.get_os_version.return_value = self.test_version + self.mock_facts_get_os_version = patch( + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.ospfv3.ospfv3.get_os_version", + ) + self.get_facts_os_version = self.mock_facts_get_os_version.start() + self.get_facts_os_version.return_value = self.test_version + self.maxDiff = None + def tearDown(self): super(TestVyosOspfv3Module, self).tearDown() self.mock_get_resource_connection_config.stop() @@ -94,6 +108,50 @@ class TestVyosOspfv3Module(TestVyosModule): dict(address="2001:db20::/32"), dict(address="2001:db30::/32"), ], + interfaces=[dict(name="eth0")], + ), + dict( + area_id="3", + range=[dict(address="2001:db40::/32")], + ), + ], + ), + state="merged", + ), + ) + commands = [ + "set protocols ospfv3 redistribute bgp", + "set protocols ospfv3 parameters router-id '192.0.2.10'", + "set protocols ospfv3 area 2 range 2001:db10::/32", + "set protocols ospfv3 area 2 range 2001:db20::/32", + "set protocols ospfv3 area 2 range 2001:db30::/32", + "set protocols ospfv3 area '2'", + "set protocols ospfv3 area 2 interface eth0", + "set protocols ospfv3 area 2 export-list export1", + "set protocols ospfv3 area 2 import-list import1", + "set protocols ospfv3 area '3'", + "set protocols ospfv3 area 3 range 2001:db40::/32", + ] + self.execute_module(changed=True, commands=commands) + + def test_vyos_ospfv3_merged_new_config14(self): + self.get_os_version.return_value = "1.4" + set_module_args( + dict( + config=dict( + redistribute=[dict(route_type="bgp")], + parameters=dict(router_id="192.0.2.10"), + areas=[ + dict( + area_id="2", + export_list="export1", + import_list="import1", + range=[ + dict(address="2001:db10::/32"), + dict(address="2001:db20::/32"), + dict(address="2001:db30::/32"), + ], + interfaces=[dict(name="eth0")], ), dict( area_id="3", @@ -111,6 +169,7 @@ class TestVyosOspfv3Module(TestVyosModule): "set protocols ospfv3 area 2 range 2001:db20::/32", "set protocols ospfv3 area 2 range 2001:db30::/32", "set protocols ospfv3 area '2'", + "set protocols ospfv3 interface eth0 area 2", "set protocols ospfv3 area 2 export-list export1", "set protocols ospfv3 area 2 import-list import1", "set protocols ospfv3 area '3'", -- cgit v1.2.3