From ad249c39c3259df8c2536dd80f62723eb9c364ef Mon Sep 17 00:00:00 2001 From: omnom62 <75066712+omnom62@users.noreply.github.com> Date: Sun, 2 Mar 2025 22:43:17 +1000 Subject: T7012 ospf_interfaces integration tests (#387) * T7012 init strucuture for ospf_interfaces integration tests * ospf_interfaces unit and integration tests fixes for 1.3- * fixes to v1.4 ospf_interfaces parsers * T7012 integration tests and 1.4+ support for ospf_interfaces --- .../vyos/facts/ospf_interfaces/ospf_interfaces.py | 17 ++++------------- .../network/vyos/rm_templates/ospf_interfaces.py | 4 ++-- .../network/vyos/rm_templates/ospf_interfaces_14.py | 4 ++-- 3 files changed, 8 insertions(+), 17 deletions(-) (limited to 'plugins') diff --git a/plugins/module_utils/network/vyos/facts/ospf_interfaces/ospf_interfaces.py b/plugins/module_utils/network/vyos/facts/ospf_interfaces/ospf_interfaces.py index c0e74895..852e1da7 100644 --- a/plugins/module_utils/network/vyos/facts/ospf_interfaces/ospf_interfaces.py +++ b/plugins/module_utils/network/vyos/facts/ospf_interfaces/ospf_interfaces.py @@ -50,21 +50,12 @@ class Ospf_interfacesFacts(object): def get_config_set_1_4(self, data): """To classify the configurations beased on interface""" - interface_list = [] - config_set = [] - int_string = "" + config_dict = {} for config_line in data.splitlines(): - ospf_int = re.search(r"set protocols (?:ospf|ospfv3) interface (\S+) .*", config_line) + ospf_int = re.search(r"set protocols (?:ospf|ospfv3) interface (\S+).*", config_line) if ospf_int: - if ospf_int.group(1) not in interface_list: - if int_string: - config_set.append(int_string) - interface_list.append(ospf_int.group(1)) - int_string = "" - int_string = int_string + config_line + "\n" - if int_string: - config_set.append(int_string) - return config_set + config_dict[ospf_int.group(1)] = config_dict.get(ospf_int.group(1), "") + config_line + "\n" + return list(config_dict.values()) def get_config_set_1_2(self, data): """To classify the configurations beased on interface""" diff --git a/plugins/module_utils/network/vyos/rm_templates/ospf_interfaces.py b/plugins/module_utils/network/vyos/rm_templates/ospf_interfaces.py index aaaf7ff2..0d7eaf84 100644 --- a/plugins/module_utils/network/vyos/rm_templates/ospf_interfaces.py +++ b/plugins/module_utils/network/vyos/rm_templates/ospf_interfaces.py @@ -509,7 +509,7 @@ class Ospf_interfacesTemplate(NetworkTemplate): \s+(?P\S+) \s+(?Pip|ipv6) \s+(?Pospf|ospfv3) - \s+(?P\'mtu-ignore\') + \s+(?Pmtu-ignore) *$""", re.VERBOSE, ), @@ -697,7 +697,7 @@ class Ospf_interfacesTemplate(NetworkTemplate): \s+(?P\S+) \s+(?Pip|ipv6) \s+(?Pospf|ospfv3) - \s+(?P\'passive\') + \s+(?Ppassive) *$""", re.VERBOSE, ), diff --git a/plugins/module_utils/network/vyos/rm_templates/ospf_interfaces_14.py b/plugins/module_utils/network/vyos/rm_templates/ospf_interfaces_14.py index 7f49d47a..43fae1e9 100644 --- a/plugins/module_utils/network/vyos/rm_templates/ospf_interfaces_14.py +++ b/plugins/module_utils/network/vyos/rm_templates/ospf_interfaces_14.py @@ -432,7 +432,7 @@ class Ospf_interfacesTemplate14(NetworkTemplate): \s+(?Pospf|ospfv3) \s+interface \s+(?P\S+) - \s+(?P\'mtu-ignore\') + \s+(?Pmtu-ignore) *$""", re.VERBOSE, ), @@ -613,7 +613,7 @@ class Ospf_interfacesTemplate14(NetworkTemplate): \s+(?Pospf|ospfv3) \s+interface \s+(?P\S+) - \s+(?P\'passive\') + \s+(?Ppassive) *$""", re.VERBOSE, ), -- cgit v1.2.3