Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facts nw interfaces #318

Merged
merged 11 commits into from
May 19, 2023
3 changes: 3 additions & 0 deletions changelogs/fragments/l3_interfaces.yaml
Charlie-Root marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- vyos-l3_interface_facts - Add support for Tunnel, Bridge and Dummy interfaces. (https://github.com/ansible-collections/vyos.vyos/issues/265)
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ readme: README.md
repository: https://github.com/ansible-collections/vyos.vyos
issues: https://github.com/ansible-collections/vyos.vyos/issues
tags: [vyos, networking]
version: 4.0.3-dev
version: 4.1.0-dev
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def populate_facts(self, connection, ansible_facts, data=None):

objs = []
interface_names = findall(
r"^set interfaces (?:ethernet|bonding|vti|loopback|vxlan|openvpn|wireguard) (?:\'*)(\S+)(?:\'*)",
r"^set interfaces (?:ethernet|bonding|bridge|dummy|tunnel|vti|loopback|vxlan|openvpn|wireguard) (?:\'*)(\S+)(?:\'*)",
data,
M,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def populate_facts(self, connection, ansible_facts, data=None):
# operate on a collection of resource x
objs = []
interface_names = re.findall(
r"set interfaces (?:ethernet|bonding|vti|vxlan) (?:\'*)(\S+)(?:\'*)",
r"set interfaces (?:ethernet|bonding|bridge|dummy|tunnel|vti|vxlan) (?:\'*)(\S+)(?:\'*)",
data,
re.M,
)
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/network/vyos/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ def get_interface_type(interface):
return "openvpn"
elif interface.startswith("wg"):
return "wireguard"
elif interface.startswith("tun"):
return "tunnel"
elif interface.startswith("br"):
return "bridge"
elif interface.startswith("dum"):
return "dummy"


def dict_delete(base, comparable):
Expand Down