diff options
author | omnom62 <75066712+omnom62@users.noreply.github.com> | 2025-03-02 22:43:17 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-02 07:43:17 -0500 |
commit | ad249c39c3259df8c2536dd80f62723eb9c364ef (patch) | |
tree | 36d1a9ef0a9eb4d60dea2c970c1c0f077c604791 /plugins | |
parent | cfc4c93253d57de953c4cae7acc5f2b2890614ac (diff) | |
download | vyos.vyos-ad249c39c3259df8c2536dd80f62723eb9c364ef.tar.gz vyos.vyos-ad249c39c3259df8c2536dd80f62723eb9c364ef.zip |
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
Diffstat (limited to 'plugins')
3 files changed, 8 insertions, 17 deletions
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<name>\S+) \s+(?P<afi>ip|ipv6) \s+(?P<proto>ospf|ospfv3) - \s+(?P<mtu>\'mtu-ignore\') + \s+(?P<mtu>mtu-ignore) *$""", re.VERBOSE, ), @@ -697,7 +697,7 @@ class Ospf_interfacesTemplate(NetworkTemplate): \s+(?P<name>\S+) \s+(?P<afi>ip|ipv6) \s+(?P<proto>ospf|ospfv3) - \s+(?P<pass>\'passive\') + \s+(?P<pass>passive) *$""", 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+(?P<proto>ospf|ospfv3) \s+interface \s+(?P<name>\S+) - \s+(?P<mtu>\'mtu-ignore\') + \s+(?P<mtu>mtu-ignore) *$""", re.VERBOSE, ), @@ -613,7 +613,7 @@ class Ospf_interfacesTemplate14(NetworkTemplate): \s+(?P<proto>ospf|ospfv3) \s+interface \s+(?P<name>\S+) - \s+(?P<pass>\'passive\') + \s+(?P<pass>passive) *$""", re.VERBOSE, ), |