From 9d5f8043ef86abb5584fb2b4cb2955e8df4501c1 Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Thu, 8 Oct 2020 12:09:25 -0400 Subject: Support openvpn vtu interface (#86) Support openvpn vtu interface Reviewed-by: https://github.com/apps/ansible-zuul --- plugins/module_utils/network/vyos/facts/interfaces/interfaces.py | 9 +++++++-- plugins/module_utils/network/vyos/utils/utils.py | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/module_utils/network/vyos/facts/interfaces/interfaces.py b/plugins/module_utils/network/vyos/facts/interfaces/interfaces.py index 358dd9d..13f22e1 100644 --- a/plugins/module_utils/network/vyos/facts/interfaces/interfaces.py +++ b/plugins/module_utils/network/vyos/facts/interfaces/interfaces.py @@ -42,6 +42,11 @@ class InterfacesFacts(object): self.generated_spec = utils.generate_dict(facts_argument_spec) + def get_device_data(self, connection): + + data = connection.get_config(flags=["| grep interfaces"]) + return data + def populate_facts(self, connection, ansible_facts, data=None): """Populate the facts for interfaces :param connection: the device connection @@ -51,11 +56,11 @@ class InterfacesFacts(object): :returns: facts """ if not data: - data = connection.get_config(flags=["| grep interfaces"]) + data = self.get_device_data(connection) objs = [] interface_names = findall( - r"^set interfaces (?:ethernet|bonding|vti|loopback|vxlan) (?:\'*)(\S+)(?:\'*)", + r"^set interfaces (?:ethernet|bonding|vti|loopback|vxlan|openvpn) (?:\'*)(\S+)(?:\'*)", data, M, ) diff --git a/plugins/module_utils/network/vyos/utils/utils.py b/plugins/module_utils/network/vyos/utils/utils.py index bcf6fc2..7ce4688 100644 --- a/plugins/module_utils/network/vyos/utils/utils.py +++ b/plugins/module_utils/network/vyos/utils/utils.py @@ -31,6 +31,8 @@ def get_interface_type(interface): return "vti" elif interface.startswith("lo"): return "loopback" + elif interface.startswith("vtun"): + return "openvpn" def dict_delete(base, comparable): -- cgit v1.2.3