summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/nxos/plugins/module_utils
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:22:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:22:15 +0000
commit0202b47f95a87598276869ab7f07f57e8a4c8a87 (patch)
tree21f101dcceb98166b117c40dab3d79d5b2ad8eed /ansible_collections/cisco/nxos/plugins/module_utils
parentAdding upstream version 10.0.1+dfsg. (diff)
downloadansible-upstream.tar.xz
ansible-upstream.zip
Adding upstream version 10.1.0+dfsg.upstream/10.1.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/cisco/nxos/plugins/module_utils')
-rw-r--r--ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/acls/acls.py12
-rw-r--r--ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/l3_interfaces/l3_interfaces.py4
-rw-r--r--ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/route_maps/route_maps.py1
-rw-r--r--ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/facts/static_routes/static_routes.py30
-rw-r--r--ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/rm_templates/static_routes.py14
5 files changed, 42 insertions, 19 deletions
diff --git a/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/acls/acls.py b/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/acls/acls.py
index 5e6f3c34a..a62489b28 100644
--- a/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/acls/acls.py
+++ b/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/acls/acls.py
@@ -246,13 +246,13 @@ class Acls(ConfigBase):
end = int(ace[x]["port_protocol"]["range"]["end"])
if st in port_protocol.keys():
- ace[x]["port_protocol"]["range"][
- "start"
- ] = port_protocol[st]
+ ace[x]["port_protocol"]["range"]["start"] = (
+ port_protocol[st]
+ )
if end in port_protocol.keys():
- ace[x]["port_protocol"]["range"][
- "end"
- ] = port_protocol[end]
+ ace[x]["port_protocol"]["range"]["end"] = (
+ port_protocol[end]
+ )
return want
def set_state(self, want, have):
diff --git a/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/l3_interfaces/l3_interfaces.py b/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/l3_interfaces/l3_interfaces.py
index d4da881f5..e9aa2ee02 100644
--- a/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/l3_interfaces/l3_interfaces.py
+++ b/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/l3_interfaces/l3_interfaces.py
@@ -46,6 +46,8 @@ class L3_interfaces(ConfigBase):
exclude_params = []
+ err_responses = [r"encap in use by another sub-interface"]
+
def __init__(self, module):
super(L3_interfaces, self).__init__(module)
@@ -70,7 +72,7 @@ class L3_interfaces(ConfigBase):
return l3_interfaces_facts
def edit_config(self, commands):
- return self._connection.edit_config(commands)
+ return self._connection.edit_config(candidate=commands, err_responses=self.err_responses)
def execute_module(self):
"""Execute the module
diff --git a/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/route_maps/route_maps.py b/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/route_maps/route_maps.py
index fa7d57b1b..77f8f02be 100644
--- a/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/route_maps/route_maps.py
+++ b/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/config/route_maps/route_maps.py
@@ -47,6 +47,7 @@ class Route_maps(ResourceModule):
tmplt=Route_mapsTemplate(),
)
self.linear_parsers = [
+ "route_map",
"description",
"continue_sequence",
"set.as_path.prepend.last_as",
diff --git a/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/facts/static_routes/static_routes.py b/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/facts/static_routes/static_routes.py
index 991b552ff..51f805f2d 100644
--- a/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/facts/static_routes/static_routes.py
+++ b/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/facts/static_routes/static_routes.py
@@ -10,6 +10,7 @@ It is in this file the configuration is collected from the device
for a given resource, parsed, and the facts tree is populated
based on the configuration.
"""
+
from __future__ import absolute_import, division, print_function
@@ -28,7 +29,7 @@ from ansible_collections.cisco.nxos.plugins.module_utils.network.nxos.rm_templat
class Static_routesFacts(object):
"""The nxos static_routes fact class"""
- def __init__(self, module, subspec="config", options="options"):
+ def __init__(self, module):
self._module = module
self.argument_spec = Static_routesArgs.argument_spec
@@ -84,9 +85,13 @@ class Static_routesFacts(object):
_triv_static_route = {"address_families": []}
if afi_v4:
- _triv_static_route["address_families"].append({"afi": "ipv4", "routes": afi_v4})
+ _triv_static_route["address_families"].append(
+ {"afi": "ipv4", "routes": afi_v4},
+ )
if afi_v6:
- _triv_static_route["address_families"].append({"afi": "ipv6", "routes": afi_v6})
+ _triv_static_route["address_families"].append(
+ {"afi": "ipv6", "routes": afi_v6},
+ )
_static_route_facts.append(_triv_static_route)
@@ -100,9 +105,13 @@ class Static_routesFacts(object):
}
if afi_v4:
- _vrf_static_route["address_families"].append({"afi": "ipv4", "routes": afi_v4})
+ _vrf_static_route["address_families"].append(
+ {"afi": "ipv4", "routes": afi_v4},
+ )
if afi_v6:
- _vrf_static_route["address_families"].append({"afi": "ipv6", "routes": afi_v6})
+ _vrf_static_route["address_families"].append(
+ {"afi": "ipv6", "routes": afi_v6},
+ )
_static_route_facts.append(_vrf_static_route)
return _static_route_facts
@@ -125,7 +134,10 @@ class Static_routesFacts(object):
data = self.get_static_routes_data(connection)
# parse native config using the Static_routes template
- static_routes_parser = Static_routesTemplate(lines=data.splitlines(), module=self._module)
+ static_routes_parser = Static_routesTemplate(
+ lines=data.splitlines(),
+ module=self._module,
+ )
objs = static_routes_parser.parse()
strout = self.process_static_routes(objs)
@@ -134,7 +146,11 @@ class Static_routesFacts(object):
ansible_facts["ansible_network_resources"].pop("static_routes", None)
params = utils.remove_empties(
- static_routes_parser.validate_config(self.argument_spec, {"config": objs}, redact=True),
+ static_routes_parser.validate_config(
+ self.argument_spec,
+ {"config": objs},
+ redact=True,
+ ),
)
facts["static_routes"] = params.get("config")
diff --git a/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/rm_templates/static_routes.py b/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/rm_templates/static_routes.py
index a70bc4130..65a72a390 100644
--- a/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/rm_templates/static_routes.py
+++ b/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/rm_templates/static_routes.py
@@ -24,7 +24,11 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.r
class Static_routesTemplate(NetworkTemplate):
def __init__(self, lines=None, module=None):
- super(Static_routesTemplate, self).__init__(lines=lines, tmplt=self, module=module)
+ super(Static_routesTemplate, self).__init__(
+ lines=lines,
+ tmplt=self,
+ module=module,
+ )
# fmt: off
PARSERS = [
@@ -49,9 +53,9 @@ class Static_routesTemplate(NetworkTemplate):
(\s(?P<interface>(Ethernet|loopback|mgmt|Null|port-channel)\S+))?
(\s(?P<forward_router_address>\S+))?
(\svrf\s(?P<dest_vrf>\S+))?
+ (\strack\s(?P<track>\d+))?
(\sname\s(?P<route_name>\S+))?
(\stag\s(?P<tag>\d+))?
- (\strack\s(?P<track>\d+))?
(\s(?P<admin_distance>\d+))?
$""", re.VERBOSE,
),
@@ -60,9 +64,9 @@ class Static_routesTemplate(NetworkTemplate):
"{{ (' ' + ipv4.interface) if ipv4.interface is defined else '' }}"
"{{ (' ' + ipv4.forward_router_address) if ipv4.forward_router_address is defined else '' }}"
"{{ (' vrf ' + ipv4.dest_vrf) if ipv4.dest_vrf is defined else '' }}"
+ "{{ (' track ' + ipv4.track|string) if ipv4.track is defined else '' }}"
"{{ (' name ' + ipv4.route_name) if ipv4.route_name is defined else '' }}"
"{{ (' tag ' + ipv4.tag|string) if ipv4.tag is defined else '' }}"
- "{{ (' track ' + ipv4.track|string) if ipv4.track is defined else '' }}"
"{{ (' ' + ipv4.admin_distance|string) if ipv4.admin_distance is defined else '' }}",
"result": {
"{{ dest }}_{{ namevrf|d() }}_ipv4": [
@@ -90,9 +94,9 @@ class Static_routesTemplate(NetworkTemplate):
(\s(?P<interface>(Ethernet|loopback|mgmt|Null|port-channel)\S+))?
(\s(?P<forward_router_address>\S+))?
(\svrf\s(?P<dest_vrf>\S+))?
+ (\strack\s(?P<track>\d+))?
(\sname\s(?P<route_name>\S+))?
(\stag\s(?P<tag>\d+))?
- (\strack\s(?P<track>\d+))?
(\s(?P<admin_distance>\d+))?
$""", re.VERBOSE,
),
@@ -101,9 +105,9 @@ class Static_routesTemplate(NetworkTemplate):
"{{ (' ' + ipv6.interface) if ipv6.interface is defined else '' }}"
"{{ (' ' + ipv6.forward_router_address) if ipv6.forward_router_address is defined else '' }}"
"{{ (' vrf ' + ipv6.dest_vrf) if ipv6.dest_vrf is defined else '' }}"
+ "{{ (' track ' + ipv6.track|string) if ipv6.track is defined else '' }}"
"{{ (' name ' + ipv6.route_name) if ipv6.route_name is defined else '' }}"
"{{ (' tag ' + ipv6.tag|string) if ipv6.tag is defined else '' }}"
- "{{ (' track ' + ipv6.track|string) if ipv6.track is defined else '' }}"
"{{ (' ' + ipv6.admin_distance|string) if ipv6.admin_distance is defined else '' }}",
"result": {
"{{ dest }}_{{ namevrf|d() }}_ipv6": [