summaryrefslogtreecommitdiff
path: root/plugins/module_utils
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/module_utils')
-rw-r--r--plugins/module_utils/network/vyos/argspec/bgp_address_family/bgp_address_family.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/bgp_global/bgp_global.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/facts/facts.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/firewall_global/firewall_global.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/firewall_interfaces/firewall_interfaces.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py3
-rw-r--r--plugins/module_utils/network/vyos/argspec/hostname/hostname.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/l3_interfaces/l3_interfaces.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/logging_global/logging_global.py3
-rw-r--r--plugins/module_utils/network/vyos/argspec/ntp_global/ntp_global.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/ospf_interfaces/ospf_interfaces.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py7
-rw-r--r--plugins/module_utils/network/vyos/argspec/ospfv3/ospfv3.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/prefix_lists/prefix_lists.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/route_maps/route_maps.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/snmp_server/snmp_server.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/static_routes/static_routes.py3
-rw-r--r--plugins/module_utils/network/vyos/config/bgp_address_family/bgp_address_family.py11
-rw-r--r--plugins/module_utils/network/vyos/config/bgp_global/bgp_global.py11
-rw-r--r--plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py54
-rw-r--r--plugins/module_utils/network/vyos/config/firewall_interfaces/firewall_interfaces.py21
-rw-r--r--plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py33
-rw-r--r--plugins/module_utils/network/vyos/config/hostname/hostname.py1
-rw-r--r--plugins/module_utils/network/vyos/config/interfaces/interfaces.py21
-rw-r--r--plugins/module_utils/network/vyos/config/l3_interfaces/l3_interfaces.py17
-rw-r--r--plugins/module_utils/network/vyos/config/lag_interfaces/lag_interfaces.py23
-rw-r--r--plugins/module_utils/network/vyos/config/lldp_global/lldp_global.py9
-rw-r--r--plugins/module_utils/network/vyos/config/lldp_interfaces/lldp_interfaces.py23
-rw-r--r--plugins/module_utils/network/vyos/config/logging_global/logging_global.py3
-rw-r--r--plugins/module_utils/network/vyos/config/ntp_global/ntp_global.py5
-rw-r--r--plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py1
-rw-r--r--plugins/module_utils/network/vyos/config/ospfv2/ospfv2.py49
-rw-r--r--plugins/module_utils/network/vyos/config/ospfv3/ospfv3.py21
-rw-r--r--plugins/module_utils/network/vyos/config/prefix_lists/prefix_lists.py8
-rw-r--r--plugins/module_utils/network/vyos/config/route_maps/route_maps.py1
-rw-r--r--plugins/module_utils/network/vyos/config/snmp_server/snmp_server.py23
-rw-r--r--plugins/module_utils/network/vyos/config/static_routes/static_routes.py31
-rw-r--r--plugins/module_utils/network/vyos/facts/bgp_address_family/bgp_address_family.py4
-rw-r--r--plugins/module_utils/network/vyos/facts/bgp_global/bgp_global.py3
-rw-r--r--plugins/module_utils/network/vyos/facts/facts.py2
-rw-r--r--plugins/module_utils/network/vyos/facts/firewall_global/firewall_global.py9
-rw-r--r--plugins/module_utils/network/vyos/facts/firewall_interfaces/firewall_interfaces.py1
-rw-r--r--plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py2
-rw-r--r--plugins/module_utils/network/vyos/facts/hostname/hostname.py3
-rw-r--r--plugins/module_utils/network/vyos/facts/interfaces/interfaces.py1
-rw-r--r--plugins/module_utils/network/vyos/facts/l3_interfaces/l3_interfaces.py2
-rw-r--r--plugins/module_utils/network/vyos/facts/lag_interfaces/lag_interfaces.py1
-rw-r--r--plugins/module_utils/network/vyos/facts/legacy/base.py1
-rw-r--r--plugins/module_utils/network/vyos/facts/lldp_global/lldp_global.py1
-rw-r--r--plugins/module_utils/network/vyos/facts/lldp_interfaces/lldp_interfaces.py4
-rw-r--r--plugins/module_utils/network/vyos/facts/logging_global/logging_global.py7
-rw-r--r--plugins/module_utils/network/vyos/facts/ntp_global/ntp_global.py3
-rw-r--r--plugins/module_utils/network/vyos/facts/ospf_interfaces/ospf_interfaces.py6
-rw-r--r--plugins/module_utils/network/vyos/facts/ospfv2/ospfv2.py4
-rw-r--r--plugins/module_utils/network/vyos/facts/ospfv3/ospfv3.py1
-rw-r--r--plugins/module_utils/network/vyos/facts/prefix_lists/prefix_lists.py3
-rw-r--r--plugins/module_utils/network/vyos/facts/route_maps/route_maps.py1
-rw-r--r--plugins/module_utils/network/vyos/facts/snmp_server/snmp_server.py3
-rw-r--r--plugins/module_utils/network/vyos/facts/static_routes/static_routes.py1
-rw-r--r--plugins/module_utils/network/vyos/rm_templates/bgp_address_family.py420
-rw-r--r--plugins/module_utils/network/vyos/rm_templates/bgp_global.py544
-rw-r--r--plugins/module_utils/network/vyos/rm_templates/hostname.py13
-rw-r--r--plugins/module_utils/network/vyos/rm_templates/logging_global.py174
-rw-r--r--plugins/module_utils/network/vyos/rm_templates/ntp_global.py49
-rw-r--r--plugins/module_utils/network/vyos/rm_templates/ospf_interfaces.py136
-rw-r--r--plugins/module_utils/network/vyos/rm_templates/prefix_lists.py116
-rw-r--r--plugins/module_utils/network/vyos/rm_templates/route_maps.py635
-rw-r--r--plugins/module_utils/network/vyos/rm_templates/snmp_server.py229
-rw-r--r--plugins/module_utils/network/vyos/utils/utils.py2
-rw-r--r--plugins/module_utils/network/vyos/vyos.py2
74 files changed, 1496 insertions, 1286 deletions
diff --git a/plugins/module_utils/network/vyos/argspec/bgp_address_family/bgp_address_family.py b/plugins/module_utils/network/vyos/argspec/bgp_address_family/bgp_address_family.py
index 8cbbc50..9868fc6 100644
--- a/plugins/module_utils/network/vyos/argspec/bgp_address_family/bgp_address_family.py
+++ b/plugins/module_utils/network/vyos/argspec/bgp_address_family/bgp_address_family.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
#############################################
diff --git a/plugins/module_utils/network/vyos/argspec/bgp_global/bgp_global.py b/plugins/module_utils/network/vyos/argspec/bgp_global/bgp_global.py
index da56aa9..22af639 100644
--- a/plugins/module_utils/network/vyos/argspec/bgp_global/bgp_global.py
+++ b/plugins/module_utils/network/vyos/argspec/bgp_global/bgp_global.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
#############################################
diff --git a/plugins/module_utils/network/vyos/argspec/facts/facts.py b/plugins/module_utils/network/vyos/argspec/facts/facts.py
index 45a4cb4..b274c50 100644
--- a/plugins/module_utils/network/vyos/argspec/facts/facts.py
+++ b/plugins/module_utils/network/vyos/argspec/facts/facts.py
@@ -6,6 +6,7 @@ The arg spec for the vyos facts module.
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
diff --git a/plugins/module_utils/network/vyos/argspec/firewall_global/firewall_global.py b/plugins/module_utils/network/vyos/argspec/firewall_global/firewall_global.py
index baafa89..2326bea 100644
--- a/plugins/module_utils/network/vyos/argspec/firewall_global/firewall_global.py
+++ b/plugins/module_utils/network/vyos/argspec/firewall_global/firewall_global.py
@@ -27,6 +27,7 @@ The arg spec for the vyos_firewall_global module
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
diff --git a/plugins/module_utils/network/vyos/argspec/firewall_interfaces/firewall_interfaces.py b/plugins/module_utils/network/vyos/argspec/firewall_interfaces/firewall_interfaces.py
index 16e6615..a613ccd 100644
--- a/plugins/module_utils/network/vyos/argspec/firewall_interfaces/firewall_interfaces.py
+++ b/plugins/module_utils/network/vyos/argspec/firewall_interfaces/firewall_interfaces.py
@@ -27,6 +27,7 @@ The arg spec for the vyos_firewall_interfaces module
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
diff --git a/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py b/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py
index 0e80031..eb285cf 100644
--- a/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py
+++ b/plugins/module_utils/network/vyos/argspec/firewall_rules/firewall_rules.py
@@ -27,6 +27,7 @@ The arg spec for the vyos_firewall_rules module
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
@@ -182,7 +183,7 @@ class Firewall_rulesArgs(object): # pylint: disable=R0903
"kazaa",
],
"type": "str",
- }
+ },
},
"type": "list",
},
diff --git a/plugins/module_utils/network/vyos/argspec/hostname/hostname.py b/plugins/module_utils/network/vyos/argspec/hostname/hostname.py
index 1a3cf91..b69f2f1 100644
--- a/plugins/module_utils/network/vyos/argspec/hostname/hostname.py
+++ b/plugins/module_utils/network/vyos/argspec/hostname/hostname.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
#############################################
diff --git a/plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py b/plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py
index 9ae4c65..fecfb48 100644
--- a/plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py
+++ b/plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py
@@ -25,6 +25,7 @@ The arg spec for the vyos_interfaces module
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
diff --git a/plugins/module_utils/network/vyos/argspec/l3_interfaces/l3_interfaces.py b/plugins/module_utils/network/vyos/argspec/l3_interfaces/l3_interfaces.py
index d6d9e29..db33376 100644
--- a/plugins/module_utils/network/vyos/argspec/l3_interfaces/l3_interfaces.py
+++ b/plugins/module_utils/network/vyos/argspec/l3_interfaces/l3_interfaces.py
@@ -27,6 +27,7 @@ The arg spec for the vyos_l3_interfaces module
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
diff --git a/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py b/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py
index 14ac795..dce4fb7 100644
--- a/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py
+++ b/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py
@@ -24,6 +24,7 @@ The arg spec for the vyos_lag_interfaces module
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
diff --git a/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py b/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py
index 635322b..734274a 100644
--- a/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py
+++ b/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py
@@ -24,6 +24,7 @@ The arg spec for the vyos_lldp_global module
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
diff --git a/plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py b/plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py
index b641aeb..672b7f0 100644
--- a/plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py
+++ b/plugins/module_utils/network/vyos/argspec/lldp_interfaces/lldp_interfaces.py
@@ -27,6 +27,7 @@ The arg spec for the vyos_lldp_interfaces module
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
diff --git a/plugins/module_utils/network/vyos/argspec/logging_global/logging_global.py b/plugins/module_utils/network/vyos/argspec/logging_global/logging_global.py
index 503f723..93b29f4 100644
--- a/plugins/module_utils/network/vyos/argspec/logging_global/logging_global.py
+++ b/plugins/module_utils/network/vyos/argspec/logging_global/logging_global.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
#############################################
@@ -293,7 +294,7 @@ class Logging_globalArgs(object): # pylint: disable=R0903
"state": {
"type": "str",
"choices": ["enabled", "disabled"],
- }
+ },
},
},
"users": {
diff --git a/plugins/module_utils/network/vyos/argspec/ntp_global/ntp_global.py b/plugins/module_utils/network/vyos/argspec/ntp_global/ntp_global.py
index 7ace5bb..fca9bf1 100644
--- a/plugins/module_utils/network/vyos/argspec/ntp_global/ntp_global.py
+++ b/plugins/module_utils/network/vyos/argspec/ntp_global/ntp_global.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
#############################################
diff --git a/plugins/module_utils/network/vyos/argspec/ospf_interfaces/ospf_interfaces.py b/plugins/module_utils/network/vyos/argspec/ospf_interfaces/ospf_interfaces.py
index 71ba63b..1fd3370 100644
--- a/plugins/module_utils/network/vyos/argspec/ospf_interfaces/ospf_interfaces.py
+++ b/plugins/module_utils/network/vyos/argspec/ospf_interfaces/ospf_interfaces.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
#############################################
diff --git a/plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py b/plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py
index 6c83372..bd7f94d 100644
--- a/plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py
+++ b/plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py
@@ -6,6 +6,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
#############################################
@@ -53,7 +54,7 @@ class Ospfv2Args(object): # pylint: disable=R0903
"route_map": {"type": "str"},
},
"type": "dict",
- }
+ },
},
"type": "dict",
},
@@ -85,7 +86,7 @@ class Ospfv2Args(object): # pylint: disable=R0903
"on_startup": {"type": "int"},
},
"type": "dict",
- }
+ },
},
"type": "dict",
},
@@ -253,7 +254,7 @@ class Ospfv2Args(object): # pylint: disable=R0903
"max_holdtime": {"type": "int"},
},
"type": "dict",
- }
+ },
},
"type": "dict",
},
diff --git a/plugins/module_utils/network/vyos/argspec/ospfv3/ospfv3.py b/plugins/module_utils/network/vyos/argspec/ospfv3/ospfv3.py
index 7fac36c..4ea88b6 100644
--- a/plugins/module_utils/network/vyos/argspec/ospfv3/ospfv3.py
+++ b/plugins/module_utils/network/vyos/argspec/ospfv3/ospfv3.py
@@ -6,6 +6,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
#############################################
diff --git a/plugins/module_utils/network/vyos/argspec/prefix_lists/prefix_lists.py b/plugins/module_utils/network/vyos/argspec/prefix_lists/prefix_lists.py
index c7d2e98..d274144 100644
--- a/plugins/module_utils/network/vyos/argspec/prefix_lists/prefix_lists.py
+++ b/plugins/module_utils/network/vyos/argspec/prefix_lists/prefix_lists.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
#############################################
diff --git a/plugins/module_utils/network/vyos/argspec/route_maps/route_maps.py b/plugins/module_utils/network/vyos/argspec/route_maps/route_maps.py
index 6baa434..b2038a4 100644
--- a/plugins/module_utils/network/vyos/argspec/route_maps/route_maps.py
+++ b/plugins/module_utils/network/vyos/argspec/route_maps/route_maps.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
#############################################
diff --git a/plugins/module_utils/network/vyos/argspec/snmp_server/snmp_server.py b/plugins/module_utils/network/vyos/argspec/snmp_server/snmp_server.py
index 2b10a51..7cea688 100644
--- a/plugins/module_utils/network/vyos/argspec/snmp_server/snmp_server.py
+++ b/plugins/module_utils/network/vyos/argspec/snmp_server/snmp_server.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
#############################################
diff --git a/plugins/module_utils/network/vyos/argspec/static_routes/static_routes.py b/plugins/module_utils/network/vyos/argspec/static_routes/static_routes.py
index f8602e3..916ad26 100644
--- a/plugins/module_utils/network/vyos/argspec/static_routes/static_routes.py
+++ b/plugins/module_utils/network/vyos/argspec/static_routes/static_routes.py
@@ -27,6 +27,7 @@ The arg spec for the vyos_static_routes module
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
@@ -77,7 +78,7 @@ class Static_routesArgs(object): # pylint: disable=R0903
},
},
"type": "list",
- }
+ },
},
"type": "list",
},
diff --git a/plugins/module_utils/network/vyos/config/bgp_address_family/bgp_address_family.py b/plugins/module_utils/network/vyos/config/bgp_address_family/bgp_address_family.py
index 53defde..1b075ad 100644
--- a/plugins/module_utils/network/vyos/config/bgp_address_family/bgp_address_family.py
+++ b/plugins/module_utils/network/vyos/config/bgp_address_family/bgp_address_family.py
@@ -7,6 +7,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -143,7 +144,7 @@ class Bgp_address_family(ResourceModule):
},
"address_family",
True,
- )
+ ),
)
for neigh, neigh_entry in iteritems(entry.get("neighbors", {})):
if have.get("neighbors"):
@@ -158,7 +159,7 @@ class Bgp_address_family(ResourceModule):
},
"neighbors",
True,
- )
+ ),
)
else:
for k in neigh_entry["address_family"].keys():
@@ -177,7 +178,7 @@ class Bgp_address_family(ResourceModule):
},
"neighbors.address_family",
True,
- )
+ ),
)
def _compare_neighbors(self, want, have):
@@ -248,7 +249,7 @@ class Bgp_address_family(ResourceModule):
},
"neighbors",
True,
- )
+ ),
)
continue
@@ -305,7 +306,7 @@ class Bgp_address_family(ResourceModule):
+ "address-family "
+ afi
+ " "
- + attrib
+ + attrib,
)
hdict = {}
for key, entry in iteritems(hdict):
diff --git a/plugins/module_utils/network/vyos/config/bgp_global/bgp_global.py b/plugins/module_utils/network/vyos/config/bgp_global/bgp_global.py
index 55eca49..c4a8502 100644
--- a/plugins/module_utils/network/vyos/config/bgp_global/bgp_global.py
+++ b/plugins/module_utils/network/vyos/config/bgp_global/bgp_global.py
@@ -7,6 +7,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -201,12 +202,12 @@ class Bgp_global(ResourceModule):
if name not in wneigh.keys():
if self._check_af(name):
msg = "Use the _bgp_address_family module to delete the address_family under neighbor {0}, before replacing/deleting the neighbor.".format(
- name
+ name,
)
self._module.fail_json(msg=msg)
else:
self.commands.append(
- "delete protocols bgp " + str(have["as_number"]) + " neighbor " + name
+ "delete protocols bgp " + str(have["as_number"]) + " neighbor " + name,
)
continue
for k, v in entry.items():
@@ -291,7 +292,7 @@ class Bgp_global(ResourceModule):
for name, entry in iteritems(hbgp):
if name == "confederation":
self.commands.append(
- "delete protocols bgp " + str(have["as_number"]) + " parameters confederation"
+ "delete protocols bgp " + str(have["as_number"]) + " parameters confederation",
)
elif name == "distance":
distance_parsers = [
@@ -339,7 +340,7 @@ class Bgp_global(ResourceModule):
if not wdict and hdict:
attrib = re.sub("_", "-", attrib)
self.commands.append(
- "delete protocols bgp " + str(have["as_number"]) + " " + attrib
+ "delete protocols bgp " + str(have["as_number"]) + " " + attrib,
)
hdict = {}
for key, entry in iteritems(hdict):
@@ -402,5 +403,5 @@ class Bgp_global(ResourceModule):
def _get_config(self, connection):
return connection.get(
- 'show configuration commands | match "set protocols bgp .* neighbor"'
+ 'show configuration commands | match "set protocols bgp .* neighbor"',
)
diff --git a/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py b/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py
index 079cba6..8694f11 100644
--- a/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py
+++ b/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py
@@ -12,6 +12,7 @@ created
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from copy import deepcopy
@@ -50,7 +51,9 @@ class Firewall_global(ConfigBase):
:returns: The current configuration as a dictionary
"""
facts, _warnings = Facts(self._module).get_facts(
- self.gather_subset, self.gather_network_resources, data=data
+ self.gather_subset,
+ self.gather_network_resources,
+ data=data,
)
firewall_global_facts = facts["ansible_network_resources"].get("firewall_global")
if not firewall_global_facts:
@@ -91,7 +94,7 @@ class Firewall_global(ConfigBase):
running_config = self._module.params["running_config"]
if not running_config:
self._module.fail_json(
- msg="value of running_config parameter must not be empty for state parsed"
+ msg="value of running_config parameter must not be empty for state parsed",
)
result["parsed"] = self.get_firewall_global_facts(data=running_config)
else:
@@ -132,7 +135,7 @@ class Firewall_global(ConfigBase):
commands = []
if self.state in ("merged", "replaced", "rendered") and not w:
self._module.fail_json(
- msg="value of config parameter must not be empty for state {0}".format(self.state)
+ msg="value of config parameter must not be empty for state {0}".format(self.state),
)
if self.state == "deleted":
commands.extend(self._state_deleted(want=None, have=h))
@@ -242,12 +245,12 @@ class Firewall_global(ConfigBase):
for key, val in iteritems(w_fg):
if opr and key in l_set and not (h and self._is_w_same(w_fg, h, key)):
commands.append(
- self._form_attr_cmd(attr=key, val=self._bool_to_str(val), opr=opr)
+ self._form_attr_cmd(attr=key, val=self._bool_to_str(val), opr=opr),
)
elif not opr:
if key and self._is_del(l_set, h):
commands.append(
- self._form_attr_cmd(attr=key, key=self._bool_to_str(val), opr=opr)
+ self._form_attr_cmd(attr=key, key=self._bool_to_str(val), opr=opr),
)
continue
if (
@@ -256,7 +259,7 @@ class Firewall_global(ConfigBase):
and not self._is_del(l_set, h)
):
commands.append(
- self._form_attr_cmd(attr=key, val=self._bool_to_str(val), opr=opr)
+ self._form_attr_cmd(attr=key, val=self._bool_to_str(val), opr=opr),
)
else:
commands.extend(self._render_attr_config(w_fg, h, key, opr))
@@ -290,7 +293,7 @@ class Firewall_global(ConfigBase):
and not (h_ping and self._is_w_same(w[attr], h_ping, item))
):
commands.append(
- self._form_attr_cmd(attr=item, val=self._bool_to_str(value), opr=opr)
+ self._form_attr_cmd(attr=item, val=self._bool_to_str(value), opr=opr),
)
elif (
not opr
@@ -361,19 +364,29 @@ class Firewall_global(ConfigBase):
+ key
+ " '"
+ str(want[key])
- + "'"
+ + "'",
)
elif not opr and key in l_set:
if key == "name" and self._is_grp_del(h, want, key):
commands.append(cmd + " " + want["name"])
continue
if not (h and self._in_target(h, key)) and not self._is_grp_del(
- h, want, key
+ h,
+ want,
+ key,
):
commands.append(cmd + " " + want["name"] + " " + key)
elif key == "members":
commands.extend(
- self._render_ports_addrs(key, want, h, opr, cmd, want["name"], attr)
+ self._render_ports_addrs(
+ key,
+ want,
+ h,
+ opr,
+ cmd,
+ want["name"],
+ attr,
+ ),
)
return commands
@@ -407,7 +420,7 @@ class Firewall_global(ConfigBase):
+ " "
+ self._grp_type(type)
+ " "
- + member[self._get_mem_type(type)]
+ + member[self._get_mem_type(type)],
)
elif not opr and have:
members = list_diff_want_only(want, have)
@@ -419,7 +432,7 @@ class Firewall_global(ConfigBase):
+ " "
+ self._grp_type(type)
+ " "
- + member[self._get_mem_type(type)]
+ + member[self._get_mem_type(type)],
)
return commands
@@ -462,18 +475,19 @@ class Firewall_global(ConfigBase):
attr=key,
val=self._bool_to_str(val),
opr=opr,
- )
+ ),
)
elif not opr and key in l_set:
if not (h and self._in_target(h, key)) and not self._is_del(
- l_set, h
+ l_set,
+ h,
):
if key == "action":
commands.append(
self._form_attr_cmd(
attr=attr + " " + w["connection_type"],
opr=opr,
- )
+ ),
)
else:
commands.append(
@@ -481,7 +495,7 @@ class Firewall_global(ConfigBase):
attr=attr + " " + w["connection_type"],
val=self._bool_to_str(val),
opr=opr,
- )
+ ),
)
return commands
@@ -514,7 +528,7 @@ class Firewall_global(ConfigBase):
attr=key,
val=self._bool_to_str(val),
opr=opr,
- )
+ ),
)
elif not opr and key in l_set:
if self._is_del(l_set, h):
@@ -523,7 +537,7 @@ class Firewall_global(ConfigBase):
attr=key,
val=self._bool_to_str(val),
opr=opr,
- )
+ ),
)
continue
if not (h and self._in_target(h, key)) and not self._is_del(l_set, h):
@@ -532,7 +546,7 @@ class Firewall_global(ConfigBase):
attr=key,
val=self._bool_to_str(val),
opr=opr,
- )
+ ),
)
elif key == "icmp_redirects":
commands.extend(self._render_icmp_redirects(key, w, h, opr))
@@ -557,7 +571,7 @@ class Firewall_global(ConfigBase):
for item, value in iteritems(w[attr]):
if opr and item in l_set and not (h_red and self._is_w_same(w[attr], h_red, item)):
commands.append(
- self._form_attr_cmd(attr=item, val=self._bool_to_str(value), opr=opr)
+ self._form_attr_cmd(attr=item, val=self._bool_to_str(value), opr=opr),
)
elif (
not opr
diff --git a/plugins/module_utils/network/vyos/config/firewall_interfaces/firewall_interfaces.py b/plugins/module_utils/network/vyos/config/firewall_interfaces/firewall_interfaces.py
index 566bfeb..5c4db73 100644
--- a/plugins/module_utils/network/vyos/config/firewall_interfaces/firewall_interfaces.py
+++ b/plugins/module_utils/network/vyos/config/firewall_interfaces/firewall_interfaces.py
@@ -12,6 +12,7 @@ created
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from copy import deepcopy
@@ -52,7 +53,9 @@ class Firewall_interfaces(ConfigBase):
:returns: The current configuration as a dictionary
"""
facts, _warnings = Facts(self._module).get_facts(
- self.gather_subset, self.gather_network_resources, data=data
+ self.gather_subset,
+ self.gather_network_resources,
+ data=data,
)
firewall_interfaces_facts = facts["ansible_network_resources"].get("firewall_interfaces")
if not firewall_interfaces_facts:
@@ -93,7 +96,7 @@ class Firewall_interfaces(ConfigBase):
running_config = self._module.params["running_config"]
if not running_config:
self._module.fail_json(
- msg="value of running_config parameter must not be empty for state parsed"
+ msg="value of running_config parameter must not be empty for state parsed",
)
result["parsed"] = self.get_firewall_interfaces_facts(data=running_config)
else:
@@ -134,7 +137,7 @@ class Firewall_interfaces(ConfigBase):
commands = []
if self.state in ("merged", "replaced", "overridden", "rendered") and not w:
self._module.fail_json(
- msg="value of config parameter must not be empty for state {0}".format(self.state)
+ msg="value of config parameter must not be empty for state {0}".format(self.state),
)
if self.state == "overridden":
commands.extend(self._state_overridden(w, h))
@@ -202,7 +205,7 @@ class Firewall_interfaces(ConfigBase):
name=h_ar["name"],
attrib=h[key],
opr=False,
- )
+ ),
)
commands.extend(self._state_merged(want, have))
@@ -290,7 +293,7 @@ class Firewall_interfaces(ConfigBase):
for h in h_rules:
if key in h:
commands.append(
- self._compute_command(afi=want["afi"], name=name, attrib=h[key], opr=opr)
+ self._compute_command(afi=want["afi"], name=name, attrib=h[key], opr=opr),
)
for w in w_rules:
h = search_obj_in_list(w[key], h_rules, key=key)
@@ -309,7 +312,7 @@ class Firewall_interfaces(ConfigBase):
attrib=w[key],
value=w["name"],
opr=opr,
- )
+ ),
)
return commands
@@ -362,11 +365,11 @@ class Firewall_interfaces(ConfigBase):
name=name,
attrib=w[key],
value=w["name"],
- )
+ ),
)
elif not (h and key in h):
commands.append(
- self._compute_command(afi=want["afi"], name=name, attrib=w[key])
+ self._compute_command(afi=want["afi"], name=name, attrib=w[key]),
)
elif not opr:
if not h or key not in h or ("name" in w and h and "name" not in h):
@@ -376,7 +379,7 @@ class Firewall_interfaces(ConfigBase):
name=name,
attrib=w[key],
opr=opr,
- )
+ ),
)
return commands
diff --git a/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py b/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py
index aa18a7e..09e19d7 100644
--- a/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py
+++ b/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py
@@ -12,9 +12,11 @@ created
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
import re
+
from copy import deepcopy
from ansible.module_utils.six import iteritems
@@ -56,7 +58,9 @@ class Firewall_rules(ConfigBase):
:returns: The current configuration as a dictionary
"""
facts, _warnings = Facts(self._module).get_facts(
- self.gather_subset, self.gather_network_resources, data=data
+ self.gather_subset,
+ self.gather_network_resources,
+ data=data,
)
firewall_rules_facts = facts["ansible_network_resources"].get("firewall_rules")
if not firewall_rules_facts:
@@ -97,7 +101,7 @@ class Firewall_rules(ConfigBase):
running_config = self._module.params["running_config"]
if not running_config:
self._module.fail_json(
- msg="value of running_config parameter must not be empty for state parsed"
+ msg="value of running_config parameter must not be empty for state parsed",
)
result["parsed"] = self.get_firewall_rules_facts(data=running_config)
else:
@@ -138,7 +142,7 @@ class Firewall_rules(ConfigBase):
commands = []
if self.state in ("merged", "replaced", "overridden", "rendered") and not w:
self._module.fail_json(
- msg="value of config parameter must not be empty for state {0}".format(self.state)
+ msg="value of config parameter must not be empty for state {0}".format(self.state),
)
if self.state == "overridden":
commands.extend(self._state_overridden(w, h))
@@ -168,7 +172,10 @@ class Firewall_rules(ConfigBase):
# already have (to be replaced by our desired
# configuration's rule set).
wanted_rule_set = self.search_r_sets_in_have(
- want, rs["name"], "r_list", h["afi"]
+ want,
+ rs["name"],
+ "r_list",
+ h["afi"],
)
if wanted_rule_set is not None:
# Remove the rules that we already have if the wanted
@@ -179,7 +186,7 @@ class Firewall_rules(ConfigBase):
want=rs,
have=wanted_rule_set,
opr=False,
- )
+ ),
)
# Merge the desired configuration into what we already have.
commands.extend(self._state_merged(want, have))
@@ -467,7 +474,7 @@ class Firewall_rules(ConfigBase):
commands.append(cmd + (" " + "icmpv6" + " " + param_name + " " + val))
else:
commands.append(
- cmd + (" " + attr + " " + item.replace("_", "-") + " " + val)
+ cmd + (" " + attr + " " + item.replace("_", "-") + " " + val),
)
else:
commands.append(cmd + (" " + attr + " " + item + " " + str(val)))
@@ -588,7 +595,7 @@ class Firewall_rules(ConfigBase):
+ str(rate["number"])
+ "/"
+ rate["unit"]
- )
+ ),
)
if not opr and not (
h_limit
@@ -619,7 +626,7 @@ class Firewall_rules(ConfigBase):
and not (h and attr in h.keys() and self._is_w_same(w[attr], h[attr], key))
):
commands.append(
- cmd + (" " + attr + " " + key.replace("_", "-") + " " + w[attr].get(key))
+ cmd + (" " + attr + " " + key.replace("_", "-") + " " + w[attr].get(key)),
)
elif (
not opr
@@ -652,7 +659,7 @@ class Firewall_rules(ConfigBase):
+ item.replace("_", "-")
+ " "
+ val
- )
+ ),
)
elif (
not opr
@@ -660,7 +667,7 @@ class Firewall_rules(ConfigBase):
and not (h_group and self._in_target(h_group, item))
):
commands.append(
- cmd + (" " + attr + " " + key + " " + item.replace("_", "-"))
+ cmd + (" " + attr + " " + key + " " + item.replace("_", "-")),
)
return commands
@@ -779,7 +786,11 @@ class Firewall_rules(ConfigBase):
:return: generated command.
"""
command = self._compute_command(
- afi=afi, name=name, attrib=attrib, value=rule[attrib], opr=opr
+ afi=afi,
+ name=name,
+ attrib=attrib,
+ value=rule[attrib],
+ opr=opr,
)
return command
diff --git a/plugins/module_utils/network/vyos/config/hostname/hostname.py b/plugins/module_utils/network/vyos/config/hostname/hostname.py
index 8b30a69..36aba74 100644
--- a/plugins/module_utils/network/vyos/config/hostname/hostname.py
+++ b/plugins/module_utils/network/vyos/config/hostname/hostname.py
@@ -7,6 +7,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
diff --git a/plugins/module_utils/network/vyos/config/interfaces/interfaces.py b/plugins/module_utils/network/vyos/config/interfaces/interfaces.py
index 852db46..731014c 100644
--- a/plugins/module_utils/network/vyos/config/interfaces/interfaces.py
+++ b/plugins/module_utils/network/vyos/config/interfaces/interfaces.py
@@ -11,6 +11,7 @@ created
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from copy import deepcopy
@@ -55,7 +56,9 @@ class Interfaces(ConfigBase):
:returns: The current configuration as a dictionary
"""
facts, _warnings = Facts(self._module).get_facts(
- self.gather_subset, self.gather_network_resources, data=data
+ self.gather_subset,
+ self.gather_network_resources,
+ data=data,
)
interfaces_facts = facts["ansible_network_resources"].get("interfaces")
if not interfaces_facts:
@@ -95,7 +98,7 @@ class Interfaces(ConfigBase):
running_config = self._module.params["running_config"]
if not running_config:
self._module.fail_json(
- msg="value of running_config parameter must not be empty for state parsed"
+ msg="value of running_config parameter must not be empty for state parsed",
)
result["parsed"] = self.get_interfaces_facts(data=running_config)
else:
@@ -137,7 +140,7 @@ class Interfaces(ConfigBase):
if self.state in ("merged", "replaced", "overridden", "rendered") and not want:
self._module.fail_json(
- msg="value of config parameter must not be empty for state {0}".format(self.state)
+ msg="value of config parameter must not be empty for state {0}".format(self.state),
)
if self.state == "overridden":
@@ -226,7 +229,7 @@ class Interfaces(ConfigBase):
if updates:
for key, value in iteritems(updates):
commands.append(
- self._compute_commands(key=key, value=value, interface=want_copy["name"])
+ self._compute_commands(key=key, value=value, interface=want_copy["name"]),
)
if want_vifs:
@@ -247,7 +250,7 @@ class Interfaces(ConfigBase):
value=value,
interface=want_copy["name"],
vif=want_vif["vlan_id"],
- )
+ ),
)
return commands
@@ -270,11 +273,11 @@ class Interfaces(ConfigBase):
if key == "enabled":
continue
commands.append(
- self._compute_commands(key=key, interface=want_copy["name"], remove=True)
+ self._compute_commands(key=key, interface=want_copy["name"], remove=True),
)
if have_copy["enabled"] is False:
commands.append(
- self._compute_commands(key="enabled", value=True, interface=want_copy["name"])
+ self._compute_commands(key="enabled", value=True, interface=want_copy["name"]),
)
if have_vifs:
@@ -295,7 +298,7 @@ class Interfaces(ConfigBase):
interface=want_copy["name"],
vif=want_vif["vlan_id"],
remove=True,
- )
+ ),
)
if have_vif["enabled"] is False:
commands.append(
@@ -304,7 +307,7 @@ class Interfaces(ConfigBase):
value=True,
interface=want_copy["name"],
vif=want_vif["vlan_id"],
- )
+ ),
)
return commands
diff --git a/plugins/module_utils/network/vyos/config/l3_interfaces/l3_interfaces.py b/plugins/module_utils/network/vyos/config/l3_interfaces/l3_interfaces.py
index 61dd1f4..6e0c005 100644
--- a/plugins/module_utils/network/vyos/config/l3_interfaces/l3_interfaces.py
+++ b/plugins/module_utils/network/vyos/config/l3_interfaces/l3_interfaces.py
@@ -13,6 +13,7 @@ created
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
@@ -59,7 +60,9 @@ class L3_interfaces(ConfigBase):
:returns: The current configuration as a dictionary
"""
facts, _warnings = Facts(self._module).get_facts(
- self.gather_subset, self.gather_network_resources, data=data
+ self.gather_subset,
+ self.gather_network_resources,
+ data=data,
)
l3_interfaces_facts = facts["ansible_network_resources"].get("l3_interfaces")
if not l3_interfaces_facts:
@@ -100,7 +103,7 @@ class L3_interfaces(ConfigBase):
running_config = self._module.params["running_config"]
if not running_config:
self._module.fail_json(
- msg="value of running_config parameter must not be empty for state parsed"
+ msg="value of running_config parameter must not be empty for state parsed",
)
result["parsed"] = self.get_l3_interfaces_facts(data=running_config)
else:
@@ -143,7 +146,7 @@ class L3_interfaces(ConfigBase):
if state in ("merged", "replaced", "overridden", "rendered") and not want:
self._module.fail_json(
- msg="value of config parameter must not be empty for state {0}".format(state)
+ msg="value of config parameter must not be empty for state {0}".format(state),
)
if state == "overridden":
@@ -225,7 +228,7 @@ class L3_interfaces(ConfigBase):
for update in self._get_updates(want_copy, have_copy):
for key, value in iteritems(update):
commands.append(
- self._compute_commands(key=key, value=value, interface=want_copy["name"])
+ self._compute_commands(key=key, value=value, interface=want_copy["name"]),
)
if want_vifs:
@@ -242,7 +245,7 @@ class L3_interfaces(ConfigBase):
value=value,
interface=want_copy["name"],
vif=want_vif["vlan_id"],
- )
+ ),
)
return commands
@@ -269,7 +272,7 @@ class L3_interfaces(ConfigBase):
value=value,
interface=want_copy["name"],
remove=True,
- )
+ ),
)
if have_vifs:
@@ -287,7 +290,7 @@ class L3_interfaces(ConfigBase):
value=value,
vif=want_vif["vlan_id"],
remove=True,
- )
+ ),
)
return commands
diff --git a/plugins/module_utils/network/vyos/config/lag_interfaces/lag_interfaces.py b/plugins/module_utils/network/vyos/config/lag_interfaces/lag_interfaces.py
index 314ff93..835615b 100644
--- a/plugins/module_utils/network/vyos/config/lag_interfaces/lag_interfaces.py
+++ b/plugins/module_utils/network/vyos/config/lag_interfaces/lag_interfaces.py
@@ -10,6 +10,7 @@ created
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from ansible.module_utils.six import iteritems
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import (
@@ -62,7 +63,9 @@ class Lag_interfaces(ConfigBase):
:returns: The current configuration as a dictionary
"""
facts, _warnings = Facts(self._module).get_facts(
- self.gather_subset, self.gather_network_resources, data=data
+ self.gather_subset,
+ self.gather_network_resources,
+ data=data,
)
lag_interfaces_facts = facts["ansible_network_resources"].get("lag_interfaces")
if not lag_interfaces_facts:
@@ -103,7 +106,7 @@ class Lag_interfaces(ConfigBase):
running_config = self._module.params["running_config"]
if not running_config:
self._module.fail_json(
- msg="value of running_config parameter must not be empty for state parsed"
+ msg="value of running_config parameter must not be empty for state parsed",
)
result["parsed"] = self.get_lag_interfaces_facts(data=running_config)
else:
@@ -144,7 +147,7 @@ class Lag_interfaces(ConfigBase):
commands = []
if self.state in ("merged", "replaced", "overridden", "rendered") and not want:
self._module.fail_json(
- msg="value of config parameter must not be empty for state {0}".format(self.state)
+ msg="value of config parameter must not be empty for state {0}".format(self.state),
)
if self.state == "overridden":
commands.extend(self._state_overridden(want, have))
@@ -301,7 +304,7 @@ class Lag_interfaces(ConfigBase):
"bond-group",
want["name"],
type="ethernet",
- )
+ ),
)
return commands
@@ -316,7 +319,7 @@ class Lag_interfaces(ConfigBase):
key=want["name"] + " arp-monitor",
attrib="interval",
value=str(arp_monitor["interval"]),
- )
+ ),
)
if diff_targets:
for target in diff_targets:
@@ -325,7 +328,7 @@ class Lag_interfaces(ConfigBase):
key=want["name"] + " arp-monitor",
attrib="target",
value=target,
- )
+ ),
)
return commands
@@ -339,7 +342,7 @@ class Lag_interfaces(ConfigBase):
have["name"],
remove=True,
type="ethernet",
- )
+ ),
)
return commands
@@ -362,7 +365,7 @@ class Lag_interfaces(ConfigBase):
key=have["name"] + " arp-monitor",
attrib="interval",
remove=True,
- )
+ ),
)
if "target" in have_arp_monitor:
target_diff = list_diff_have_only(want_arp_target, have_arp_target)
@@ -374,7 +377,7 @@ class Lag_interfaces(ConfigBase):
attrib="target",
value=target,
remove=True,
- )
+ ),
)
return commands
@@ -394,7 +397,7 @@ class Lag_interfaces(ConfigBase):
have["name"],
True,
"ethernet",
- )
+ ),
)
return commands
diff --git a/plugins/module_utils/network/vyos/config/lldp_global/lldp_global.py b/plugins/module_utils/network/vyos/config/lldp_global/lldp_global.py
index b2571e0..1afda78 100644
--- a/plugins/module_utils/network/vyos/config/lldp_global/lldp_global.py
+++ b/plugins/module_utils/network/vyos/config/lldp_global/lldp_global.py
@@ -10,6 +10,7 @@ created
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from ansible.module_utils.six import iteritems
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import (
@@ -53,7 +54,9 @@ class Lldp_global(ConfigBase):
:returns: The current configuration as a dictionary
"""
facts, _warnings = Facts(self._module).get_facts(
- self.gather_subset, self.gather_network_resources, data=data
+ self.gather_subset,
+ self.gather_network_resources,
+ data=data,
)
lldp_global_facts = facts["ansible_network_resources"].get("lldp_global")
if not lldp_global_facts:
@@ -94,7 +97,7 @@ class Lldp_global(ConfigBase):
running_config = self._module.params["running_config"]
if not running_config:
self._module.fail_json(
- msg="value of running_config parameter must not be empty for state parsed"
+ msg="value of running_config parameter must not be empty for state parsed",
)
result["parsed"] = self.get_lldp_global_facts(data=running_config)
else:
@@ -135,7 +138,7 @@ class Lldp_global(ConfigBase):
commands = []
if self.state in ("merged", "replaced", "rendered") and not want:
self._module.fail_json(
- msg="value of config parameter must not be empty for state {0}".format(self.state)
+ msg="value of config parameter must not be empty for state {0}".format(self.state),
)
if self.state == "deleted":
commands.extend(self._state_deleted(want=None, have=have))
diff --git a/plugins/module_utils/network/vyos/config/lldp_interfaces/lldp_interfaces.py b/plugins/module_utils/network/vyos/config/lldp_interfaces/lldp_interfaces.py
index 11b950b..53e9aed 100644
--- a/plugins/module_utils/network/vyos/config/lldp_interfaces/lldp_interfaces.py
+++ b/plugins/module_utils/network/vyos/config/lldp_interfaces/lldp_interfaces.py
@@ -13,6 +13,7 @@ created
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from ansible.module_utils.six import iteritems
@@ -59,7 +60,9 @@ class Lldp_interfaces(ConfigBase):
:returns: The current configuration as a dictionary
"""
facts, _warnings = Facts(self._module).get_facts(
- self.gather_subset, self.gather_network_resources, data=data
+ self.gather_subset,
+ self.gather_network_resources,
+ data=data,
)
lldp_interfaces_facts = facts["ansible_network_resources"].get("lldp_interfaces")
if not lldp_interfaces_facts:
@@ -100,7 +103,7 @@ class Lldp_interfaces(ConfigBase):
running_config = self._module.params["running_config"]
if not running_config:
self._module.fail_json(
- msg="value of running_config parameter must not be empty for state parsed"
+ msg="value of running_config parameter must not be empty for state parsed",
)
result["parsed"] = self.get_lldp_interfaces_facts(data=running_config)
else:
@@ -141,7 +144,7 @@ class Lldp_interfaces(ConfigBase):
commands = []
if self.state in ("merged", "replaced", "overridden", "rendered") and not want:
self._module.fail_json(
- msg="value of config parameter must not be empty for state {0}".format(self.state)
+ msg="value of config parameter must not be empty for state {0}".format(self.state),
)
if self.state == "overridden":
commands.extend(self._state_overridden(want=want, have=have))
@@ -300,7 +303,7 @@ class Lldp_interfaces(ConfigBase):
set_cmd + location_type,
"country-code",
str(want_dict["country_code"]),
- )
+ ),
)
else:
commands.append(
@@ -308,7 +311,7 @@ class Lldp_interfaces(ConfigBase):
set_cmd + location_type,
"country-code",
str(want_dict["country_code"]),
- )
+ ),
)
commands.extend(self._add_civic_address(name, want_ca, have_ca))
@@ -320,14 +323,14 @@ class Lldp_interfaces(ConfigBase):
self._compute_command(
set_cmd + location_type,
value=str(want_location_type["elin"]),
- )
+ ),
)
else:
commands.append(
self._compute_command(
set_cmd + location_type,
value=str(want_location_type["elin"]),
- )
+ ),
)
return commands
@@ -346,7 +349,7 @@ class Lldp_interfaces(ConfigBase):
only_in_have = key_value_in_dict(key, value, want_dict)
if not only_in_have:
commands.append(
- self._compute_command(del_cmd + location_type, key, str(value), True)
+ self._compute_command(del_cmd + location_type, key, str(value), True),
)
else:
commands.append(self._compute_command(del_cmd, remove=True))
@@ -381,7 +384,7 @@ class Lldp_interfaces(ConfigBase):
key=name + " location civic-based ca-type",
attrib=str(ca_type) + " ca-value",
value=ca_value,
- )
+ ),
)
return commands
@@ -398,7 +401,7 @@ class Lldp_interfaces(ConfigBase):
"location civic-based ca-type",
str(ca_type),
remove=True,
- )
+ ),
)
return commands
diff --git a/plugins/module_utils/network/vyos/config/logging_global/logging_global.py b/plugins/module_utils/network/vyos/config/logging_global/logging_global.py
index 27c33b3..d8bfa18 100644
--- a/plugins/module_utils/network/vyos/config/logging_global/logging_global.py
+++ b/plugins/module_utils/network/vyos/config/logging_global/logging_global.py
@@ -7,6 +7,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -173,7 +174,7 @@ class Logging_global(ResourceModule):
element: {
"facilities": dat,
self.pkey.get(element): v.get(self.pkey.get(element)),
- }
+ },
}
del v["facilities"]
if len(list(v.keys())) > 1:
diff --git a/plugins/module_utils/network/vyos/config/ntp_global/ntp_global.py b/plugins/module_utils/network/vyos/config/ntp_global/ntp_global.py
index 3ce6ec2..106faac 100644
--- a/plugins/module_utils/network/vyos/config/ntp_global/ntp_global.py
+++ b/plugins/module_utils/network/vyos/config/ntp_global/ntp_global.py
@@ -7,6 +7,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -89,12 +90,12 @@ class Ntp_global(ResourceModule):
for hk, hval in iteritems(have):
if hk == "allow_clients" and hk in commandlist:
self.commands.append(
- self._tmplt.render({"": hk}, "allow_clients_delete", True)
+ self._tmplt.render({"": hk}, "allow_clients_delete", True),
)
commandlist.remove(hk)
elif hk == "listen_addresses" and hk in commandlist:
self.commands.append(
- self._tmplt.render({"": hk}, "listen_addresses_delete", True)
+ self._tmplt.render({"": hk}, "listen_addresses_delete", True),
)
commandlist.remove(hk)
elif hk == "server" and have["server"] in servernames:
diff --git a/plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py b/plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py
index 527f062..a7652a6 100644
--- a/plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py
+++ b/plugins/module_utils/network/vyos/config/ospf_interfaces/ospf_interfaces.py
@@ -7,6 +7,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
The vyos_ospf_interfaces config file.
diff --git a/plugins/module_utils/network/vyos/config/ospfv2/ospfv2.py b/plugins/module_utils/network/vyos/config/ospfv2/ospfv2.py
index 3f9e4e6..a9c1de1 100644
--- a/plugins/module_utils/network/vyos/config/ospfv2/ospfv2.py
+++ b/plugins/module_utils/network/vyos/config/ospfv2/ospfv2.py
@@ -12,6 +12,7 @@ created
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from copy import deepcopy
@@ -54,7 +55,9 @@ class Ospfv2(ConfigBase):
"""
(facts, _warnings) = Facts(self._module).get_facts(
- self.gather_subset, self.gather_network_resources, data=data
+ self.gather_subset,
+ self.gather_network_resources,
+ data=data,
)
ospfv2_facts = facts["ansible_network_resources"].get("ospfv2", {})
return ospfv2_facts
@@ -94,7 +97,7 @@ class Ospfv2(ConfigBase):
running_config = self._module.params["running_config"]
if not running_config:
self._module.fail_json(
- msg="value of running_config parameter must not be empty for state parsed"
+ msg="value of running_config parameter must not be empty for state parsed",
)
result["parsed"] = self.get_ospfv2_facts(data=running_config)
else:
@@ -137,7 +140,7 @@ class Ospfv2(ConfigBase):
commands = []
if self.state in ("merged", "replaced", "overridden", "rendered") and not w:
self._module.fail_json(
- msg="value of config parameter must not be empty for state {0}".format(self.state)
+ msg="value of config parameter must not be empty for state {0}".format(self.state),
)
if self.state == "deleted":
@@ -298,7 +301,7 @@ class Ospfv2(ConfigBase):
commands.append(self._form_attr_cmd(key=attr, attr=item, opr=opr))
else:
commands.append(
- self._form_attr_cmd(key=attr, attr=item, val=value, opr=opr)
+ self._form_attr_cmd(key=attr, attr=item, val=value, opr=opr),
)
elif not opr and item in leaf and not _in_target(h, item):
if item == "enabled":
@@ -342,7 +345,7 @@ class Ospfv2(ConfigBase):
if attr == "network":
if not self.search_obj_in_have(h, member, "address"):
commands.append(
- cmd + attr.replace("_", "-") + " " + member["address"]
+ cmd + attr.replace("_", "-") + " " + member["address"],
)
elif member not in h:
commands.append(cmd + attr.replace("_", "-") + " " + member)
@@ -372,7 +375,7 @@ class Ospfv2(ConfigBase):
"transmit_delay",
"hello_interval",
"retransmit_interval",
- )
+ ),
}
leaf = leaf_dict[attr]
w = want.get(attr) or []
@@ -398,14 +401,14 @@ class Ospfv2(ConfigBase):
+ " "
+ key.replace("_", "-")
+ " "
- + str(val)
+ + str(val),
)
elif not opr and key in leaf and not _in_target(h_item, key):
if key in "address":
commands.append(cmd + attr.replace("_", "-") + " " + str(val))
else:
commands.append(
- cmd + attr.replace("_", "-") + " " + w_item[name[attr]] + " " + key
+ cmd + attr.replace("_", "-") + " " + w_item[name[attr]] + " " + key,
)
elif key == "authentication":
commands.extend(
@@ -417,7 +420,7 @@ class Ospfv2(ConfigBase):
w_item["address"],
cmd,
opr,
- )
+ ),
)
return commands
@@ -504,11 +507,11 @@ class Ospfv2(ConfigBase):
commands.append(cmd + attr + " " + str(val))
elif key == "cost":
commands.append(
- cmd + attr + " " + w_item[name[attr]] + " " + key + " " + str(val)
+ cmd + attr + " " + w_item[name[attr]] + " " + key + " " + str(val),
)
elif key == "not_advertise":
commands.append(
- cmd + attr + " " + w_item[name[attr]] + " " + key.replace("_", "-")
+ cmd + attr + " " + w_item[name[attr]] + " " + key.replace("_", "-"),
)
elif key == "md5_key":
commands.append(
@@ -521,7 +524,7 @@ class Ospfv2(ConfigBase):
+ " "
+ key.replace("_", "-")
+ " "
- + w_item[key]
+ + w_item[key],
)
else:
commands.append(
@@ -532,7 +535,7 @@ class Ospfv2(ConfigBase):
+ " "
+ key.replace("_", "-")
+ " "
- + str(val)
+ + str(val),
)
elif not opr and key in leaf and not _in_target(h_item, key):
if key in (
@@ -596,7 +599,7 @@ class Ospfv2(ConfigBase):
+ " "
+ key.replace("_", "-")
+ " "
- + item.replace("_", "-")
+ + item.replace("_", "-"),
)
elif item not in ("administrative", "always"):
commands.append(
@@ -607,7 +610,7 @@ class Ospfv2(ConfigBase):
+ " "
+ item.replace("_", "-")
+ " "
- + str(val)
+ + str(val),
)
elif not opr and item in leaf and not _in_target(h_attrib, item):
commands.append(cmd + attr + " " + item)
@@ -645,7 +648,7 @@ class Ospfv2(ConfigBase):
h_area = self.search_obj_in_have(h_lst, w_area, "area_id")
if not opr and not h_area:
commands.append(
- self._form_attr_cmd(key="area", attr=w_area["area_id"], opr=opr)
+ self._form_attr_cmd(key="area", attr=w_area["area_id"], opr=opr),
)
else:
for key, val in iteritems(w_area):
@@ -656,11 +659,11 @@ class Ospfv2(ConfigBase):
attr="area",
val=_bool_to_str(val),
opr=opr,
- )
+ ),
)
else:
commands.append(
- cmd + key + " " + _bool_to_str(val).replace("_", "-")
+ cmd + key + " " + _bool_to_str(val).replace("_", "-"),
)
elif not opr and key in l_set:
if key == "area_id" and not _in_target(h_area, key):
@@ -674,7 +677,7 @@ class Ospfv2(ConfigBase):
commands.extend(self._render_list_param(key, w_area, h_area, cmd, opr))
elif key == "range":
commands.extend(
- self._render_list_dict_param(key, w_area, h_area, cmd, opr)
+ self._render_list_dict_param(key, w_area, h_area, cmd, opr),
)
elif key == "virtual_link":
commands.extend(self._render_vlink(key, w_area, h_area, cmd, opr))
@@ -704,7 +707,7 @@ class Ospfv2(ConfigBase):
if opr and key in w_type.keys() and not _is_w_same(w_type, h_type, key):
if not w_type[key] and h_type and h_type[key]:
commands.append(
- cmd.replace("set", "delete") + attr.replace("_", "-") + " " + key
+ cmd.replace("set", "delete") + attr.replace("_", "-") + " " + key,
)
elif w_type[key]:
commands.append(cmd + attr.replace("_", "-") + " " + key)
@@ -734,7 +737,7 @@ class Ospfv2(ConfigBase):
cmd.replace("set", "delete")
+ attr.replace("_", "-")
+ " "
- + key
+ + key,
)
elif item != "set":
commands.append(
@@ -745,7 +748,7 @@ class Ospfv2(ConfigBase):
+ " "
+ item.replace("_", "-")
+ " "
- + str(val)
+ + str(val),
)
elif not opr and item in a_type[key] and not (h_type and key in h_type):
if item == "set":
@@ -759,7 +762,7 @@ class Ospfv2(ConfigBase):
+ " "
+ key
+ " "
- + item.replace("_", "-")
+ + item.replace("_", "-"),
)
return commands
diff --git a/plugins/module_utils/network/vyos/config/ospfv3/ospfv3.py b/plugins/module_utils/network/vyos/config/ospfv3/ospfv3.py
index abafc90..25d9a0e 100644
--- a/plugins/module_utils/network/vyos/config/ospfv3/ospfv3.py
+++ b/plugins/module_utils/network/vyos/config/ospfv3/ospfv3.py
@@ -12,6 +12,7 @@ created
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from copy import deepcopy
@@ -58,7 +59,9 @@ class Ospfv3(ConfigBase):
:returns: The current configuration as a dictionary
"""
facts, _warnings = Facts(self._module).get_facts(
- self.gather_subset, self.gather_network_resources, data=data
+ self.gather_subset,
+ self.gather_network_resources,
+ data=data,
)
ospfv3_facts = facts["ansible_network_resources"].get("ospfv3", {})
return ospfv3_facts
@@ -97,7 +100,7 @@ class Ospfv3(ConfigBase):
running_config = self._module.params["running_config"]
if not running_config:
self._module.fail_json(
- msg="value of running_config parameter must not be empty for state parsed"
+ msg="value of running_config parameter must not be empty for state parsed",
)
result["parsed"] = self.get_ospfv3_facts(data=running_config)
else:
@@ -138,7 +141,7 @@ class Ospfv3(ConfigBase):
commands = []
if self.state in ("merged", "replaced", "overridden", "rendered") and not w:
self._module.fail_json(
- msg="value of config parameter must not be empty for state {0}".format(self.state)
+ msg="value of config parameter must not be empty for state {0}".format(self.state),
)
if self.state == "deleted":
commands.extend(self._state_deleted(w, h))
@@ -289,7 +292,7 @@ class Ospfv3(ConfigBase):
commands.append(cmd + attr + " " + str(val))
elif key in leaf_dict["range"] and key != "address":
commands.append(
- cmd + attr + " " + w_item[name[attr]] + " " + key.replace("_", "-")
+ cmd + attr + " " + w_item[name[attr]] + " " + key.replace("_", "-"),
)
elif key == "route_map":
commands.append(
@@ -300,7 +303,7 @@ class Ospfv3(ConfigBase):
+ " "
+ key.replace("_", "-")
+ " "
- + str(val)
+ + str(val),
)
elif not opr and key in leaf and not _in_target(h_item, key):
if key in ("route_type", "address"):
@@ -340,7 +343,7 @@ class Ospfv3(ConfigBase):
h_area = search_obj_in_list(w_area["area_id"], h_lst, "area_id")
if not opr and not h_area:
commands.append(
- self._form_attr_cmd(key="area", attr=w_area["area_id"], opr=opr)
+ self._form_attr_cmd(key="area", attr=w_area["area_id"], opr=opr),
)
else:
for key, val in iteritems(w_area):
@@ -351,14 +354,14 @@ class Ospfv3(ConfigBase):
attr="area",
val=_bool_to_str(val),
opr=opr,
- )
+ ),
)
else:
commands.append(
cmd
+ key.replace("_", "-")
+ " "
- + _bool_to_str(val).replace("_", "-")
+ + _bool_to_str(val).replace("_", "-"),
)
elif not opr and key in l_set:
if key == "area_id" and not _in_target(h_area, key):
@@ -368,7 +371,7 @@ class Ospfv3(ConfigBase):
commands.append(cmd + val + " " + key)
elif key == "range":
commands.extend(
- self._render_list_dict_param(key, w_area, h_area, cmd, opr)
+ self._render_list_dict_param(key, w_area, h_area, cmd, opr),
)
return commands
diff --git a/plugins/module_utils/network/vyos/config/prefix_lists/prefix_lists.py b/plugins/module_utils/network/vyos/config/prefix_lists/prefix_lists.py
index a8cc69e..9da27c1 100644
--- a/plugins/module_utils/network/vyos/config/prefix_lists/prefix_lists.py
+++ b/plugins/module_utils/network/vyos/config/prefix_lists/prefix_lists.py
@@ -7,6 +7,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -120,8 +121,9 @@ class Prefix_lists(ResourceModule):
for h in hplists.values():
self.commands.append(
"delete policy prefix-{0} {1}".format(
- "list" if h["afi"] == "ipv4" else "list6", h["name"]
- )
+ "list" if h["afi"] == "ipv4" else "list6",
+ h["name"],
+ ),
)
def _compare_plists(self, want, have):
@@ -158,7 +160,7 @@ class Prefix_lists(ResourceModule):
"list" if hr["afi"] == "ipv4" else "list6",
hr["name"],
hr["sequence"],
- )
+ ),
)
def _prefix_list_list_to_dict(self, entry):
diff --git a/plugins/module_utils/network/vyos/config/route_maps/route_maps.py b/plugins/module_utils/network/vyos/config/route_maps/route_maps.py
index dd6fbf6..9b6c3e9 100644
--- a/plugins/module_utils/network/vyos/config/route_maps/route_maps.py
+++ b/plugins/module_utils/network/vyos/config/route_maps/route_maps.py
@@ -7,6 +7,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
diff --git a/plugins/module_utils/network/vyos/config/snmp_server/snmp_server.py b/plugins/module_utils/network/vyos/config/snmp_server/snmp_server.py
index b942f8b..9497d7f 100644
--- a/plugins/module_utils/network/vyos/config/snmp_server/snmp_server.py
+++ b/plugins/module_utils/network/vyos/config/snmp_server/snmp_server.py
@@ -7,6 +7,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -137,7 +138,7 @@ class Snmp_server(ResourceModule):
"communities": {
k: hdict[key].pop(k, ""),
"name": key,
- }
+ },
}
self.compare(
parsers="communities",
@@ -200,8 +201,8 @@ class Snmp_server(ResourceModule):
attribute_dict[attrib]: hattrib[key][
attribute_dict[attrib]
],
- }
- }
+ },
+ },
}
self.compare(
parsers=parsers,
@@ -210,8 +211,8 @@ class Snmp_server(ResourceModule):
attrib: {
k: v,
attribute_dict[attrib]: entry[attribute_dict[attrib]],
- }
- }
+ },
+ },
},
have=h,
)
@@ -252,16 +253,16 @@ class Snmp_server(ResourceModule):
attrib: {
key: entry,
primary_key: wattrib[primary_key],
- }
- }
+ },
+ },
},
have={
"snmp_v3": {
attrib: {
key: hattrib.pop(key, {}),
primary_key: wattrib[primary_key],
- }
- }
+ },
+ },
},
)
for key, entry in iteritems(hattrib):
@@ -274,8 +275,8 @@ class Snmp_server(ResourceModule):
attrib: {
key: entry,
primary_key: hattrib[primary_key],
- }
- }
+ },
+ },
},
)
diff --git a/plugins/module_utils/network/vyos/config/static_routes/static_routes.py b/plugins/module_utils/network/vyos/config/static_routes/static_routes.py
index 230a47c..9230bdd 100644
--- a/plugins/module_utils/network/vyos/config/static_routes/static_routes.py
+++ b/plugins/module_utils/network/vyos/config/static_routes/static_routes.py
@@ -13,6 +13,7 @@ created
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from copy import deepcopy
@@ -54,7 +55,9 @@ class Static_routes(ConfigBase):
:returns: The current configuration as a dictionary
"""
facts, _warnings = Facts(self._module).get_facts(
- self.gather_subset, self.gather_network_resources, data=data
+ self.gather_subset,
+ self.gather_network_resources,
+ data=data,
)
static_routes_facts = facts["ansible_network_resources"].get("static_routes")
if not static_routes_facts:
@@ -95,7 +98,7 @@ class Static_routes(ConfigBase):
running_config = self._module.params["running_config"]
if not running_config:
self._module.fail_json(
- msg="value of running_config parameter must not be empty for state parsed"
+ msg="value of running_config parameter must not be empty for state parsed",
)
result["parsed"] = self.get_static_routes_facts(data=running_config)
else:
@@ -136,7 +139,7 @@ class Static_routes(ConfigBase):
commands = []
if self.state in ("merged", "replaced", "overridden", "rendered") and not want:
self._module.fail_json(
- msg="value of config parameter must not be empty for state {0}".format(self.state)
+ msg="value of config parameter must not be empty for state {0}".format(self.state),
)
if self.state == "overridden":
commands.extend(self._state_overridden(want=want, have=have))
@@ -290,7 +293,7 @@ class Static_routes(ConfigBase):
attrib=attrib,
remove=False,
value=str(value),
- )
+ ),
)
elif attrib == "type":
commands.append(self._compute_command(dest=want["dest"], key="blackhole"))
@@ -321,7 +324,7 @@ class Static_routes(ConfigBase):
key="next-hop",
value=hop[element],
opr=opr,
- )
+ ),
)
elif element == "enabled" and not hop[element]:
commands.append(
@@ -331,7 +334,7 @@ class Static_routes(ConfigBase):
attrib=hop["forward_router_address"],
value="disable",
opr=opr,
- )
+ ),
)
elif element == "admin_distance":
commands.append(
@@ -341,7 +344,7 @@ class Static_routes(ConfigBase):
attrib=hop["forward_router_address"] + " " + "distance",
value=str(hop[element]),
opr=opr,
- )
+ ),
)
elif element == "interface":
commands.append(
@@ -351,7 +354,7 @@ class Static_routes(ConfigBase):
attrib=hop["forward_router_address"] + " " + "next-hop-interface",
value=hop[element],
opr=opr,
- )
+ ),
)
return commands
@@ -385,11 +388,11 @@ class Static_routes(ConfigBase):
attrib=attrib,
remove=True,
value=str(value),
- )
+ ),
)
elif attrib == "type" and "distance" not in want_blackhole.keys():
commands.append(
- self._compute_command(dest=want["dest"], key="blackhole", remove=True)
+ self._compute_command(dest=want["dest"], key="blackhole", remove=True),
)
return commands
@@ -417,7 +420,7 @@ class Static_routes(ConfigBase):
key="next-hop",
value=hop[element],
remove=True,
- )
+ ),
)
elif element == "enabled":
commands.append(
@@ -427,7 +430,7 @@ class Static_routes(ConfigBase):
attrib=hop["forward_router_address"],
value="disable",
remove=True,
- )
+ ),
)
elif element == "admin_distance":
commands.append(
@@ -437,7 +440,7 @@ class Static_routes(ConfigBase):
attrib=hop["forward_router_address"] + " " + "distance",
value=str(hop[element]),
remove=True,
- )
+ ),
)
elif element == "interface":
commands.append(
@@ -447,7 +450,7 @@ class Static_routes(ConfigBase):
attrib=hop["forward_router_address"] + " " + "next-hop-interface",
value=hop[element],
remove=True,
- )
+ ),
)
return commands
diff --git a/plugins/module_utils/network/vyos/facts/bgp_address_family/bgp_address_family.py b/plugins/module_utils/network/vyos/facts/bgp_address_family/bgp_address_family.py
index 5d60184..629ffc5 100644
--- a/plugins/module_utils/network/vyos/facts/bgp_address_family/bgp_address_family.py
+++ b/plugins/module_utils/network/vyos/facts/bgp_address_family/bgp_address_family.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -68,7 +69,8 @@ class Bgp_address_familyFacts(object):
af["networks"] = sorted(af["networks"], key=lambda k: k["prefix"])
if "aggregate_address" in af:
af["aggregate_address"] = sorted(
- af["aggregate_address"], key=lambda k: k["prefix"]
+ af["aggregate_address"],
+ key=lambda k: k["prefix"],
)
if "neighbors" in objs:
objs["neighbors"] = list(objs["neighbors"].values())
diff --git a/plugins/module_utils/network/vyos/facts/bgp_global/bgp_global.py b/plugins/module_utils/network/vyos/facts/bgp_global/bgp_global.py
index c6105a0..fe34135 100644
--- a/plugins/module_utils/network/vyos/facts/bgp_global/bgp_global.py
+++ b/plugins/module_utils/network/vyos/facts/bgp_global/bgp_global.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -71,7 +72,7 @@ class Bgp_globalFacts(object):
ansible_facts["ansible_network_resources"].pop("bgp_global", None)
params = utils.remove_empties(
- bgp_global_parser.validate_config(self.argument_spec, {"config": objs}, redact=True)
+ bgp_global_parser.validate_config(self.argument_spec, {"config": objs}, redact=True),
)
facts["bgp_global"] = params.get("config", [])
diff --git a/plugins/module_utils/network/vyos/facts/facts.py b/plugins/module_utils/network/vyos/facts/facts.py
index f7b2b4e..74bbda7 100644
--- a/plugins/module_utils/network/vyos/facts/facts.py
+++ b/plugins/module_utils/network/vyos/facts/facts.py
@@ -8,6 +8,7 @@ calls the appropriate facts gathering function
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts import (
@@ -80,6 +81,7 @@ from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.stati
Static_routesFacts,
)
+
FACT_LEGACY_SUBSETS = dict(default=Default, neighbors=Neighbors, config=Config)
FACT_RESOURCE_SUBSETS = dict(
interfaces=InterfacesFacts,
diff --git a/plugins/module_utils/network/vyos/facts/firewall_global/firewall_global.py b/plugins/module_utils/network/vyos/facts/firewall_global/firewall_global.py
index 6441c26..5b47222 100644
--- a/plugins/module_utils/network/vyos/facts/firewall_global/firewall_global.py
+++ b/plugins/module_utils/network/vyos/facts/firewall_global/firewall_global.py
@@ -11,6 +11,7 @@ based on the configuration.
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from copy import deepcopy
@@ -80,7 +81,7 @@ class Firewall_globalFacts(object):
filter(
lambda x: ("firewall ipv6-name" and "firewall name" not in x),
conf,
- )
+ ),
)
a_lst = [
@@ -209,10 +210,12 @@ class Firewall_globalFacts(object):
cfg_dict = {}
cfg_dict["port_group"] = self.parse_group_lst(conf, "port-group", False)
cfg_dict["address_group"] = self.parse_group_lst(
- conf, "address-group"
+ conf,
+ "address-group",
) + self.parse_group_lst(conf, "ipv6-address-group")
cfg_dict["network_group"] = self.parse_group_lst(
- conf, "network-group"
+ conf,
+ "network-group",
) + self.parse_group_lst(conf, "ipv6-network-group")
return cfg_dict
diff --git a/plugins/module_utils/network/vyos/facts/firewall_interfaces/firewall_interfaces.py b/plugins/module_utils/network/vyos/facts/firewall_interfaces/firewall_interfaces.py
index 3e0d323..b980469 100644
--- a/plugins/module_utils/network/vyos/facts/firewall_interfaces/firewall_interfaces.py
+++ b/plugins/module_utils/network/vyos/facts/firewall_interfaces/firewall_interfaces.py
@@ -11,6 +11,7 @@ based on the configuration.
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from copy import deepcopy
diff --git a/plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py b/plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py
index 69daad9..ead038a 100644
--- a/plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py
+++ b/plugins/module_utils/network/vyos/facts/firewall_rules/firewall_rules.py
@@ -11,9 +11,11 @@ based on the configuration.
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
import re
+
from copy import deepcopy
from re import M, findall, search
diff --git a/plugins/module_utils/network/vyos/facts/hostname/hostname.py b/plugins/module_utils/network/vyos/facts/hostname/hostname.py
index 77ecc8c..b4f7c52 100644
--- a/plugins/module_utils/network/vyos/facts/hostname/hostname.py
+++ b/plugins/module_utils/network/vyos/facts/hostname/hostname.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -62,7 +63,7 @@ class HostnameFacts(object):
ansible_facts["ansible_network_resources"].pop("hostname", None)
params = utils.remove_empties(
- hostname_parser.validate_config(self.argument_spec, {"config": objs}, redact=True)
+ hostname_parser.validate_config(self.argument_spec, {"config": objs}, redact=True),
)
facts["hostname"] = params.get("config", {})
diff --git a/plugins/module_utils/network/vyos/facts/interfaces/interfaces.py b/plugins/module_utils/network/vyos/facts/interfaces/interfaces.py
index 51c3a10..995be91 100644
--- a/plugins/module_utils/network/vyos/facts/interfaces/interfaces.py
+++ b/plugins/module_utils/network/vyos/facts/interfaces/interfaces.py
@@ -12,6 +12,7 @@ based on the configuration.
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
diff --git a/plugins/module_utils/network/vyos/facts/l3_interfaces/l3_interfaces.py b/plugins/module_utils/network/vyos/facts/l3_interfaces/l3_interfaces.py
index 845d79e..be467a0 100644
--- a/plugins/module_utils/network/vyos/facts/l3_interfaces/l3_interfaces.py
+++ b/plugins/module_utils/network/vyos/facts/l3_interfaces/l3_interfaces.py
@@ -12,10 +12,12 @@ based on the configuration.
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
import re
+
from copy import deepcopy
from ansible.module_utils.six import iteritems
diff --git a/plugins/module_utils/network/vyos/facts/lag_interfaces/lag_interfaces.py b/plugins/module_utils/network/vyos/facts/lag_interfaces/lag_interfaces.py
index 251178a..78638bb 100644
--- a/plugins/module_utils/network/vyos/facts/lag_interfaces/lag_interfaces.py
+++ b/plugins/module_utils/network/vyos/facts/lag_interfaces/lag_interfaces.py
@@ -11,6 +11,7 @@ based on the configuration.
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from copy import deepcopy
diff --git a/plugins/module_utils/network/vyos/facts/legacy/base.py b/plugins/module_utils/network/vyos/facts/legacy/base.py
index 59666e1..30978e0 100644
--- a/plugins/module_utils/network/vyos/facts/legacy/base.py
+++ b/plugins/module_utils/network/vyos/facts/legacy/base.py
@@ -11,6 +11,7 @@ based on the configuration.
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
import platform
import re
diff --git a/plugins/module_utils/network/vyos/facts/lldp_global/lldp_global.py b/plugins/module_utils/network/vyos/facts/lldp_global/lldp_global.py
index e563999..b2afe59 100644
--- a/plugins/module_utils/network/vyos/facts/lldp_global/lldp_global.py
+++ b/plugins/module_utils/network/vyos/facts/lldp_global/lldp_global.py
@@ -11,6 +11,7 @@ based on the configuration.
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from copy import deepcopy
diff --git a/plugins/module_utils/network/vyos/facts/lldp_interfaces/lldp_interfaces.py b/plugins/module_utils/network/vyos/facts/lldp_interfaces/lldp_interfaces.py
index bfe684f..5f439e7 100644
--- a/plugins/module_utils/network/vyos/facts/lldp_interfaces/lldp_interfaces.py
+++ b/plugins/module_utils/network/vyos/facts/lldp_interfaces/lldp_interfaces.py
@@ -12,6 +12,7 @@ based on the configuration.
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
@@ -90,7 +91,8 @@ class Lldp_interfacesFacts(object):
disable = "\n".join(filter(lambda x: ("disable" in x), conf))
coordinate_based_conf = self.parse_attribs(
- ["altitude", "datum", "longitude", "latitude"], coordinate_conf
+ ["altitude", "datum", "longitude", "latitude"],
+ coordinate_conf,
)
elin_based_conf = self.parse_lldp_elin_based(elin_conf)
civic_based_conf = self.parse_lldp_civic_based(civic_conf)
diff --git a/plugins/module_utils/network/vyos/facts/logging_global/logging_global.py b/plugins/module_utils/network/vyos/facts/logging_global/logging_global.py
index e0434d9..8b60bef 100644
--- a/plugins/module_utils/network/vyos/facts/logging_global/logging_global.py
+++ b/plugins/module_utils/network/vyos/facts/logging_global/logging_global.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -87,7 +88,11 @@ class Logging_globalFacts(object):
objs = self.process_facts(objs)
params = utils.remove_empties(
- logging_global_parser.validate_config(self.argument_spec, {"config": objs}, redact=True)
+ logging_global_parser.validate_config(
+ self.argument_spec,
+ {"config": objs},
+ redact=True,
+ ),
)
facts["logging_global"] = params.get("config", {})
diff --git a/plugins/module_utils/network/vyos/facts/ntp_global/ntp_global.py b/plugins/module_utils/network/vyos/facts/ntp_global/ntp_global.py
index cead241..880bc79 100644
--- a/plugins/module_utils/network/vyos/facts/ntp_global/ntp_global.py
+++ b/plugins/module_utils/network/vyos/facts/ntp_global/ntp_global.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -81,7 +82,7 @@ class Ntp_globalFacts(object):
ansible_facts["ansible_network_resources"].pop("ntp_global", None)
params = utils.remove_empties(
- ntp_parser.validate_config(self.argument_spec, {"config": objs}, redact=True)
+ ntp_parser.validate_config(self.argument_spec, {"config": objs}, redact=True),
)
if params.get("config"):
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 c89e2bd..af6c577 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
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -76,7 +77,8 @@ class Ospf_interfacesFacts(object):
resources = self.get_config_set(data)
for resource in resources:
ospf_interfaces_parser = Ospf_interfacesTemplate(
- lines=resource.split("\n"), module=self._module
+ lines=resource.split("\n"),
+ module=self._module,
)
objs = ospf_interfaces_parser.parse()
for key, sortv in [("address_family", "afi")]:
@@ -91,7 +93,7 @@ class Ospf_interfacesFacts(object):
self.argument_spec,
{"config": ospf_interfaces_facts},
redact=True,
- )
+ ),
)
if params.get("config"):
for cfg in params["config"]:
diff --git a/plugins/module_utils/network/vyos/facts/ospfv2/ospfv2.py b/plugins/module_utils/network/vyos/facts/ospfv2/ospfv2.py
index 5121c98..bdc7c9f 100644
--- a/plugins/module_utils/network/vyos/facts/ospfv2/ospfv2.py
+++ b/plugins/module_utils/network/vyos/facts/ospfv2/ospfv2.py
@@ -11,6 +11,7 @@ based on the configuration.
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from copy import deepcopy
@@ -101,7 +102,8 @@ class Ospfv2Facts(object):
config["passive_interface"] = self.parse_leaf_list(conf, "passive-interface")
config["redistribute"] = self.parse_attrib_list(conf, "redistribute", "route_type")
config["passive_interface_exclude"] = self.parse_leaf_list(
- conf, "passive-interface-exclude"
+ conf,
+ "passive-interface-exclude",
)
return config
diff --git a/plugins/module_utils/network/vyos/facts/ospfv3/ospfv3.py b/plugins/module_utils/network/vyos/facts/ospfv3/ospfv3.py
index d4b3e44..547ff79 100644
--- a/plugins/module_utils/network/vyos/facts/ospfv3/ospfv3.py
+++ b/plugins/module_utils/network/vyos/facts/ospfv3/ospfv3.py
@@ -11,6 +11,7 @@ based on the configuration.
"""
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from copy import deepcopy
diff --git a/plugins/module_utils/network/vyos/facts/prefix_lists/prefix_lists.py b/plugins/module_utils/network/vyos/facts/prefix_lists/prefix_lists.py
index 19004c8..17f63fb 100644
--- a/plugins/module_utils/network/vyos/facts/prefix_lists/prefix_lists.py
+++ b/plugins/module_utils/network/vyos/facts/prefix_lists/prefix_lists.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -76,7 +77,7 @@ class Prefix_listsFacts(object):
ansible_facts["ansible_network_resources"].pop("prefix_lists", None)
params = utils.remove_empties(
- prefix_lists_parser.validate_config(self.argument_spec, {"config": objs}, redact=True)
+ prefix_lists_parser.validate_config(self.argument_spec, {"config": objs}, redact=True),
)
if params.get("config"):
diff --git a/plugins/module_utils/network/vyos/facts/route_maps/route_maps.py b/plugins/module_utils/network/vyos/facts/route_maps/route_maps.py
index 9f53264..2ad54e6 100644
--- a/plugins/module_utils/network/vyos/facts/route_maps/route_maps.py
+++ b/plugins/module_utils/network/vyos/facts/route_maps/route_maps.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
diff --git a/plugins/module_utils/network/vyos/facts/snmp_server/snmp_server.py b/plugins/module_utils/network/vyos/facts/snmp_server/snmp_server.py
index 54339f5..e70a15f 100644
--- a/plugins/module_utils/network/vyos/facts/snmp_server/snmp_server.py
+++ b/plugins/module_utils/network/vyos/facts/snmp_server/snmp_server.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -104,7 +105,7 @@ class Snmp_serverFacts(object):
ansible_facts["ansible_network_resources"].pop("snmp_server", None)
params = utils.remove_empties(
- snmp_server_parser.validate_config(self.argument_spec, {"config": objs}, redact=True)
+ snmp_server_parser.validate_config(self.argument_spec, {"config": objs}, redact=True),
)
facts["snmp_server"] = params.get("config", {})
diff --git a/plugins/module_utils/network/vyos/facts/static_routes/static_routes.py b/plugins/module_utils/network/vyos/facts/static_routes/static_routes.py
index 019706b..b8ffa30 100644
--- a/plugins/module_utils/network/vyos/facts/static_routes/static_routes.py
+++ b/plugins/module_utils/network/vyos/facts/static_routes/static_routes.py
@@ -12,6 +12,7 @@ based on the configuration.
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from copy import deepcopy
from re import M, findall, search
diff --git a/plugins/module_utils/network/vyos/rm_templates/bgp_address_family.py b/plugins/module_utils/network/vyos/rm_templates/bgp_address_family.py
index b1bb27c..c996a74 100644
--- a/plugins/module_utils/network/vyos/rm_templates/bgp_address_family.py
+++ b/plugins/module_utils/network/vyos/rm_templates/bgp_address_family.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -27,11 +28,11 @@ def _tmplt_bgp_af_aggregate_address(config_data):
config_data = config_data["address_family"]
if config_data["aggregate_address"].get("as_set"):
command += afi + " aggregate-address {prefix} as-set".format(
- **config_data["aggregate_address"]
+ **config_data["aggregate_address"],
)
if config_data["aggregate_address"].get("summary_only"):
command += afi + " aggregate-address {prefix} summary-only".format(
- **config_data["aggregate_address"]
+ **config_data["aggregate_address"],
)
return command
@@ -42,7 +43,7 @@ def _tmplt_bgp_af_redistribute_metric(config_data):
command = "protocols bgp {as_number} address-family ".format(**config_data)
if config_data["address_family"]["redistribute"].get("metric"):
command += afi + " redistribute {protocol} metric {metric}".format(
- **config_data["address_family"]["redistribute"]
+ **config_data["address_family"]["redistribute"],
)
return command
@@ -53,7 +54,7 @@ def _tmplt_bgp_af_redistribute_route_map(config_data):
command = "protocols bgp {as_number} address-family ".format(**config_data)
if config_data["address_family"]["redistribute"].get("route_map"):
command += afi + " redistribute {protocol} route-map {route_map}".format(
- **config_data["address_family"]["redistribute"]
+ **config_data["address_family"]["redistribute"],
)
return command
@@ -64,7 +65,7 @@ def _tmplt_bgp_af_redistribute_table(config_data):
command = "protocols bgp {as_number} address-family ".format(**config_data)
if config_data["address_family"]["redistribute"].get("table"):
command += afi + " table {table}".format(
- **config_data["address_family"]["redistribute"]
+ **config_data["address_family"]["redistribute"],
)
return command
@@ -85,7 +86,7 @@ def _tmplt_bgp_af_neighbor_distribute_list(config_data):
config_data = config_data["neighbors"]["address_family"]
for list_el in config_data["distribute_list"]:
command.append(
- cmd + afi + " distribute-list " + list_el["action"] + " " + str(list_el["acl"])
+ cmd + afi + " distribute-list " + list_el["action"] + " " + str(list_el["acl"]),
)
return command
@@ -98,7 +99,7 @@ def _tmplt_bgp_af_neighbor_route_map(config_data):
config_data = config_data["neighbors"]["address_family"]
for list_el in config_data["route_map"]:
command.append(
- cmd + afi + " route-map " + list_el["action"] + " " + str(list_el["route_map"])
+ cmd + afi + " route-map " + list_el["action"] + " " + str(list_el["route_map"]),
)
return command
@@ -111,7 +112,7 @@ def _tmplt_bgp_af_neighbor_prefix_list(config_data):
config_data = config_data["neighbors"]["address_family"]
for list_el in config_data["prefix_list"]:
command.append(
- cmd + afi + " prefix-list " + list_el["action"] + " " + str(list_el["prefix_list"])
+ cmd + afi + " prefix-list " + list_el["action"] + " " + str(list_el["prefix_list"]),
)
return command
@@ -124,7 +125,7 @@ def _tmplt_bgp_af_neighbor_filter_list(config_data):
config_data = config_data["neighbors"]["address_family"]
for list_el in config_data["filter_list"]:
command.append(
- cmd + afi + " filter-list " + list_el["action"] + " " + str(list_el["path_list"])
+ cmd + afi + " filter-list " + list_el["action"] + " " + str(list_el["path_list"]),
)
return command
@@ -237,7 +238,10 @@ class Bgp_address_familyTemplate(NetworkTemplate):
def __init__(self, lines=None, module=None):
prefix = {"set": "set", "remove": "delete"}
super(Bgp_address_familyTemplate, self).__init__(
- lines=lines, tmplt=self, prefix=prefix, module=module
+ lines=lines,
+ tmplt=self,
+ prefix=prefix,
+ module=module,
)
# fmt: off
@@ -262,9 +266,9 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": "{{ afi }}",
- }
- }
- }
+ },
+ },
+ },
},
{
"name": "aggregate_address",
@@ -296,12 +300,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
{
"prefix": "{{ address }}",
"as_set": "{{ True if as_set is defined }}",
- "summary_only": "{{ True if summary_only is defined }}"
- }
- ]
- }
- }
- }
+ "summary_only": "{{ True if summary_only is defined }}",
+ },
+ ],
+ },
+ },
+ },
},
{
"name": "network.backdoor",
@@ -330,12 +334,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"networks": [
{
"prefix": "{{ address }}",
- "backdoor": "{{ True }}"
- }
- ]
- }
- }
- }
+ "backdoor": "{{ True }}",
+ },
+ ],
+ },
+ },
+ },
},
{
"name": "network.path_limit",
@@ -366,12 +370,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"networks": [
{
"prefix": "{{ address }}",
- "path_limit": "{{ limit|int }}"
- }
- ]
- }
- }
- }
+ "path_limit": "{{ limit|int }}",
+ },
+ ],
+ },
+ },
+ },
},
{
"name": "network.route_map",
@@ -402,12 +406,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"networks": [
{
"prefix": "{{ address }}",
- "route_map": "{{ map }}"
- }
- ]
- }
- }
- }
+ "route_map": "{{ map }}",
+ },
+ ],
+ },
+ },
+ },
},
{
"name": "redistribute.metric",
@@ -437,12 +441,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"redistribute": [
{
"protocol": "{{ proto }}",
- "metric": "{{ val|int }}"
- }
- ]
- }
- }
- }
+ "metric": "{{ val|int }}",
+ },
+ ],
+ },
+ },
+ },
},
{
"name": "redistribute.route_map",
@@ -472,12 +476,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"redistribute": [
{
"protocol": "{{ proto }}",
- "route_map": "{{ map }}"
- }
- ]
- }
- }
- }
+ "route_map": "{{ map }}",
+ },
+ ],
+ },
+ },
+ },
},
{
"name": "redistribute.table",
@@ -505,12 +509,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"afi": "{{ afi }}",
"redistribute": [
{
- "table": "{{ tab }}"
- }
- ]
- }
- }
- }
+ "table": "{{ tab }}",
+ },
+ ],
+ },
+ },
+ },
},
{
"name": "neighbors",
@@ -533,9 +537,9 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"neighbors": {
"{{ address }}": {
"neighbor_address": "{{ address }}",
- }
- }
- }
+ },
+ },
+ },
},
{
"name": "neighbors.address_family",
@@ -562,11 +566,11 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": "{{ afi }}",
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.allowas_in",
@@ -597,12 +601,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": "{{ afi }}",
- "allowas_in": "{{ num }}"
- }
- }
- }
- }
- }
+ "allowas_in": "{{ num }}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.as_override",
@@ -631,12 +635,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": "{{ afi }}",
- "as_override": "{{ True }}"
- }
- }
- }
- }
- }
+ "as_override": "{{ True }}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.attribute_unchanged.as_path",
@@ -667,13 +671,13 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"{{ afi }}": {
"afi": "{{ afi }}",
"attribute_unchanged": {
- "as_path": "{{ True }}"
- }
- }
- }
- }
- }
- }
+ "as_path": "{{ True }}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.attribute_unchanged.med",
@@ -704,13 +708,13 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"{{ afi }}": {
"afi": "{{ afi }}",
"attribute_unchanged": {
- "med": "{{ True }}"
- }
- }
- }
- }
- }
- }
+ "med": "{{ True }}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.attribute_unchanged.next_hop",
@@ -741,13 +745,13 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"{{ afi }}": {
"afi": "{{ afi }}",
"attribute_unchanged": {
- "next_hop": "{{ True }}"
- }
- }
- }
- }
- }
- }
+ "next_hop": "{{ True }}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.capability_dynamic",
@@ -778,13 +782,13 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"{{ afi }}": {
"afi": "{{ afi }}",
"capability": {
- "dynamic": "{{ true }}"
- }
- }
- }
- }
- }
- }
+ "dynamic": "{{ true }}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.capability_orf",
@@ -816,13 +820,13 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"{{ afi }}": {
"afi": "{{ afi }}",
"capability": {
- "orf": "{{ orf }}"
- }
- }
- }
- }
- }
- }
+ "orf": "{{ orf }}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.default_originate",
@@ -853,12 +857,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": "{{ afi }}",
- "default_originate": "{{ map }}"
- }
- }
- }
- }
- }
+ "default_originate": "{{ map }}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.distribute_list",
@@ -892,14 +896,14 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"distribute_list": [
{
"action": "{{ action }}",
- "acl": "{{ list }}"
- }
- ]
- }
- }
- }
- }
- }
+ "acl": "{{ list }}",
+ },
+ ],
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.prefix_list",
@@ -933,14 +937,14 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"prefix_list": [
{
"action": "{{ action }}",
- "prefix_list": "{{ list }}"
- }
- ]
- }
- }
- }
- }
- }
+ "prefix_list": "{{ list }}",
+ },
+ ],
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.filter_list",
@@ -974,14 +978,14 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"filter_list": [
{
"action": "{{ action }}",
- "path_list": "{{ list }}"
- }
- ]
- }
- }
- }
- }
- }
+ "path_list": "{{ list }}",
+ },
+ ],
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.maximum_prefix",
@@ -1011,12 +1015,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": "{{ afi }}",
- "maximum_prefix": "{{ num }}"
- }
- }
- }
- }
- }
+ "maximum_prefix": "{{ num }}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.nexthop_local",
@@ -1045,12 +1049,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": "{{ afi }}",
- "nexthop_local": "{{ True }}"
- }
- }
- }
- }
- }
+ "nexthop_local": "{{ True }}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.nexthop_self",
@@ -1079,12 +1083,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": "{{ afi }}",
- "nexthop_self": "{{ True }}"
- }
- }
- }
- }
- }
+ "nexthop_self": "{{ True }}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.peer_group",
@@ -1114,12 +1118,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": "{{ afi }}",
- "peer_group": "{{ name }}"
- }
- }
- }
- }
- }
+ "peer_group": "{{ name }}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.remove_private_as",
@@ -1148,12 +1152,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": "{{ afi }}",
- "remove_private_as": "{{ True }}"
- }
- }
- }
- }
- }
+ "remove_private_as": "{{ True }}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.route_map",
@@ -1187,14 +1191,14 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"route_map": [
{
"action": "{{ action }}",
- "route_map": "{{ map }}"
- }
- ]
- }
- }
- }
- }
- }
+ "route_map": "{{ map }}",
+ },
+ ],
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.route_reflector_client",
@@ -1223,12 +1227,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": "{{ afi }}",
- "route_reflector_client": "{{ True }}"
- }
- }
- }
- }
- }
+ "route_reflector_client": "{{ True }}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.route_server_client",
@@ -1257,12 +1261,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": "{{ afi }}",
- "route_server_client": "{{ True }}"
- }
- }
- }
- }
- }
+ "route_server_client": "{{ True }}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.soft_reconfiguration",
@@ -1292,12 +1296,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": "{{ afi }}",
- "soft_reconfiguration": "{{ True }}"
- }
- }
- }
- }
- }
+ "soft_reconfiguration": "{{ True }}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.unsuppress_map",
@@ -1327,12 +1331,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": "{{ afi }}",
- "unsuppress_map": "{{ map }}"
- }
- }
- }
- }
- }
+ "unsuppress_map": "{{ map }}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "neighbors.weight",
@@ -1362,12 +1366,12 @@ class Bgp_address_familyTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": "{{ afi }}",
- "weight": "{{ num }}"
- }
- }
- }
- }
- }
+ "weight": "{{ num }}",
+ },
+ },
+ },
+ },
+ },
},
]
# fmt: on
diff --git a/plugins/module_utils/network/vyos/rm_templates/bgp_global.py b/plugins/module_utils/network/vyos/rm_templates/bgp_global.py
index 69cccce..bd95e08 100644
--- a/plugins/module_utils/network/vyos/rm_templates/bgp_global.py
+++ b/plugins/module_utils/network/vyos/rm_templates/bgp_global.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -30,7 +31,7 @@ def _tmplt_bgp_params_confederation(config_data):
"protocols bgp {as_number} parameters confederation ".format(**config_data)
+ k
+ " "
- + str(v)
+ + str(v),
)
return command
@@ -43,7 +44,7 @@ def _tmplt_bgp_maximum_paths(config_data):
"protocols bgp {as_number} maximum-paths ".format(**config_data)
+ list_el["path"]
+ " "
- + str(list_el["count"])
+ + str(list_el["count"]),
)
return command
@@ -88,7 +89,7 @@ def _tmplt_bgp_neighbor_timers(config_data):
+ " timers "
+ k
+ " "
- + str(v)
+ + str(v),
)
return command
@@ -98,7 +99,7 @@ def _tmplt_bgp_timers(config_data):
command = []
for k, v in iteritems(config_data["timers"]):
command.append(
- "protocols bgp {as_number} ".format(**config_data) + "timers " + k + " " + str(v)
+ "protocols bgp {as_number} ".format(**config_data) + "timers " + k + " " + str(v),
)
return command
@@ -106,21 +107,21 @@ def _tmplt_bgp_timers(config_data):
def _tmplt_bgp_neighbor_attribute_unchanged_as_path(config_data):
command = "protocols bgp {as_number} ".format(
- **config_data
+ **config_data,
) + "neighbor {address} attribute-unchanged as-path".format(**config_data["neighbor"])
return command
def _tmplt_bgp_neighbor_attribute_unchanged_med(config_data):
command = "protocols bgp {as_number} ".format(
- **config_data
+ **config_data,
) + "neighbor {address} attribute-unchanged med".format(**config_data["neighbor"])
return command
def _tmplt_bgp_neighbor_attribute_unchanged_next_hop(config_data):
command = "protocols bgp {as_number} ".format(
- **config_data
+ **config_data,
) + "neighbor {address} attribute-unchanged next-hop".format(**config_data["neighbor"])
return command
@@ -133,7 +134,7 @@ def _tmplt_bgp_neighbor_distribute_list(config_data):
+ "neighbor {address} distribute-list ".format(**config_data["neighbor"])
+ list_el["action"]
+ " "
- + str(list_el["acl"])
+ + str(list_el["acl"]),
)
return command
@@ -146,7 +147,7 @@ def _tmplt_bgp_neighbor_route_map(config_data):
+ "neighbor {address} route-map ".format(**config_data["neighbor"])
+ list_el["action"]
+ " "
- + str(list_el["route_map"])
+ + str(list_el["route_map"]),
)
return command
@@ -159,7 +160,7 @@ def _tmplt_bgp_neighbor_prefix_list(config_data):
+ "neighbor {address} prefix-list ".format(**config_data["neighbor"])
+ list_el["action"]
+ " "
- + str(list_el["prefix_list"])
+ + str(list_el["prefix_list"]),
)
return command
@@ -172,7 +173,7 @@ def _tmplt_bgp_neighbor_filter_list(config_data):
+ "neighbor {address} filter-list ".format(**config_data["neighbor"])
+ list_el["action"]
+ " "
- + str(list_el["path_list"])
+ + str(list_el["path_list"]),
)
return command
@@ -191,7 +192,10 @@ class Bgp_globalTemplate(NetworkTemplate):
def __init__(self, lines=None, module=None):
prefix = {"set": "set", "remove": "delete"}
super(Bgp_globalTemplate, self).__init__(
- lines=lines, tmplt=self, prefix=prefix, module=module
+ lines=lines,
+ tmplt=self,
+ prefix=prefix,
+ module=module,
)
# fmt: off
@@ -211,7 +215,7 @@ class Bgp_globalTemplate(NetworkTemplate):
"compval": "as_number",
"result": {
"as_number": "{{ as_num }}",
- }
+ },
},
{
"name": "aggregate_address",
@@ -237,10 +241,10 @@ class Bgp_globalTemplate(NetworkTemplate):
{
"prefix": "{{ address }}",
"as_set": "{{ True if as_set is defined }}",
- "summary_only": "{{ True if summary_only is defined }}"
- }
- ]
- }
+ "summary_only": "{{ True if summary_only is defined }}",
+ },
+ ],
+ },
},
{
"name": "maximum_paths",
@@ -265,9 +269,9 @@ class Bgp_globalTemplate(NetworkTemplate):
{
"path": "{{ path }}",
"count": "{{ count }}",
- }
- ]
- }
+ },
+ ],
+ },
},
{
"name": "neighbor.advertisement_interval",
@@ -292,10 +296,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "advertisement_interval": "{{ interval }}"
- }
- }
- }
+ "advertisement_interval": "{{ interval }}",
+ },
+ },
+ },
},
{
"name": "neighbor.allowas_in",
@@ -320,10 +324,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "allowas_in": "{{ count }}"
- }
- }
- }
+ "allowas_in": "{{ count }}",
+ },
+ },
+ },
},
{
"name": "neighbor.as_override",
@@ -346,10 +350,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "as_override": "{{ True }}"
- }
- }
- }
+ "as_override": "{{ True }}",
+ },
+ },
+ },
},
{
"name": "neighbor.attribute_unchanged.as_path",
@@ -374,11 +378,11 @@ class Bgp_globalTemplate(NetworkTemplate):
"{{ address }}": {
"address": "{{ address }}",
"attribute_unchanged": {
- "{{ 'as_path' }}": "{{ True }}"
- }
- }
- }
- }
+ "{{ 'as_path' }}": "{{ True }}",
+ },
+ },
+ },
+ },
},
{
"name": "neighbor.attribute_unchanged.med",
@@ -403,11 +407,11 @@ class Bgp_globalTemplate(NetworkTemplate):
"{{ address }}": {
"address": "{{ address }}",
"attribute_unchanged": {
- "{{ 'med' }}": "{{ True }}"
- }
- }
- }
- }
+ "{{ 'med' }}": "{{ True }}",
+ },
+ },
+ },
+ },
},
{
"name": "neighbor.attribute_unchanged.next_hop",
@@ -432,11 +436,11 @@ class Bgp_globalTemplate(NetworkTemplate):
"{{ address }}": {
"address": "{{ address }}",
"attribute_unchanged": {
- "{{ 'next_hop' }}": "{{ True }}"
- }
- }
- }
- }
+ "{{ 'next_hop' }}": "{{ True }}",
+ },
+ },
+ },
+ },
},
{
"name": "neighbor.capability_dynamic",
@@ -461,11 +465,11 @@ class Bgp_globalTemplate(NetworkTemplate):
"{{ address }}": {
"address": "{{ address }}",
"capability": {
- "dynamic": "{{ True if dynamic is defined}}"
- }
- }
- }
- }
+ "dynamic": "{{ True if dynamic is defined}}",
+ },
+ },
+ },
+ },
},
{
"name": "neighbor.capability_orf",
@@ -492,11 +496,11 @@ class Bgp_globalTemplate(NetworkTemplate):
"{{ address }}": {
"address": "{{ address }}",
"capability": {
- "orf": "{{ orf }}"
- }
- }
- }
- }
+ "orf": "{{ orf }}",
+ },
+ },
+ },
+ },
},
{
"name": "neighbor.default_originate",
@@ -521,10 +525,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "default_originate": "{{ map }}"
- }
- }
- }
+ "default_originate": "{{ map }}",
+ },
+ },
+ },
},
{
"name": "neighbor.description",
@@ -548,10 +552,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "description": "{{ desc }}"
- }
- }
- }
+ "description": "{{ desc }}",
+ },
+ },
+ },
},
{
"name": "neighbor.disable_capability_negotiation",
@@ -574,10 +578,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "disable_capability_negotiation": "{{ True }}"
- }
- }
- }
+ "disable_capability_negotiation": "{{ True }}",
+ },
+ },
+ },
},
{
"name": "neighbor.disable_connected_check",
@@ -600,10 +604,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "disable_connected_check": "{{ True }}"
- }
- }
- }
+ "disable_connected_check": "{{ True }}",
+ },
+ },
+ },
},
{
"name": "neighbor.disable_send_community",
@@ -627,10 +631,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "disable_send_community": "{{ comm }}"
- }
- }
- }
+ "disable_send_community": "{{ comm }}",
+ },
+ },
+ },
},
{
"name": "neighbor.distribute_list",
@@ -658,12 +662,12 @@ class Bgp_globalTemplate(NetworkTemplate):
"distribute_list": [
{
"action": "{{ action }}",
- "acl": "{{ list }}"
- }
- ]
- }
- }
- }
+ "acl": "{{ list }}",
+ },
+ ],
+ },
+ },
+ },
},
{
"name": "neighbor.ebgp_multihop",
@@ -687,10 +691,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "ebgp_multihop": "{{ hop|int }}"
- }
- }
- }
+ "ebgp_multihop": "{{ hop|int }}",
+ },
+ },
+ },
},
{
"name": "neighbor.filter_list",
@@ -718,12 +722,12 @@ class Bgp_globalTemplate(NetworkTemplate):
"filter_list": [
{
"action": "{{ action }}",
- "path_list": "{{ list }}"
- }
- ]
- }
- }
- }
+ "path_list": "{{ list }}",
+ },
+ ],
+ },
+ },
+ },
},
{
"name": "neighbor.local_as",
@@ -748,10 +752,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "local_as": "{{ as }}"
- }
- }
- }
+ "local_as": "{{ as }}",
+ },
+ },
+ },
},
{
"name": "neighbor.maximum_prefix",
@@ -775,10 +779,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "maximum_prefix": "{{ num }}"
- }
- }
- }
+ "maximum_prefix": "{{ num }}",
+ },
+ },
+ },
},
{
"name": "neighbor.nexthop_self",
@@ -801,10 +805,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "nexthop_self": "{{ True }}"
- }
- }
- }
+ "nexthop_self": "{{ True }}",
+ },
+ },
+ },
},
{
"name": "neighbor.override_capability",
@@ -827,10 +831,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "override_capability": "{{ True }}"
- }
- }
- }
+ "override_capability": "{{ True }}",
+ },
+ },
+ },
},
{
"name": "neighbor.passive",
@@ -853,10 +857,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "passive": "{{ True }}"
- }
- }
- }
+ "passive": "{{ True }}",
+ },
+ },
+ },
},
{
"name": "neighbor.password",
@@ -880,10 +884,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "password": "{{ pwd }}"
- }
- }
- }
+ "password": "{{ pwd }}",
+ },
+ },
+ },
},
{
"name": "neighbor.peer_group_name",
@@ -907,10 +911,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "peer_group_name": "{{ name }}"
- }
- }
- }
+ "peer_group_name": "{{ name }}",
+ },
+ },
+ },
},
{
"name": "neighbor.port",
@@ -934,10 +938,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "port": "{{ num|int }}"
- }
- }
- }
+ "port": "{{ num|int }}",
+ },
+ },
+ },
},
{
"name": "neighbor.prefix_list",
@@ -965,12 +969,12 @@ class Bgp_globalTemplate(NetworkTemplate):
"prefix_list": [
{
"action": "{{ action }}",
- "prefix_list": "{{ list }}"
- }
- ]
- }
- }
- }
+ "prefix_list": "{{ list }}",
+ },
+ ],
+ },
+ },
+ },
},
{
"name": "neighbor.remote_as",
@@ -994,10 +998,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "remote_as": "{{ num|int }}"
- }
- }
- }
+ "remote_as": "{{ num|int }}",
+ },
+ },
+ },
},
{
"name": "neighbor.remove_private_as",
@@ -1020,10 +1024,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "remove_private_as": "{{ True }}"
- }
- }
- }
+ "remove_private_as": "{{ True }}",
+ },
+ },
+ },
},
{
"name": "neighbor.route_map",
@@ -1051,12 +1055,12 @@ class Bgp_globalTemplate(NetworkTemplate):
"route_map": [
{
"action": "{{ action }}",
- "route_map": "{{ map }}"
- }
- ]
- }
- }
- }
+ "route_map": "{{ map }}",
+ },
+ ],
+ },
+ },
+ },
},
{
"name": "neighbor.route_reflector_client",
@@ -1079,10 +1083,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "route_reflector_client": "{{ True }}"
- }
- }
- }
+ "route_reflector_client": "{{ True }}",
+ },
+ },
+ },
},
{
"name": "neighbor.route_server_client",
@@ -1105,10 +1109,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "route_server_client": "{{ True }}"
- }
- }
- }
+ "route_server_client": "{{ True }}",
+ },
+ },
+ },
},
{
"name": "neighbor.shutdown",
@@ -1131,10 +1135,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "shutdown": "{{ True }}"
- }
- }
- }
+ "shutdown": "{{ True }}",
+ },
+ },
+ },
},
{
"name": "neighbor.soft_reconfiguration",
@@ -1158,10 +1162,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "soft_reconfiguration": "{{ True }}"
- }
- }
- }
+ "soft_reconfiguration": "{{ True }}",
+ },
+ },
+ },
},
{
"name": "neighbor.strict_capability_match",
@@ -1184,10 +1188,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "strict_capability_match": "{{ True }}"
- }
- }
- }
+ "strict_capability_match": "{{ True }}",
+ },
+ },
+ },
},
{
"name": "neighbor.unsuppress_map",
@@ -1211,10 +1215,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "unsuppress_map": "{{ map }}"
- }
- }
- }
+ "unsuppress_map": "{{ map }}",
+ },
+ },
+ },
},
{
"name": "neighbor.update_source",
@@ -1238,10 +1242,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "update_source": "{{ src }}"
- }
- }
- }
+ "update_source": "{{ src }}",
+ },
+ },
+ },
},
{
"name": "neighbor.weight",
@@ -1265,10 +1269,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "weight": "{{ num }}"
- }
- }
- }
+ "weight": "{{ num }}",
+ },
+ },
+ },
},
{
"name": "neighbor.ttl_security",
@@ -1292,10 +1296,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"neighbor": {
"{{ address }}": {
"address": "{{ address }}",
- "ttl_security": "{{ ttl|int }}"
- }
- }
- }
+ "ttl_security": "{{ ttl|int }}",
+ },
+ },
+ },
},
{
"name": "neighbor.timers",
@@ -1322,11 +1326,11 @@ class Bgp_globalTemplate(NetworkTemplate):
"{{ address }}": {
"address": "{{ address }}",
"timers": {
- "{{ type }}": "{{ sec }}"
- }
- }
- }
- }
+ "{{ type }}": "{{ sec }}",
+ },
+ },
+ },
+ },
},
{
"name": "network.backdoor",
@@ -1350,10 +1354,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"network": [
{
"address": "{{ address }}",
- "backdoor": "{{ True }}"
- }
- ]
- }
+ "backdoor": "{{ True }}",
+ },
+ ],
+ },
},
{
"name": "network.route_map",
@@ -1378,10 +1382,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"network": [
{
"address": "{{ address }}",
- "route_map": "{{ map }}"
- }
- ]
- }
+ "route_map": "{{ map }}",
+ },
+ ],
+ },
},
{
"name": "redistribute.metric",
@@ -1406,10 +1410,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"redistribute": [
{
"protocol": "{{ proto }}",
- "metric": "{{ val|int }}"
- }
- ]
- }
+ "metric": "{{ val|int }}",
+ },
+ ],
+ },
},
{
"name": "redistribute.route_map",
@@ -1434,10 +1438,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"redistribute": [
{
"protocol": "{{ proto }}",
- "route_map": "{{ val }}"
- }
- ]
- }
+ "route_map": "{{ val }}",
+ },
+ ],
+ },
},
{
"name": "timers",
@@ -1460,8 +1464,8 @@ class Bgp_globalTemplate(NetworkTemplate):
"as_number": "{{ as_num }}",
"timers": {
"{{ type }}": "{{ val }}",
- }
- }
+ },
+ },
},
{
"name": "bgp_params.always_compare_med",
@@ -1482,8 +1486,8 @@ class Bgp_globalTemplate(NetworkTemplate):
"as_number": "{{ as_num }}",
"bgp_params": {
"always_compare_med": "{{ True }}",
- }
- }
+ },
+ },
},
{
"name": "bgp_params.bestpath.as_path",
@@ -1507,9 +1511,9 @@ class Bgp_globalTemplate(NetworkTemplate):
"bgp_params": {
"bestpath": {
"as_path": "{{ path }}",
- }
- }
- }
+ },
+ },
+ },
},
{
"name": "bgp_params.bestpath.compare_routerid",
@@ -1532,9 +1536,9 @@ class Bgp_globalTemplate(NetworkTemplate):
"bgp_params": {
"bestpath": {
"compare_routerid": "{{ True }}",
- }
- }
- }
+ },
+ },
+ },
},
{
"name": "bgp_params.bestpath.med",
@@ -1558,9 +1562,9 @@ class Bgp_globalTemplate(NetworkTemplate):
"bgp_params": {
"bestpath": {
"med": "{{ path }}",
- }
- }
- }
+ },
+ },
+ },
},
{
"name": "bgp_params.cluster_id",
@@ -1582,8 +1586,8 @@ class Bgp_globalTemplate(NetworkTemplate):
"as_number": "{{ as_num }}",
"bgp_params": {
"cluster_id": "{{ id }}",
- }
- }
+ },
+ },
},
{
"name": "bgp_params.confederation",
@@ -1608,11 +1612,11 @@ class Bgp_globalTemplate(NetworkTemplate):
"confederation": [
{
"peers": "{{ val if type == 'peers' }}",
- "identifier": "{{ val if type == 'identifier' }}"
- }
- ]
- }
- }
+ "identifier": "{{ val if type == 'identifier' }}",
+ },
+ ],
+ },
+ },
},
{
"name": "bgp_params.dampening_half_life",
@@ -1635,10 +1639,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"as_number": "{{ as_num }}",
"bgp_params": {
"dampening": {
- "half_life": "{{ val }}"
- }
- }
- }
+ "half_life": "{{ val }}",
+ },
+ },
+ },
},
{
"name": "bgp_params.dampening_max_suppress_time",
@@ -1661,10 +1665,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"as_number": "{{ as_num }}",
"bgp_params": {
"dampening": {
- "max_suppress_time": "{{ val }}"
- }
- }
- }
+ "max_suppress_time": "{{ val }}",
+ },
+ },
+ },
},
{
"name": "bgp_params.dampening_re_use",
@@ -1687,10 +1691,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"as_number": "{{ as_num }}",
"bgp_params": {
"dampening": {
- "re_use": "{{ val }}"
- }
- }
- }
+ "re_use": "{{ val }}",
+ },
+ },
+ },
},
{
"name": "bgp_params.dampening_start_suppress_time",
@@ -1713,10 +1717,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"as_number": "{{ as_num }}",
"bgp_params": {
"dampening": {
- "start_suppress_time": "{{ val }}"
- }
- }
- }
+ "start_suppress_time": "{{ val }}",
+ },
+ },
+ },
},
{
"name": "bgp_params.default",
@@ -1741,10 +1745,10 @@ class Bgp_globalTemplate(NetworkTemplate):
"bgp_params": {
"default": {
"no_ipv4_unicast": "{{ True if no_ipv4_unicast is defined }}",
- "local_pref": "{{ local_pref.split(" " )[1] if local_pref is defined }}"
- }
- }
- }
+ "local_pref": "{{ local_pref.split(" " )[1] if local_pref is defined }}",
+ },
+ },
+ },
},
{
"name": "bgp_params.deterministic_med",
@@ -1765,8 +1769,8 @@ class Bgp_globalTemplate(NetworkTemplate):
"as_number": "{{ as_num }}",
"bgp_params": {
"deterministic_med": "{{ True }}",
- }
- }
+ },
+ },
},
{
"name": "bgp_params.disbale_network_import_check",
@@ -1787,8 +1791,8 @@ class Bgp_globalTemplate(NetworkTemplate):
"as_number": "{{ as_num }}",
"bgp_params": {
"disable_network_import_check": "{{ True }}",
- }
- }
+ },
+ },
},
{
"name": "bgp_params.distance.prefix",
@@ -1815,11 +1819,11 @@ class Bgp_globalTemplate(NetworkTemplate):
"distance": [
{
"prefix": "{{ prefix }}",
- "value": "{{ val }}"
- }
- ]
- }
- }
+ "value": "{{ val }}",
+ },
+ ],
+ },
+ },
},
{
"name": "bgp_params.distance.global",
@@ -1845,11 +1849,11 @@ class Bgp_globalTemplate(NetworkTemplate):
"distance": [
{
"type": "{{ type }}",
- "value": "{{ val }}"
- }
- ]
- }
- }
+ "value": "{{ val }}",
+ },
+ ],
+ },
+ },
},
{
"name": "bgp_params.enforce_first_as",
@@ -1870,8 +1874,8 @@ class Bgp_globalTemplate(NetworkTemplate):
"as_number": "{{ as_num }}",
"bgp_params": {
"enforce_first_as": "{{ True }}",
- }
- }
+ },
+ },
},
{
"name": "bgp_params.graceful_restart",
@@ -1893,8 +1897,8 @@ class Bgp_globalTemplate(NetworkTemplate):
"as_number": "{{ as_num }}",
"bgp_params": {
"graceful_restart": "{{ val }}",
- }
- }
+ },
+ },
},
{
"name": "bgp_params.log_neighbor_changes",
@@ -1915,8 +1919,8 @@ class Bgp_globalTemplate(NetworkTemplate):
"as_number": "{{ as_num }}",
"bgp_params": {
"log_neighbor_changes": "{{ True }}",
- }
- }
+ },
+ },
},
{
"name": "bgp_params.no_client_to_client_reflection",
@@ -1937,8 +1941,8 @@ class Bgp_globalTemplate(NetworkTemplate):
"as_number": "{{ as_num }}",
"bgp_params": {
"no_client_to_client_reflection": "{{ True }}",
- }
- }
+ },
+ },
},
{
"name": "bgp_params.no_fast_external_failover",
@@ -1959,8 +1963,8 @@ class Bgp_globalTemplate(NetworkTemplate):
"as_number": "{{ as_num }}",
"bgp_params": {
"no_fast_external_failover": "{{ True }}",
- }
- }
+ },
+ },
},
{
"name": "bgp_params.routerid",
@@ -1982,8 +1986,8 @@ class Bgp_globalTemplate(NetworkTemplate):
"as_number": "{{ as_num }}",
"bgp_params": {
"router_id": "{{ id }}",
- }
- }
+ },
+ },
},
{
"name": "bgp_params.scan_time",
@@ -2005,8 +2009,8 @@ class Bgp_globalTemplate(NetworkTemplate):
"as_number": "{{ as_num }}",
"bgp_params": {
"scan_time": "{{ val }}",
- }
- }
+ },
+ },
},
]
diff --git a/plugins/module_utils/network/vyos/rm_templates/hostname.py b/plugins/module_utils/network/vyos/rm_templates/hostname.py
index 7352794..29ab00f 100644
--- a/plugins/module_utils/network/vyos/rm_templates/hostname.py
+++ b/plugins/module_utils/network/vyos/rm_templates/hostname.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -25,7 +26,10 @@ class HostnameTemplate(NetworkTemplate):
def __init__(self, lines=None, module=None):
prefix = {"set": "set", "remove": "delete"}
super(HostnameTemplate, self).__init__(
- lines=lines, tmplt=self, prefix=prefix, module=module
+ lines=lines,
+ tmplt=self,
+ prefix=prefix,
+ module=module,
)
# fmt: off
@@ -38,11 +42,12 @@ class HostnameTemplate(NetworkTemplate):
^set\ssystem\shost-name
\s+(?P<name>\S+)
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "system host-name {{ hostname }}",
"result": {
- "hostname": "{{ name }}"
- }
+ "hostname": "{{ name }}",
+ },
},
]
# fmt: on
diff --git a/plugins/module_utils/network/vyos/rm_templates/logging_global.py b/plugins/module_utils/network/vyos/rm_templates/logging_global.py
index 82a4963..6c692cf 100644
--- a/plugins/module_utils/network/vyos/rm_templates/logging_global.py
+++ b/plugins/module_utils/network/vyos/rm_templates/logging_global.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -66,7 +67,10 @@ class Logging_globalTemplate(NetworkTemplate):
def __init__(self, lines=None, module=None):
prefix = {"set": "set", "remove": "delete"}
super(Logging_globalTemplate, self).__init__(
- lines=lines, tmplt=self, prefix=prefix, module=module
+ lines=lines,
+ tmplt=self,
+ prefix=prefix,
+ module=module,
)
# fmt: off
@@ -77,13 +81,14 @@ class Logging_globalTemplate(NetworkTemplate):
r"""
^set\ssystem
(\s(?P<syslog>syslog))
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "system syslog",
"result": {
"syslog": {
"state": "{{ 'enabled' if syslog is defined else 'disabled' }}",
- }
- }
+ },
+ },
},
{
"name": "console.facilities",
@@ -92,17 +97,19 @@ class Logging_globalTemplate(NetworkTemplate):
^set\ssystem\ssyslog\sconsole\sfacility
(\s(?P<facility>all|auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local[0-7]))?
(\slevel\s(?P<level>'(emerg|alert|crit|err|warning|notice|info|debug|all)'))?
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": tmplt_params,
"remval": "system syslog console facility {{ console.facilities.facility }}",
"result": {
"console": {
- "facilities": [{
- "facility": "{{ facility }}",
- "severity": "{{ level }}",
- }, ]
- }
- }
+ "facilities": [
+ {
+ "facility": "{{ facility }}",
+ "severity": "{{ level }}",
+ }, ],
+ },
+ },
},
{
"name": "console.state",
@@ -110,13 +117,14 @@ class Logging_globalTemplate(NetworkTemplate):
r"""
^set\ssystem\ssyslog
(\s(?P<console>console))
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "system syslog console",
"result": {
"console": {
"state": "{{ 'enabled' if console is defined else 'disabled' }}",
- }
- }
+ },
+ },
},
{
"name": "files.archive.state",
@@ -125,7 +133,8 @@ class Logging_globalTemplate(NetworkTemplate):
^set\ssystem\ssyslog\sfile
(\s(?P<path>\S+))?
(\s(?P<archive>archive))
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "system syslog file {{ files.path }} archive",
"result": {
"files": {
@@ -135,8 +144,8 @@ class Logging_globalTemplate(NetworkTemplate):
"state": "{{ 'enabled' if archive is defined else 'disabled' }}",
},
},
- }
- }
+ },
+ },
},
{
"name": "files.archive.size",
@@ -145,7 +154,8 @@ class Logging_globalTemplate(NetworkTemplate):
^set\ssystem\ssyslog\sfile
(\s(?P<path>\S+))?
(\sarchive\ssize\s(?P<size>'(\d+)'))?
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "system syslog file {{ files.path }} archive size {{ files.archive.size }}",
"result": {
"files": {
@@ -155,8 +165,8 @@ class Logging_globalTemplate(NetworkTemplate):
"size": "{{ size }}",
},
},
- }
- }
+ },
+ },
},
{
"name": "files.archive.file_num",
@@ -165,7 +175,8 @@ class Logging_globalTemplate(NetworkTemplate):
^set\ssystem\ssyslog\sfile
(\s(?P<path>\S+))?
(\sarchive\sfile\s(?P<file_num>'(\d+)'))?
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "system syslog file {{ files.path }} archive file {{ files.archive.file_num }}",
"result": {
"files": {
@@ -175,8 +186,8 @@ class Logging_globalTemplate(NetworkTemplate):
"file_num": "{{ file_num }}",
},
},
- }
- }
+ },
+ },
},
{
"name": "files",
@@ -186,20 +197,22 @@ class Logging_globalTemplate(NetworkTemplate):
(\s(?P<path>\S+))?
(\sfacility\s(?P<facility>all|auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local[0-7]))?
(\slevel\s(?P<level>'(emerg|alert|crit|err|warning|notice|info|debug|all)'))?
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": tmplt_params,
"remval": "system syslog file{{ (' ' + files.path) if files.path|d('') is defined else '' }}",
"result": {
"files": {
"{{ path }}": {
"path": "{{ path }}",
- "facilities": [{
- "facility": "{{ facility }}",
- "severity": "{{ level }}",
- }, ]
+ "facilities": [
+ {
+ "facility": "{{ facility }}",
+ "severity": "{{ level }}",
+ }, ],
},
- }
- }
+ },
+ },
},
{
"name": "global_params.state",
@@ -207,13 +220,14 @@ class Logging_globalTemplate(NetworkTemplate):
r"""
^set\ssystem\ssyslog
(\s(?P<global>global))
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "system syslog global",
"result": {
"global_params": {
"state": "{{ 'enabled' if global is defined else 'disabled' }}",
- }
- }
+ },
+ },
},
{
"name": "global_params.archive.state",
@@ -221,15 +235,16 @@ class Logging_globalTemplate(NetworkTemplate):
r"""
^set\ssystem\ssyslog\sglobal
(\s(?P<archive>archive))
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "system syslog global archive",
"result": {
"global_params": {
"archive": {
"state": "{{ 'enabled' if archive is defined else 'disabled' }}",
},
- }
- }
+ },
+ },
},
{
"name": "global_params.archive.file_num",
@@ -237,15 +252,16 @@ class Logging_globalTemplate(NetworkTemplate):
r"""
^set\ssystem\ssyslog\sglobal\sarchive\sfile
(\s(?P<file_num>'(\d+)'))?
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "system syslog global archive file {{ global_params.archive.file_num }}",
"result": {
"global_params": {
"archive": {
"file_num": "{{ file_num }}",
},
- }
- }
+ },
+ },
},
{
"name": "global_params.archive.size",
@@ -253,15 +269,16 @@ class Logging_globalTemplate(NetworkTemplate):
r"""
^set\ssystem\ssyslog\sglobal\sarchive\ssize
(\s(?P<size>'(\d+)'))?
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "system syslog global archive size {{ global_params.archive.size }}",
"result": {
"global_params": {
"archive": {
"size": "{{ size }}",
},
- }
- }
+ },
+ },
},
{
"name": "global_params.marker_interval",
@@ -269,14 +286,15 @@ class Logging_globalTemplate(NetworkTemplate):
r"""
^set\ssystem\ssyslog\sglobal\smarker\sinterval
(\s(?P<marker_interval>'(\d+)'))?
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "system syslog global marker interval {{ global_params.marker_interval }}",
"remval": "system syslog global marker",
"result": {
"global_params": {
"marker_interval": "{{ marker_interval }}",
- }
- }
+ },
+ },
},
{
"name": "global_params.preserve_fqdn",
@@ -284,13 +302,14 @@ class Logging_globalTemplate(NetworkTemplate):
r"""
^set\ssystem\ssyslog\sglobal
(\s(?P<preserve_fqdn>preserve-fqdn))
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "system syslog global preserve-fqdn",
"result": {
"global_params": {
"preserve_fqdn": "{{ True if preserve_fqdn is defined }}",
- }
- }
+ },
+ },
},
{
"name": "global_params.facilities",
@@ -299,17 +318,19 @@ class Logging_globalTemplate(NetworkTemplate):
^set\ssystem\ssyslog\sglobal\sfacility
(\s(?P<facility>all|auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local[0-7]))?
(\slevel\s(?P<level>'(emerg|alert|crit|err|warning|notice|info|debug|all)'))?
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": tmplt_params,
"remval": "system syslog global facility {{ global_params.facilities.facility }}",
"result": {
"global_params": {
- "facilities": [{
- "facility": "{{ facility }}",
- "severity": "{{ level }}",
- }, ],
- }
- }
+ "facilities": [
+ {
+ "facility": "{{ facility }}",
+ "severity": "{{ level }}",
+ }, ],
+ },
+ },
},
{
"name": "hosts.port",
@@ -318,7 +339,8 @@ class Logging_globalTemplate(NetworkTemplate):
^set\ssystem\ssyslog\shost
(\s(?P<hostname>\S+))
(\sport\s(?P<port>'(\d+)'))
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "system syslog host {{ hosts.hostname }} port {{ hosts.port }}",
"result": {
"hosts": {
@@ -326,8 +348,8 @@ class Logging_globalTemplate(NetworkTemplate):
"hostname": "{{ hostname }}",
"port": "{{ port }}",
},
- }
- }
+ },
+ },
},
{
"name": "hosts",
@@ -338,21 +360,23 @@ class Logging_globalTemplate(NetworkTemplate):
(\sfacility\s(?P<facility>all|auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local[0-7]))
(\slevel\s(?P<level>'(emerg|alert|crit|err|warning|notice|info|debug|all)'))?
(\sprotocol\s(?P<protocol>'(udp|tcp)'))?
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": tmplt_params,
"remval": "system syslog host {{ hosts.hostname }}",
"result": {
"hosts": {
"{{ hostname }}": {
"hostname": "{{ hostname }}",
- "facilities": [{
- "facility": "{{ facility }}",
- "severity": "{{ level }}",
- "protocol": "{{ protocol }}",
- }, ]
+ "facilities": [
+ {
+ "facility": "{{ facility }}",
+ "severity": "{{ level }}",
+ "protocol": "{{ protocol }}",
+ }, ],
},
- }
- }
+ },
+ },
},
{
"name": "users",
@@ -362,20 +386,22 @@ class Logging_globalTemplate(NetworkTemplate):
(\s(?P<username>\S+))?
(\sfacility\s(?P<facility>all|auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local[0-7]))?
(\slevel\s(?P<level>'(emerg|alert|crit|err|warning|notice|info|debug|all)'))?
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": tmplt_params,
"remval": "system syslog user {{ users.username }}",
"result": {
"users": {
"{{ username }}": {
"username": "{{ username }}",
- "facilities": [{
- "facility": "{{ facility }}",
- "severity": "{{ level }}",
- }, ]
- }
- }
- }
+ "facilities": [
+ {
+ "facility": "{{ facility }}",
+ "severity": "{{ level }}",
+ }, ],
+ },
+ },
+ },
},
]
# fmt: on
diff --git a/plugins/module_utils/network/vyos/rm_templates/ntp_global.py b/plugins/module_utils/network/vyos/rm_templates/ntp_global.py
index 5254035..33d173e 100644
--- a/plugins/module_utils/network/vyos/rm_templates/ntp_global.py
+++ b/plugins/module_utils/network/vyos/rm_templates/ntp_global.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -36,11 +37,12 @@ class NtpTemplate(NetworkTemplate):
r"""
^set\ssystem\sntp\sallow-clients\saddress (\s(?P<ipaddress>\S+))?
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "system ntp allow-clients address {{allow_clients}}",
"result": {
- "allow_clients": ["{{ipaddress}}"]
- }
+ "allow_clients": ["{{ipaddress}}"],
+ },
},
# set system ntp allow_clients
@@ -50,11 +52,12 @@ class NtpTemplate(NetworkTemplate):
r"""
^set\ssystem\sntp\sallow-clients
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "system ntp allow-clients",
"result": {
- }
+ },
},
@@ -65,11 +68,12 @@ class NtpTemplate(NetworkTemplate):
r"""
^set\ssystem\sntp\slisten-address (\s(?P<ip_address>\S+))?
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "system ntp listen-address {{listen_addresses}}",
"result": {
- "listen_addresses": ["{{ip_address}}"]
- }
+ "listen_addresses": ["{{ip_address}}"],
+ },
},
# set system ntp listen_address
@@ -79,10 +83,11 @@ class NtpTemplate(NetworkTemplate):
r"""
^set\ssystem\sntp\slisten-address
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "system ntp listen-address",
"result": {
- }
+ },
},
# set system ntp server <name>
@@ -92,16 +97,17 @@ class NtpTemplate(NetworkTemplate):
r"""
^set\ssystem\sntp\sserver (\s(?P<name>\S+))?
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "system ntp server {{server}}",
"result": {
"servers": {
"{{name}}": {
- "server": "{{name}}"
- }
- }
+ "server": "{{name}}",
+ },
+ },
- }
+ },
},
# set system ntp server <name> <options>
@@ -113,16 +119,17 @@ class NtpTemplate(NetworkTemplate):
\s(?P<name>\S+)
\s(?P<options>noselect|dynamic|pool|preempt|prefer)?
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "system ntp server {{server}} {{options}}",
"result": {
"servers": {
"{{name}}": {
"server": "{{name}}",
- "options": ["{{options}}"]
- }
- }
- }
- }
+ "options": ["{{options}}"],
+ },
+ },
+ },
+ },
]
# fmt: on
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 de3beba..aaaf7ff 100644
--- a/plugins/module_utils/network/vyos/rm_templates/ospf_interfaces.py
+++ b/plugins/module_utils/network/vyos/rm_templates/ospf_interfaces.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -70,7 +71,7 @@ def _tmplt_ospf_int_auth_password(config_data):
+ " "
+ params[0]
+ " authentication plaintext-password {plaintext_password}".format(
- **config_data["address_family"]["authentication"]
+ **config_data["address_family"]["authentication"],
)
)
return command
@@ -87,7 +88,7 @@ def _tmplt_ospf_int_auth_md5(config_data):
+ " "
+ params[0]
+ " authentication md5 key-id {key_id} ".format(
- **config_data["address_family"]["authentication"]["md5_key"]
+ **config_data["address_family"]["authentication"]["md5_key"],
)
+ "md5-key {key}".format(**config_data["address_family"]["authentication"]["md5_key"])
)
@@ -291,7 +292,10 @@ class Ospf_interfacesTemplate(NetworkTemplate):
def __init__(self, lines=None, module=None):
prefix = {"set": "set", "remove": "delete"}
super(Ospf_interfacesTemplate, self).__init__(
- lines=lines, tmplt=self, prefix=prefix, module=module
+ lines=lines,
+ tmplt=self,
+ prefix=prefix,
+ module=module,
)
# fmt: off
@@ -316,9 +320,9 @@ class Ospf_interfacesTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": '{{ "ipv4" if afi == "ip" else "ipv6" }}',
- }
- }
- }
+ },
+ },
+ },
},
{
"name": "authentication_password",
@@ -344,11 +348,11 @@ class Ospf_interfacesTemplate(NetworkTemplate):
"{{ afi }}": {
"afi": '{{ "ipv4" if afi == "ip" else "ipv6" }}',
"authentication": {
- "plaintext_password": "{{ text }}"
- }
- }
- }
- }
+ "plaintext_password": "{{ text }}",
+ },
+ },
+ },
+ },
},
{
"name": "authentication_md5",
@@ -380,12 +384,12 @@ class Ospf_interfacesTemplate(NetworkTemplate):
"authentication": {
"md5_key": {
"key_id": "{{ id }}",
- "key": "{{ text }}"
- }
- }
- }
- }
- }
+ "key": "{{ text }}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "bandwidth",
@@ -409,10 +413,10 @@ class Ospf_interfacesTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": '{{ "ipv4" if afi == "ip" else "ipv6" }}',
- "bandwidth": "{{ bw }}"
- }
- }
- }
+ "bandwidth": "{{ bw }}",
+ },
+ },
+ },
},
{
"name": "cost",
@@ -436,10 +440,10 @@ class Ospf_interfacesTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": '{{ "ipv4" if afi == "ip" else "ipv6" }}',
- "cost": "{{ val }}"
- }
- }
- }
+ "cost": "{{ val }}",
+ },
+ },
+ },
},
{
"name": "hello_interval",
@@ -463,10 +467,10 @@ class Ospf_interfacesTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": '{{ "ipv4" if afi == "ip" else "ipv6" }}',
- "hello_interval": "{{ val }}"
- }
- }
- }
+ "hello_interval": "{{ val }}",
+ },
+ },
+ },
},
{
"name": "dead_interval",
@@ -490,10 +494,10 @@ class Ospf_interfacesTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": '{{ "ipv4" if afi == "ip" else "ipv6" }}',
- "dead_interval": "{{ val }}"
- }
- }
- }
+ "dead_interval": "{{ val }}",
+ },
+ },
+ },
},
{
"name": "mtu_ignore",
@@ -516,10 +520,10 @@ class Ospf_interfacesTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": '{{ "ipv4" if afi == "ip" else "ipv6" }}',
- "mtu_ignore": "{{ True if mtu is defined }}"
- }
- }
- }
+ "mtu_ignore": "{{ True if mtu is defined }}",
+ },
+ },
+ },
},
{
"name": "network",
@@ -543,10 +547,10 @@ class Ospf_interfacesTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": '{{ "ipv4" if afi == "ip" else "ipv6" }}',
- "network": "{{ val }}"
- }
- }
- }
+ "network": "{{ val }}",
+ },
+ },
+ },
},
{
"name": "priority",
@@ -570,10 +574,10 @@ class Ospf_interfacesTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": '{{ "ipv4" if afi == "ip" else "ipv6" }}',
- "priority": "{{ val }}"
- }
- }
- }
+ "priority": "{{ val }}",
+ },
+ },
+ },
},
{
"name": "retransmit_interval",
@@ -597,10 +601,10 @@ class Ospf_interfacesTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": '{{ "ipv4" if afi == "ip" else "ipv6" }}',
- "retransmit_interval": "{{ val }}"
- }
- }
- }
+ "retransmit_interval": "{{ val }}",
+ },
+ },
+ },
},
{
"name": "transmit_delay",
@@ -624,10 +628,10 @@ class Ospf_interfacesTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": '{{ "ipv4" if afi == "ip" else "ipv6" }}',
- "transmit_delay": "{{ val }}"
- }
- }
- }
+ "transmit_delay": "{{ val }}",
+ },
+ },
+ },
},
{
"name": "ifmtu",
@@ -651,10 +655,10 @@ class Ospf_interfacesTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": '{{ "ipv4" if afi == "ip" else "ipv6" }}',
- "ifmtu": "{{ val }}"
- }
- }
- }
+ "ifmtu": "{{ val }}",
+ },
+ },
+ },
},
{
"name": "instance",
@@ -678,10 +682,10 @@ class Ospf_interfacesTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": '{{ "ipv4" if afi == "ip" else "ipv6" }}',
- "instance": "{{ val }}"
- }
- }
- }
+ "instance": "{{ val }}",
+ },
+ },
+ },
},
{
"name": "passive",
@@ -704,10 +708,10 @@ class Ospf_interfacesTemplate(NetworkTemplate):
"address_family": {
"{{ afi }}": {
"afi": '{{ "ipv4" if afi == "ip" else "ipv6" }}',
- "passive": "{{ True if pass is defined }}"
- }
- }
- }
+ "passive": "{{ True if pass is defined }}",
+ },
+ },
+ },
},
{
"name": "interface_name",
@@ -723,7 +727,7 @@ class Ospf_interfacesTemplate(NetworkTemplate):
"setval": "set interface {{ type }} {{ name }}",
"result": {
"name": "{{ name }}",
- }
+ },
},
]
# fmt: on
diff --git a/plugins/module_utils/network/vyos/rm_templates/prefix_lists.py b/plugins/module_utils/network/vyos/rm_templates/prefix_lists.py
index 00a157e..0e99cfe 100644
--- a/plugins/module_utils/network/vyos/rm_templates/prefix_lists.py
+++ b/plugins/module_utils/network/vyos/rm_templates/prefix_lists.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -25,7 +26,10 @@ class Prefix_listsTemplate(NetworkTemplate):
def __init__(self, lines=None, module=None):
prefix = {"set": "set", "remove": "delete"}
super(Prefix_listsTemplate, self).__init__(
- lines=lines, tmplt=self, module=module, prefix=prefix
+ lines=lines,
+ tmplt=self,
+ module=module,
+ prefix=prefix,
)
# fmt: off
@@ -39,7 +43,8 @@ class Prefix_listsTemplate(NetworkTemplate):
\spolicy
\sprefix-(?P<afi>\S+)
\s(?P<name>\S+)
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "policy prefix-{{ 'list' if afi == 'ipv4' else 'list6' }} {{ name }}",
"result": {
"{{ 'ipv4' if afi == 'list' else 'ipv6' }}": {
@@ -47,9 +52,9 @@ class Prefix_listsTemplate(NetworkTemplate):
"prefix_lists": {
"{{ name }}": {
"name": "{{ name }}",
- }
- }
- }
+ },
+ },
+ },
},
},
@@ -63,7 +68,8 @@ class Prefix_listsTemplate(NetworkTemplate):
\sprefix-(?P<afi>\S+)
\s(?P<name>\S+)
\sdescription\s'(?P<description>.+)'
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "policy prefix-{{ 'list' if afi == 'ipv4' else 'list6' }} {{ name }} description '{{ description }}'",
"result": {
"{{ 'ipv4' if afi == 'list' else 'ipv6' }}": {
@@ -71,10 +77,10 @@ class Prefix_listsTemplate(NetworkTemplate):
"prefix_lists": {
"{{ name }}": {
"name": "{{ name }}",
- "description": "{{ description }}"
- }
- }
- }
+ "description": "{{ description }}",
+ },
+ },
+ },
},
},
@@ -88,7 +94,8 @@ class Prefix_listsTemplate(NetworkTemplate):
\sprefix-(?P<afi>\S+)
\s(?P<name>\S+)
\srule\s(?P<sequence>\d+)
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "policy prefix-{{ 'list' if afi == 'ipv4' else 'list6' }} {{ name }} rule {{ sequence }}",
"result": {
"{{ 'ipv4' if afi == 'list' else 'ipv6' }}": {
@@ -98,12 +105,12 @@ class Prefix_listsTemplate(NetworkTemplate):
"name": "{{ name }}",
"entries": {
"{{ sequence }}": {
- "sequence": "{{ sequence }}"
- }
- }
- }
- }
- }
+ "sequence": "{{ sequence }}",
+ },
+ },
+ },
+ },
+ },
},
},
@@ -118,7 +125,8 @@ class Prefix_listsTemplate(NetworkTemplate):
\s(?P<name>\S+)
\srule\s(?P<sequence>\d+)
\saction\s'(?P<action>permit|deny)'
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "policy prefix-{{ 'list' if afi == 'ipv4' else 'list6' }} {{ name }} rule {{ sequence }} action '{{ action }}'",
"result": {
"{{ 'ipv4' if afi == 'list' else 'ipv6' }}": {
@@ -129,12 +137,12 @@ class Prefix_listsTemplate(NetworkTemplate):
"entries": {
"{{ sequence }}": {
"sequence": "{{ sequence }}",
- "action": "{{ action }}"
- }
- }
- }
- }
- }
+ "action": "{{ action }}",
+ },
+ },
+ },
+ },
+ },
},
},
@@ -149,7 +157,8 @@ class Prefix_listsTemplate(NetworkTemplate):
\s(?P<name>\S+)
\srule\s(?P<sequence>\d+)
\sdescription\s'(?P<rule_description>.+)'
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"compval": "description",
"setval": "policy prefix-{{ 'list' if afi == 'ipv4' else 'list6' }} {{ name }} rule {{ sequence }} description '{{ description }}'",
"result": {
@@ -161,12 +170,12 @@ class Prefix_listsTemplate(NetworkTemplate):
"entries": {
"{{ sequence }}": {
"sequence": "{{ sequence }}",
- "description": "{{ rule_description }}"
- }
- }
- }
- }
- }
+ "description": "{{ rule_description }}",
+ },
+ },
+ },
+ },
+ },
},
},
@@ -181,7 +190,8 @@ class Prefix_listsTemplate(NetworkTemplate):
\s(?P<name>\S+)
\srule\s(?P<sequence>\d+)
\sge\s'(?P<ge>\d+)'
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "policy prefix-{{ 'list' if afi == 'ipv4' else 'list6' }} {{ name }} rule {{ sequence }} ge '{{ ge }}'",
"result": {
"{{ 'ipv4' if afi == 'list' else 'ipv6' }}": {
@@ -192,12 +202,12 @@ class Prefix_listsTemplate(NetworkTemplate):
"entries": {
"{{ sequence }}": {
"sequence": "{{ sequence }}",
- "ge": "{{ ge }}"
- }
- }
- }
- }
- }
+ "ge": "{{ ge }}",
+ },
+ },
+ },
+ },
+ },
},
},
@@ -212,7 +222,8 @@ class Prefix_listsTemplate(NetworkTemplate):
\s(?P<name>\S+)
\srule\s(?P<sequence>\d+)
\sle\s'(?P<le>\d+)'
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "policy prefix-{{ 'list' if afi == 'ipv4' else 'list6' }} {{ name }} rule {{ sequence }} le '{{ le }}'",
"result": {
"{{ 'ipv4' if afi == 'list' else 'ipv6' }}": {
@@ -223,12 +234,12 @@ class Prefix_listsTemplate(NetworkTemplate):
"entries": {
"{{ sequence }}": {
"sequence": "{{ sequence }}",
- "le": "{{ le }}"
- }
- }
- }
- }
- }
+ "le": "{{ le }}",
+ },
+ },
+ },
+ },
+ },
},
},
@@ -243,7 +254,8 @@ class Prefix_listsTemplate(NetworkTemplate):
\s(?P<name>\S+)
\srule\s(?P<sequence>\d+)
\sprefix\s'(?P<prefix>\S+)'
- $""", re.VERBOSE),
+ $""", re.VERBOSE,
+ ),
"setval": "policy prefix-{{ 'list' if afi == 'ipv4' else 'list6' }} {{ name }} rule {{ sequence }} prefix '{{ prefix }}'",
"result": {
"{{ 'ipv4' if afi == 'list' else 'ipv6' }}": {
@@ -254,12 +266,12 @@ class Prefix_listsTemplate(NetworkTemplate):
"entries": {
"{{ sequence }}": {
"sequence": "{{ sequence }}",
- "prefix": "{{ prefix }}"
- }
- }
- }
- }
- }
+ "prefix": "{{ prefix }}",
+ },
+ },
+ },
+ },
+ },
},
},
]
diff --git a/plugins/module_utils/network/vyos/rm_templates/route_maps.py b/plugins/module_utils/network/vyos/rm_templates/route_maps.py
index 1652a23..8f218a6 100644
--- a/plugins/module_utils/network/vyos/rm_templates/route_maps.py
+++ b/plugins/module_utils/network/vyos/rm_templates/route_maps.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -42,8 +43,8 @@ class Route_mapsTemplate(NetworkTemplate):
"route_maps": {
"{{ route_map }}": {
"route_map": '{{ route_map }}',
- }
- }
+ },
+ },
},
},
{
@@ -63,12 +64,12 @@ class Route_mapsTemplate(NetworkTemplate):
"entries": {
"{{sequence}}":
{
- "sequence": "{{sequence}}"
- }
- }
- }
- }
- }
+ "sequence": "{{sequence}}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "call",
@@ -87,12 +88,12 @@ class Route_mapsTemplate(NetworkTemplate):
"{{sequence}}":
{
"sequence": "{{sequence}}",
- "call": "{{call}}"
- }
- }
- }
- }
- }
+ "call": "{{call}}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "description",
@@ -111,12 +112,12 @@ class Route_mapsTemplate(NetworkTemplate):
"{{sequence}}":
{
"sequence": "{{sequence}}",
- "description": "{{description}}"
- }
- }
- }
- }
- }
+ "description": "{{description}}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "action",
@@ -135,12 +136,12 @@ class Route_mapsTemplate(NetworkTemplate):
"{{sequence}}":
{
"sequence": "{{sequence}}",
- "action": "{{action}}"
- }
- }
- }
- }
- }
+ "action": "{{action}}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "continue_sequence",
@@ -159,12 +160,12 @@ class Route_mapsTemplate(NetworkTemplate):
"{{sequence}}":
{
"sequence": "{{sequence}}",
- "continue_sequence": "{{continue}}"
- }
- }
- }
- }
- }
+ "continue_sequence": "{{continue}}",
+ },
+ },
+ },
+ },
+ },
},
{
"name": "on_match_next",
@@ -185,13 +186,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"on_match": {
- "next": "{{True if next is defined}}"
- }
- }
- }
- }
- }
- }
+ "next": "{{True if next is defined}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "on_match_goto",
@@ -212,13 +213,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"on_match": {
- "goto": "{{goto}}"
- }
- }
- }
- }
- }
- }
+ "goto": "{{goto}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_aggregator_ip",
@@ -240,14 +241,14 @@ class Route_mapsTemplate(NetworkTemplate):
"sequence": "{{sequence}}",
"set": {
"aggregator": {
- "ip": "{{ip}}"
- }
- }
- }
- }
- }
- }
- }
+ "ip": "{{ip}}",
+ },
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_aggregator_as",
@@ -269,14 +270,14 @@ class Route_mapsTemplate(NetworkTemplate):
"sequence": "{{sequence}}",
"set": {
"aggregator": {
- "as": "{{as}}"
- }
- }
- }
- }
- }
- }
- }
+ "as": "{{as}}",
+ },
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_as_path_exclude",
@@ -297,13 +298,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "as_path_exclude": "{{as}}"
- }
- }
- }
- }
- }
- }
+ "as_path_exclude": "{{as}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_as_path_prepend",
@@ -324,13 +325,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "as_path_prepend": "{{as}}"
- }
- }
- }
- }
- }
- }
+ "as_path_prepend": "{{as}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_atomic_aggregate",
@@ -350,13 +351,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "atomic_aggregate": "{{True if as is defined}}"
- }
- }
- }
- }
- }
- }
+ "atomic_aggregate": "{{True if as is defined}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_bgp_extcommunity_rt",
@@ -378,13 +379,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "bgp_extcommunity_rt": "{{bgp}}"
- }
- }
- }
- }
- }
- }
+ "bgp_extcommunity_rt": "{{bgp}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_comm_list",
@@ -406,13 +407,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "comm_list": {"comm_list": "{{comm_list}}"}
- }
- }
- }
- }
- }
- }
+ "comm_list": {"comm_list": "{{comm_list}}"},
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_comm_list_delete",
@@ -434,13 +435,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "comm_list": {"delete": "{{True if delete is defined}}"}
- }
- }
- }
- }
- }
- }
+ "comm_list": {"delete": "{{True if delete is defined}}"},
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_extcommunity_rt",
@@ -462,13 +463,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "extcommunity_rt": "{{extcommunity_rt}}"
- }
- }
- }
- }
- }
- }
+ "extcommunity_rt": "{{extcommunity_rt}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_extcommunity_soo",
@@ -490,13 +491,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "extcommunity_soo": "{{set.extcommunity_soo}}"
- }
- }
- }
- }
- }
- }
+ "extcommunity_soo": "{{set.extcommunity_soo}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_ip_next_hop",
@@ -518,13 +519,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "ip_next_hop": "{{ip_next_hop}}"
- }
- }
- }
- }
- }
- }
+ "ip_next_hop": "{{ip_next_hop}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_ipv6_next_hop",
@@ -550,14 +551,14 @@ class Route_mapsTemplate(NetworkTemplate):
"set": {
"ipv6_next_hop": {
"ip_type": "{{type}}",
- "value": "{{value}}"
- }
- }
- }
- }
- }
- }
- }
+ "value": "{{value}}",
+ },
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_large_community",
@@ -579,13 +580,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "large_community": "{{large_community}}"
- }
- }
- }
- }
- }
- }
+ "large_community": "{{large_community}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_local_preference",
@@ -607,13 +608,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "local_preference": "{{local_preference}}"
- }
- }
- }
- }
- }
- }
+ "local_preference": "{{local_preference}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_metric",
@@ -635,13 +636,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "metric": "{{metric}}"
- }
- }
- }
- }
- }
- }
+ "metric": "{{metric}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_metric_type",
@@ -663,13 +664,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "metric_type": "{{metric_type}}"
- }
- }
- }
- }
- }
- }
+ "metric_type": "{{metric_type}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_origin",
@@ -691,13 +692,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "origin": "{{origin}}"
- }
- }
- }
- }
- }
- }
+ "origin": "{{origin}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_originator_id",
@@ -719,13 +720,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "originator_id": "{{originator_id}}"
- }
- }
- }
- }
- }
- }
+ "originator_id": "{{originator_id}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_src",
@@ -747,13 +748,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "src": "{{src}}"
- }
- }
- }
- }
- }
- }
+ "src": "{{src}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_tag",
@@ -775,13 +776,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "tag": "{{tag}}"
- }
- }
- }
- }
- }
- }
+ "tag": "{{tag}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_weight",
@@ -803,13 +804,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"set": {
- "weight": "{{weight}}"
- }
- }
- }
- }
- }
- }
+ "weight": "{{weight}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "set_community",
@@ -833,13 +834,13 @@ class Route_mapsTemplate(NetworkTemplate):
"set": {
"community": {
"value": "{{value}}",
- }
- }
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "match_as_path",
@@ -861,13 +862,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"match": {
- "as_path": "{{as_path}}"
- }
- }
- }
- }
- }
- }
+ "as_path": "{{as_path}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "match_community_community_list",
@@ -889,13 +890,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"match": {
- "community": {"community_list": "{{community_list}}"}
- }
- }
- }
- }
- }
- }
+ "community": {"community_list": "{{community_list}}"},
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "match_community_exact_match",
@@ -917,13 +918,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"match": {
- "community": {"exact_match": "{{True if exact_match is defined}}"}
- }
- }
- }
- }
- }
- }
+ "community": {"exact_match": "{{True if exact_match is defined}}"},
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "match_extcommunity",
@@ -945,13 +946,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"match": {
- "extcommunity": "{{extcommunity}}"
- }
- }
- }
- }
- }
- }
+ "extcommunity": "{{extcommunity}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "match_interface",
@@ -973,13 +974,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"match": {
- "interface": "{{interface}}"
- }
- }
- }
- }
- }
- }
+ "interface": "{{interface}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "match_large_community_large_community_list",
@@ -1001,13 +1002,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"match": {
- "large_community_large_community_list": "{{lc}}"
- }
- }
- }
- }
- }
- }
+ "large_community_large_community_list": "{{lc}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "match_metric",
@@ -1029,13 +1030,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"match": {
- "metric": "{{metric}}"
- }
- }
- }
- }
- }
- }
+ "metric": "{{metric}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "match_origin",
@@ -1057,13 +1058,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"match": {
- "origin": "{{origin}}"
- }
- }
- }
- }
- }
- }
+ "origin": "{{origin}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "match_peer",
@@ -1085,13 +1086,13 @@ class Route_mapsTemplate(NetworkTemplate):
{
"sequence": "{{sequence}}",
"match": {
- "peer": "{{peer}}"
- }
- }
- }
- }
- }
- }
+ "peer": "{{peer}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "match_ip_address",
@@ -1117,15 +1118,15 @@ class Route_mapsTemplate(NetworkTemplate):
"ip": {
"address": {
"list_type": "{{list_type}}",
- "value": "{{value}}"
- }
- }
- }
- }
- }
- }
- }
- }
+ "value": "{{value}}",
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "match_ip_next_hop",
@@ -1151,15 +1152,15 @@ class Route_mapsTemplate(NetworkTemplate):
"ip": {
"next_hop": {
"list_type": "{{list_type}}",
- "value": "{{value}}"
- }
- }
- }
- }
- }
- }
- }
- }
+ "value": "{{value}}",
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "match_ip_route_source",
@@ -1185,15 +1186,15 @@ class Route_mapsTemplate(NetworkTemplate):
"ip": {
"route_source": {
"list_type": "{{list_type}}",
- "value": "{{value}}"
- }
- }
- }
- }
- }
- }
- }
- }
+ "value": "{{value}}",
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "match_ipv6_address",
@@ -1219,15 +1220,15 @@ class Route_mapsTemplate(NetworkTemplate):
"ipv6": {
"address": {
"list_type": "{{list_type}}",
- "value": "{{value}}"
- }
- }
- }
- }
- }
- }
- }
- }
+ "value": "{{value}}",
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "match_ipv6_nexthop",
@@ -1250,14 +1251,14 @@ class Route_mapsTemplate(NetworkTemplate):
"sequence": "{{sequence}}",
"match": {
"ipv6": {
- "next_hop": "{{value}}"
- }
- }
- }
- }
- }
- }
- }
+ "next_hop": "{{value}}",
+ },
+ },
+ },
+ },
+ },
+ },
+ },
},
{
"name": "match_rpki",
@@ -1279,13 +1280,13 @@ class Route_mapsTemplate(NetworkTemplate):
"{{sequence}}": {
"sequence": "{{sequence}}",
"match": {
- "rpki": "{{value}}"
- }
- }
- }
- }
- }
- }
+ "rpki": "{{value}}",
+ },
+ },
+ },
+ },
+ },
+ },
},
]
diff --git a/plugins/module_utils/network/vyos/rm_templates/snmp_server.py b/plugins/module_utils/network/vyos/rm_templates/snmp_server.py
index 15a0804..724be22 100644
--- a/plugins/module_utils/network/vyos/rm_templates/snmp_server.py
+++ b/plugins/module_utils/network/vyos/rm_templates/snmp_server.py
@@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
"""
@@ -124,7 +125,10 @@ class Snmp_serverTemplate(NetworkTemplate):
def __init__(self, lines=None, module=None):
prefix = {"set": "set", "remove": "delete"}
super(Snmp_serverTemplate, self).__init__(
- lines=lines, tmplt=self, prefix=prefix, module=module
+ lines=lines,
+ tmplt=self,
+ prefix=prefix,
+ module=module,
)
# fmt: off
@@ -140,7 +144,8 @@ class Snmp_serverTemplate(NetworkTemplate):
\s*(client\s(?P<client>\S+))*
\s*(network\s(?P<network>\S+))*
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": _tmplt_snmp_server_communities,
"result": {
"communities": {
@@ -148,10 +153,10 @@ class Snmp_serverTemplate(NetworkTemplate):
"name": "{{ name }}",
"clients": ['{{ client if client is defined else "None" }}'],
"networks": ['{{ network if network is defined else "None" }}'],
- "authorization_type": '{{ auth.split(" ")[1] if auth is defined else None }}'
- }
- }
- }
+ "authorization_type": '{{ auth.split(" ")[1] if auth is defined else None }}',
+ },
+ },
+ },
},
# service snmp contact <>
{
@@ -161,11 +166,12 @@ class Snmp_serverTemplate(NetworkTemplate):
^set\sservice\ssnmp\scontact
\s+(?P<name>\S+)
*$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "service snmp contact {{ contact }}",
"result": {
- "contact": "{{ name }}"
- }
+ "contact": "{{ name }}",
+ },
},
# service snmp description <>
{
@@ -175,11 +181,12 @@ class Snmp_serverTemplate(NetworkTemplate):
^set\sservice\ssnmp\sdescription
\s+(?P<name>\S+)
*$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "service snmp description {{ description }}",
"result": {
- "description": "{{ name }}"
- }
+ "description": "{{ name }}",
+ },
},
# service snmp listen-address <> port <>
{
@@ -191,17 +198,18 @@ class Snmp_serverTemplate(NetworkTemplate):
\s*(port)*
\s*(?P<port>\d+)*
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "service snmp listen-address {{ listen_addresses.address }}"
"{{ (' port ' + listen_addresses.port|string) if listen_addresses.port is defined else '' }}",
"result": {
"listen_addresses": {
"{{ addr }}": {
"address": "{{ addr }}",
- "port": "{{ port }}"
- }
- }
- }
+ "port": "{{ port }}",
+ },
+ },
+ },
},
# service snmp location <>
{
@@ -211,11 +219,12 @@ class Snmp_serverTemplate(NetworkTemplate):
^set\sservice\ssnmp\slocation
\s(?P<name>.*)
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "service snmp location {{ '\\'' + location + '\\''}}",
"result": {
- "location": "{{ name }}"
- }
+ "location": "{{ name }}",
+ },
},
# service snmp smux-peer <>
{
@@ -225,11 +234,12 @@ class Snmp_serverTemplate(NetworkTemplate):
^set\sservice\ssnmp\ssmux-peer
\s+(?P<name>\S+)
*$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "service snmp smux-peer {{ smux_peer }}",
"result": {
- "smux_peer": "{{ name }}"
- }
+ "smux_peer": "{{ name }}",
+ },
},
# service snmp trap-source <>
{
@@ -239,11 +249,12 @@ class Snmp_serverTemplate(NetworkTemplate):
^set\sservice\ssnmp\strap-source
\s+(?P<name>\S+)
*$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "service snmp trap-source {{ trap_source }}",
"result": {
- "trap_source": "{{ name }}"
- }
+ "trap_source": "{{ name }}",
+ },
},
# service snmp trap-target <>
{
@@ -255,15 +266,16 @@ class Snmp_serverTemplate(NetworkTemplate):
\s*(?P<comm>community\s\S+)*
\s*(?P<port>port\s\d+)*
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": _tmplt_snmp_server_trap_target,
"result": {
"trap_target": {
"address": "{{ name }}",
"community": "{{ comm.split(" ")[1] if comm is defined else None }}",
"port": "{{ port.split(" ")[1] if port is defined else None }}",
- }
- }
+ },
+ },
},
# service snmp v3 engineid <>
{
@@ -273,13 +285,14 @@ class Snmp_serverTemplate(NetworkTemplate):
^set\sservice\ssnmp\sv3\sengineid
\s+(?P<name>\S+)
*$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "service snmp v3 engineid {{ snmp_v3.engine_id }}",
"result": {
"snmp_v3": {
"engine_id": "{{ name }}",
- }
- }
+ },
+ },
},
# service snmp v3 group <>
{
@@ -292,7 +305,8 @@ class Snmp_serverTemplate(NetworkTemplate):
\s*(?P<sec>seclevel\s\S+)*
\s*(?P<view>view\s\S+)*
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": _tmplt_snmp_server_v3_groups,
"result": {
"snmp_v3": {
@@ -302,10 +316,10 @@ class Snmp_serverTemplate(NetworkTemplate):
"mode": '{{ mode.split(" ")[1] if mode is defined else None }}',
"seclevel": '{{ sec.split(" ")[1] if sec is defined else None }}',
"view": '{{ view.split(" ")[1] if view is defined else None }}',
- }
- }
- }
- }
+ },
+ },
+ },
+ },
},
# service snmp v3 trap-target <> auth <>
{
@@ -319,7 +333,8 @@ class Snmp_serverTemplate(NetworkTemplate):
\s*(?P<plain>plaintext-key\s\S+)*
\s*(?P<type>type\s\S+)*
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": _tmplt_snmp_server_v3_trap_target,
"result": {
"snmp_v3": {
@@ -330,11 +345,11 @@ class Snmp_serverTemplate(NetworkTemplate):
"encrypted_key": '{{ enc.split(" ")[1] if enc is defined else None }}',
"plaintext_key": '{{ plain.split(" ")[1] if plain is defined else None }}',
"type": '{{ type.split(" ")[1] if type is defined else None }}',
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
},
# service snmp v3 trap-target <> port <>
{
@@ -345,18 +360,19 @@ class Snmp_serverTemplate(NetworkTemplate):
\s+(?P<name>\S+)
\s+(?P<port>port\s\d+)*
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "service snmp v3 trap-target port {{ snmp_v3.trap_targets.port }}",
"result": {
"snmp_v3": {
"trap_targets": {
"{{ name }}": {
"address": "{{ name }}",
- "port": "{{ port }}"
- }
- }
- }
- }
+ "port": "{{ port }}",
+ },
+ },
+ },
+ },
},
# service snmp v3 trap-target <> protocol <>
{
@@ -367,18 +383,19 @@ class Snmp_serverTemplate(NetworkTemplate):
\s+(?P<name>\S+)
\s+(?P<protocol>protocol\s\S+)*
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "service snmp v3 trap-target protocol {{ snmp_v3.trap_targets.protocol }}",
"result": {
"snmp_v3": {
"trap_targets": {
"{{ name }}": {
"address": "{{ name }}",
- "protocol": "{{ protocol }}"
- }
- }
- }
- }
+ "protocol": "{{ protocol }}",
+ },
+ },
+ },
+ },
},
# service snmp v3 trap-target <> type <>
{
@@ -389,18 +406,19 @@ class Snmp_serverTemplate(NetworkTemplate):
\s+(?P<name>\S+)
\s+(?P<type>type\s\S+)*
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "service snmp v3 trap-target type {{ snmp_v3.trap_targets.type }}",
"result": {
"snmp_v3": {
"trap_targets": {
"{{ name }}": {
"address": "{{ name }}",
- "type": "{{ type }}"
- }
- }
- }
- }
+ "type": "{{ type }}",
+ },
+ },
+ },
+ },
},
# service snmp v3 trap-target <> user <>
{
@@ -411,18 +429,19 @@ class Snmp_serverTemplate(NetworkTemplate):
\s+(?P<name>\S+)
\s+(?P<user>user\s\S+)*
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "service snmp v3 trap-target user {{ snmp_v3.trap_targets.user }}",
"result": {
"snmp_v3": {
"trap_targets": {
"{{ name }}": {
"address": "{{ name }}",
- "user": "{{ user }}"
- }
- }
- }
- }
+ "user": "{{ user }}",
+ },
+ },
+ },
+ },
},
# service snmp v3 trap-target <> privacy <>
{
@@ -436,7 +455,8 @@ class Snmp_serverTemplate(NetworkTemplate):
\s*(?P<plain>plaintext-key\s\S+)*
\s*(?P<type>type\s\S+)*
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": _tmplt_snmp_server_v3_trap_target,
"result": {
"snmp_v3": {
@@ -447,11 +467,11 @@ class Snmp_serverTemplate(NetworkTemplate):
"encrypted_key": '{{ enc.split(" ")[1] if enc is defined else None }}',
"plaintext_key": '{{ plain.split(" ")[1] if plain is defined else None }}',
"type": '{{ type.split(" ")[1] if type is defined else None }}',
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
},
# service snmp v3 user <> auth <>
{
@@ -465,7 +485,8 @@ class Snmp_serverTemplate(NetworkTemplate):
\s*(?P<plain>plaintext-key\s\S+)*
\s*(?P<type>type\s\S+)*
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": _tmplt_snmp_server_v3_user,
"result": {
"snmp_v3": {
@@ -476,11 +497,11 @@ class Snmp_serverTemplate(NetworkTemplate):
"encrypted_key": '{{ enc.split(" ")[1] if enc is defined else None }}',
"plaintext_key": '{{ plain.split(" ")[1] if plain is defined else None }}',
"type": '{{ type.split(" ")[1] if type is defined else None }}',
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
},
# service snmp v3 user <> privacy <>
{
@@ -494,7 +515,8 @@ class Snmp_serverTemplate(NetworkTemplate):
\s*(?P<plain>plaintext-key\s\S+)*
\s*(?P<type>type\s\S+)*
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": _tmplt_snmp_server_v3_user,
"result": {
"snmp_v3": {
@@ -505,11 +527,11 @@ class Snmp_serverTemplate(NetworkTemplate):
"encrypted_key": '{{ enc.split(" ")[1] if enc is defined else None }}',
"plaintext_key": '{{ plain.split(" ")[1] if plain is defined else None }}',
"type": '{{ type.split(" ")[1] if type is defined else None }}',
- }
- }
- }
- }
- }
+ },
+ },
+ },
+ },
+ },
},
# service snmp v3 user <> group <>
{
@@ -520,18 +542,19 @@ class Snmp_serverTemplate(NetworkTemplate):
\s+(?P<name>\S+)
\s+(?P<group>group\s.+)*
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "service snmp v3 user {{ snmp_v3.users.user }} group {{ snmp_v3.users.group }}",
"result": {
"snmp_v3": {
"users": {
"{{ name }}": {
"user": "{{ name }}",
- "group": "{{ group.split(" ")[1] if group is defined else None }}"
- }
- }
- }
- }
+ "group": "{{ group.split(" ")[1] if group is defined else None }}",
+ },
+ },
+ },
+ },
},
# service snmp v3 user <> mode <>
{
@@ -542,18 +565,19 @@ class Snmp_serverTemplate(NetworkTemplate):
\s+(?P<name>\S+)
\s+(?P<mode>mode\s\S+)*
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": "service snmp v3 user {{ snmp_v3.users.user }} mode {{ snmp_v3.users.mode }}",
"result": {
"snmp_v3": {
"users": {
"{{ name }}": {
"user": "{{ name }}",
- "mode": "{{ mode }}"
- }
- }
- }
- }
+ "mode": "{{ mode }}",
+ },
+ },
+ },
+ },
},
# service snmp v3 view <>
{
@@ -566,7 +590,8 @@ class Snmp_serverTemplate(NetworkTemplate):
\s*(?P<ex>exclude\s\S+)*
\s*(?P<mask>mask\s\S+)*
$""",
- re.VERBOSE),
+ re.VERBOSE,
+ ),
"setval": _tmplt_snmp_server_v3_views,
"result": {
"snmp_v3": {
@@ -576,10 +601,10 @@ class Snmp_serverTemplate(NetworkTemplate):
"oid": '{{ oid.split(" ")[1] if oid is defined else None }}',
"exclude": '{{ ex.split(" ")[1] if ex is defined else None }}',
"mask": '{{ mask.split(" ")[1] if mask is defined else None }}',
- }
- }
- }
- }
+ },
+ },
+ },
+ },
},
]
# fmt: on
diff --git a/plugins/module_utils/network/vyos/utils/utils.py b/plugins/module_utils/network/vyos/utils/utils.py
index d2ca703..8722251 100644
--- a/plugins/module_utils/network/vyos/utils/utils.py
+++ b/plugins/module_utils/network/vyos/utils/utils.py
@@ -6,10 +6,12 @@
# utils
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from ansible.module_utils.basic import missing_required_lib
from ansible.module_utils.six import iteritems
+
try:
import ipaddress
diff --git a/plugins/module_utils/network/vyos/vyos.py b/plugins/module_utils/network/vyos/vyos.py
index da364f9..4fcb331 100644
--- a/plugins/module_utils/network/vyos/vyos.py
+++ b/plugins/module_utils/network/vyos/vyos.py
@@ -27,12 +27,14 @@
#
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
import json
from ansible.module_utils._text import to_text
from ansible.module_utils.connection import Connection, ConnectionError
+
_DEVICE_CONFIGS = {}