cisco.nxos.nxos_route_maps module – Route Maps resource module.
Note
This module is part of the cisco.nxos collection (version 5.3.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install cisco.nxos
.
To use it in a playbook, specify: cisco.nxos.nxos_route_maps
.
New in cisco.nxos 2.2.0
Synopsis
This module manages route maps configuration on devices running Cisco NX-OS.
Note
This module has a corresponding action plugin.
Parameters
Parameter |
Comments |
---|---|
A list of route-map configuration. |
|
List of entries (identified by sequence number) for this route-map. |
|
Route map denies or permits set operations. Choices:
|
|
Continue on a different entry within the route-map. |
|
Description of the route-map. |
|
Match values from routing table. |
|
Match BGP peer AS number. |
|
AS path access list name. |
|
AS number. |
|
Match BGP AS path access-list. |
|
Match BGP community list. |
|
Community list. |
|
Do exact matching of communities. Choices:
|
|
Match BGP EVPN Routes. |
|
Match route type for evpn route. |
|
Match BGP community list. |
|
Do exact matching of extended communities. Choices:
|
|
Extended Community list. |
|
Match first hop interface of route. |
|
Configure IP specific information. |
|
Match address of route or match packet. |
|
IP access-list name (for use in route-maps for PBR only). |
|
Match entries of prefix-lists. |
|
Match multicast attributes. |
|
Multicast Group prefix. Mutually exclusive with group_range. |
|
IPv4 group prefix. |
|
Multicast Group address range. Mutually exclusive with group. |
|
First Group address. |
|
Last Group address. |
|
Rendezvous point. |
|
IPv4 rendezvous prefix. |
|
Multicast rendezvous point type. Choices:
|
|
Multicast source address. |
|
Match next-hop address of route. |
|
Match entries of prefix-lists. |
|
Match advertising source address of route. |
|
Match entries of prefix-lists. |
|
Configure IPv6 specific information. |
|
Match address of route or match packet. |
|
IP access-list name (for use in route-maps for PBR only). |
|
Match entries of prefix-lists. |
|
Match multicast attributes. |
|
Multicast Group prefix. Mutually exclusive with group_range. |
|
IPv4 group prefix. |
|
Multicast Group address range. Mutually exclusive with group. |
|
First Group address. |
|
Last Group address. |
|
Rendezvous point. |
|
IPv4 rendezvous prefix. |
|
Multicast rendezvous point type. Choices:
|
|
Multicast source address. |
|
Match next-hop address of route. |
|
Match entries of prefix-lists. |
|
Match advertising source address of route. |
|
Match entries of prefix-lists. |
|
Match entries of mac-lists. |
|
Match metric of route. |
|
Match ospf area. |
|
Match route-type of route. Choices:
|
|
Match source protocol. |
|
Match tag of route. |
|
Sequence to insert to/delete from existing route-map entry. |
|
Set values in destination routing protocol. |
|
Prepend string for a BGP AS-path attribute. |
|
Prepend to the AS-Path. |
|
AS number. |
|
Number of last-AS prepends. |
|
Set the tag as an AS-path attribute. Choices:
|
|
Set BGP community list (for deletion). |
|
Set BGP community attribute. |
|
Add to existing community. Choices:
|
|
Graceful Shutdown (well-known community). Choices:
|
|
Internet (well-known community). Choices:
|
|
Do not send outside local AS (well-known community). Choices:
|
|
Do not advertise to any peer (well-known community). Choices:
|
|
Do not export to next AS (well-known community). Choices:
|
|
Community number aa:nn format |
|
Set BGP route flap dampening parameters. |
|
Half-life time for the penalty. |
|
Maximum suppress time for stable route. |
|
Value to start reusing a route. |
|
Value to start suppressing a route. |
|
Configure administrative distance. |
|
Administrative distance for IGP or EBGP routes |
|
Distance for internal routes. |
|
Distance for local routes. |
|
Set BGP EVPN Routes. |
|
Set gateway IP for type 5 EVPN routes. Cannot set ip and use-nexthop in the same route-map sequence. |
|
Gateway IP address. |
|
Use nexthop address as gateway IP. Choices:
|
|
Set BGP extcommunity list (for deletion). |
|
Set BGP extcommunity attribute. |
|
Route-Target. |
|
Add to existing rt extcommunity. Choices:
|
|
Extcommunity number. Supported formats are ASN2:NN, ASN4:NN, IPV4:NN. |
|
Set the forwarding address. Choices:
|
|
Configure IP features. |
|
Specify IP address. |
|
Name of prefix list (Max Size 63). |
|
Set next-hop IP address (for policy-based routing) |
|
Set space-separated list of next-hop IP addresses. Address ordering is important. Also don`t use unnecessary spaces. |
|
Drop packets instead of using default routing when the configured next hop becomes unreachable Choices:
|
|
Enable next-hop ordering as specified in the address parameter. Choices:
|
|
Enable traffic load balancing across a maximum of 32 next-hop addresses Choices:
|
|
BGP prefix next hop is set to the local address of the peer. If no next hop is set in the route map, the next hop is set to the one stored in the path. Choices:
|
|
Set for next-hop address conservation for non-local generated routes. Used with redistribute command. Available to maintain BGP routing compliant with RFC 4271 on Nexus OS. Choices:
|
|
Set for next-hop address conservation in eBGP outgoing updates Choices:
|
|
Set next-hop ip address tracking with IP SLA |
|
Set one next-hop address |
|
Drop packets instead of using default routing when the configured next hop becomes unreachable Choices:
|
|
Enable next-hop ordering as specified in the address parameter. Choices:
|
|
Enable traffic load balancing across a maximum of 32 next-hop addresses Choices:
|
|
Set track number |
|
Set precedence field. |
|
Configure IPv6 features. |
|
Specify IP address. |
|
Name of prefix list (Max Size 63). |
|
Set precedence field. |
|
Set Segment Routing (SR) label index of route. |
|
Where to import route. Choices:
|
|
BGP local preference path attribute. |
|
Set metric for destination routing protocol. |
|
Metric value or Bandwidth in Kbits per second (Max Size 11). |
|
IGRP delay metric. |
|
IGRP Effective bandwidth metric (Loading) 255 is 100%. |
|
IGRP MTU of the path. |
|
IGRP reliability metric where 255 is 100 percent reliable. |
|
Type of metric for destination routing protocol. Choices:
|
|
OSPF NSSA Areas. Choices:
|
|
Output Null interface. |
|
BGP origin code. Choices:
|
|
Path selection criteria for BGP. Choices:
|
|
Tag value for destination routing protocol. |
|
BGP weight for routing table. |
|
Route-map name. |
|
This option is used only with state parsed. The value of this option should be the output received from the NX-OS device by executing the command show running-config | section ‘^route-map’. The state parsed reads the configuration from |
|
The state the configuration should be left in. With state replaced, for the listed route-maps, sequences that are in running-config but not in the task are negated. With state overridden, all route-maps that are in running-config but not in the task are negated. Please refer to examples for more details. Choices:
|
Notes
Note
Tested against NX-OS 9.3.6.
Unsupported for Cisco MDS
This module works with connection
network_cli
andhttpapi
.
Examples
# Using merged
# Before state:
# -------------
# nxos-9k-rdo# show running-config | section "^route-map"
# nxos-9k-rdo#
- name: Merge the provided configuration with the existing running configuration
cisco.nxos.nxos_route_maps:
config:
- route_map: rmap1
entries:
- sequence: 10
action: permit
description: rmap1-10-permit
match:
ip:
address:
access_list: acl_1
as_path: Allow40
as_number:
asn: 65564
- sequence: 20
action: deny
description: rmap1-20-deny
match:
community:
community_list:
- BGPCommunity1
- BGPCommunity2
ip:
address:
prefix_lists:
- AllowPrefix1
- AllowPrefix2
set:
dampening:
half_life: 30
start_reuse_route: 1500
start_suppress_route: 10000
max_suppress_time: 120
- route_map: rmap2
entries:
- sequence: 20
action: permit
description: rmap2-20-permit
continue_sequence: 40
match:
ipv6:
address:
prefix_lists: AllowIPv6Prefix
interfaces: "{{ nxos_int1 }}"
set:
as_path:
prepend:
as_number:
- 65563
- 65568
- 65569
comm_list: BGPCommunity
- sequence: 40
action: deny
description: rmap2-40-deny
match:
route_types:
- level-1
- level-2
tags: 2
ip:
multicast:
rp:
prefix: 192.0.2.0/24
rp_type: ASM
source: 203.0.113.0/24
group_range:
first: 239.0.0.1
last: 239.255.255.255
- route_map: rmap3
entries:
- sequence: 10
description: "*** first stanza ***"
action: permit
set:
ip:
next_hop:
verify_availability:
- address: 3.3.3.3
track: 1
- address: 4.4.4.4
track: 3
- sequence: 20
description: "*** second stanza ***"
action: permit
set:
ip:
next_hop:
address: 6.6.6.6 2.2.2.2
load_share: true
drop_on_fail: true
- sequence: 30
description: "*** third stanza ***"
action: permit
set:
ip:
next_hop:
peer_address: true
- sequence: 40
description: "*** fourth stanza ***"
action: permit
set:
ip:
next_hop:
unchanged: true
redist_unchanged: true
state: merged
# Task output
# -------------
# before: []
#
# commands:
# - "route-map rmap1 permit 10"
# - "match as-number 65564"
# - "match as-path Allow40"
# - "match ip address acl_1"
# - "description rmap1-10-permit"
# - "route-map rmap1 deny 20"
# - "match community BGPCommunity1 BGPCommunity2"
# - "match ip address prefix-list AllowPrefix1 AllowPrefix2"
# - "description rmap1-20-deny"
# - "set dampening 30 1500 10000 120"
# - "route-map rmap2 permit 20"
# - "match interface Ethernet1/1"
# - "match ipv6 address prefix-list AllowIPv6Prefix"
# - "set as-path prepend 65563 65568 65569"
# - "description rmap2-20-permit"
# - "continue 40"
# - "set comm-list BGPCommunity delete"
# - "route-map rmap2 deny 40"
# - "match ip multicast source 203.0.113.0/24 group-range 239.0.0.1 to 239.255.255.255 rp 192.0.2.0/24 rp-type ASM"
# - "match route-type level-1 level-2"
# - "match tag 2"
# - "description rmap2-40-deny"
# - "route-map rmap3 permit 10"
# - "description *** first stanza ***"
# - "set ip next-hop verify-availability 3.3.3.3 track 1"
# - "set ip next-hop verify-availability 4.4.4.4 track 3"
# - "route-map rmap3 permit 20"
# - "description *** second stanza ***"
# - "set ip next-hop 6.6.6.6 2.2.2.2 load-share drop-on-fail"
# - "route-map rmap3 permit 30"
# - "description *** third stanza ***"
# - "set ip next-hop peer-address"
# - "route-map rmap3 permit 40"
# - "description *** fourth stanza ***"
# - "set ip next-hop unchanged"
# - "set ip next-hop redist-unchanged"
#
# after:
# - route_map: rmap1
# entries:
# - action: permit
# description: rmap1-10-permit
# match:
# as_number:
# asn:
# - '65564'
# as_path:
# - Allow40
# ip:
# address:
# access_list: acl_1
# sequence: 10
#
# - action: deny
# description: rmap1-20-deny
# match:
# community:
# community_list:
# - BGPCommunity1
# - BGPCommunity2
# ip:
# address:
# prefix_lists:
# - AllowPrefix1
# - AllowPrefix2
# sequence: 20
# set:
# dampening:
# half_life: 30
# max_suppress_time: 120
# start_reuse_route: 1500
# start_suppress_route: 10000
#
# - route_map: rmap2
# entries:
# - action: permit
# continue_sequence: 40
# description: rmap2-20-permit
# match:
# interfaces:
# - Ethernet1/1
# ipv6:
# address:
# prefix_lists:
# - AllowIPv6Prefix
# sequence: 20
# set:
# as_path:
# prepend:
# as_number:
# - '65563'
# - '65568'
# - '65569'
# comm_list: BGPCommunity
#
# - action: deny
# description: rmap2-40-deny
# match:
# ip:
# multicast:
# group_range:
# first: 239.0.0.1
# last: 239.255.255.255
# rp:
# prefix: 192.0.2.0/24
# rp_type: ASM
# source: 203.0.113.0/24
# route_types:
# - level-1
# - level-2
# tags:
# - 2
# sequence: 40
#
# - route_map: rmap3
# entries:
# - sequence: 10
# description: "*** first stanza ***"
# action: permit
# set:
# ip:
# next_hop:
# verify_availability:
# - address: 3.3.3.3
# track: 1
# - address: 4.4.4.4
# track: 3
#
# - sequence: 20
# description: "*** second stanza ***"
# action: permit
# set:
# ip:
# next_hop:
# address: 6.6.6.6 2.2.2.2
# load_share: true
# drop_on_fail: true
#
# - sequence: 30
# description: "*** third stanza ***"
# action: permit
# set:
# ip:
# next_hop:
# peer_address: true
#
# - sequence: 40
# description: "*** fourth stanza ***"
# action: permit
# set:
# ip:
# next_hop:
# unchanged: true
# redist_unchanged: true
# After state:
# ------------
# nxos-9k-rdo# show running-config | section "^route-map"
# route-map rmap1 permit 10
# match as-number 65564
# match as-path Allow40
# match ip address acl_1
# description rmap1-10-permit
# route-map rmap1 deny 20
# match community BGPCommunity1 BGPCommunity2
# match ip address prefix-list AllowPrefix1 AllowPrefix2
# description rmap1-20-deny
# set dampening 30 1500 10000 120
# route-map rmap2 permit 20
# match interface Ethernet1/1
# match ipv6 address prefix-list AllowIPv6Prefix
# set as-path prepend 65563 65568 65569
# description rmap2-20-permit
# continue 40
# set comm-list BGPCommunity delete
# route-map rmap2 deny 40
# match ip multicast source 203.0.113.0/24 group-range 239.0.0.1 to 239.255.255.255 rp 192.0.2.0/24 rp-type ASM
# match route-type level-1 level-2
# match tag 2
# description rmap2-40-deny
# route-map rmap3 permit 10
# description *** first stanza ***
# set ip next-hop verify-availability 3.3.3.3 track 1
# set ip next-hop verify-availability 4.4.4.4 track 3
# route-map rmap3 permit 20
# description *** second stanza ***
# set ip next-hop 6.6.6.6 2.2.2.2 load-share drop-on-fail
# route-map rmap3 permit 30
# description *** third stanza ***
# set ip next-hop peer-address
# route-map rmap3 permit 40
# description *** fourth stanza ***
# set ip next-hop unchanged
# set ip next-hop redist-unchanged
#
# Using replaced
# (for the listed route-map(s), sequences that are in running-config but not in the task are negated)
# Before state:
# ------------
# nxos-9k-rdo# show running-config | section "^route-map"
# route-map rmap1 permit 10
# match as-number 65564
# match as-path Allow40
# match ip address acl_1
# description rmap1-10-permit
# route-map rmap1 deny 20
# match community BGPCommunity1 BGPCommunity2
# match ip address prefix-list AllowPrefix1 AllowPrefix2
# description rmap1-20-deny
# set dampening 30 1500 10000 120
# route-map rmap2 permit 20
# match interface Ethernet1/1
# match ipv6 address prefix-list AllowIPv6Prefix
# set as-path prepend 65563 65568 65569
# description rmap2-20-permit
# continue 40
# set comm-list BGPCommunity delete
# route-map rmap2 deny 40
# match ip multicast source 203.0.113.0/24 group-range 239.0.0.1 to 239.255.255.255 rp 192.0.2.0/24 rp-type ASM
# match route-type level-1 level-2
# match tag 2
# description rmap2-40-deny
# route-map rmap3 permit 10
# description *** first stanza ***
# set ip next-hop verify-availability 3.3.3.3 track 1
# set ip next-hop verify-availability 4.4.4.4 track 3
# route-map rmap3 permit 20
# description *** second stanza ***
# set ip next-hop 6.6.6.6 2.2.2.2 load-share drop-on-fail
# route-map rmap3 permit 30
# description *** third stanza ***
# set ip next-hop peer-address
# route-map rmap3 permit 40
# description *** fourth stanza ***
# set ip next-hop unchanged
# set ip next-hop redist-unchanged
#
- name: Replace route-maps configurations of listed route-maps with provided configurations
cisco.nxos.nxos_route_maps:
config:
- route_map: rmap1
entries:
- sequence: 20
action: deny
description: rmap1-20-deny
match:
community:
community_list:
- BGPCommunity4
- BGPCommunity5
ip:
address:
prefix_lists:
- AllowPrefix1
set:
community:
local_as: True
- route_map: rmap3
entries:
- sequence: 10
description: "*** first stanza ***"
action: permit
set:
ip:
next_hop:
verify_availability:
- address: 3.3.3.3
track: 1
- sequence: 20
description: "*** second stanza ***"
action: permit
set:
ip:
next_hop:
peer_address: true
- sequence: 30
description: "*** third stanza ***"
action: permit
set:
ip:
next_hop:
address: 6.6.6.6 2.2.2.2
load_share: true
drop_on_fail: true
state: replaced
# Task output
# -------------
# before:
# - route_map: rmap1
# entries:
# - action: permit
# description: rmap1-10-permit
# match:
# as_number:
# asn:
# - '65564'
# as_path:
# - Allow40
# ip:
# address:
# access_list: acl_1
# sequence: 10
#
# - action: deny
# description: rmap1-20-deny
# match:
# community:
# community_list:
# - BGPCommunity1
# - BGPCommunity2
# ip:
# address:
# prefix_lists:
# - AllowPrefix1
# - AllowPrefix2
# sequence: 20
# set:
# dampening:
# half_life: 30
# max_suppress_time: 120
# start_reuse_route: 1500
# start_suppress_route: 10000
#
# - route_map: rmap2
# entries:
# - action: permit
# continue_sequence: 40
# description: rmap2-20-permit
# match:
# interfaces:
# - Ethernet1/1
# ipv6:
# address:
# prefix_lists:
# - AllowIPv6Prefix
# sequence: 20
# set:
# as_path:
# prepend:
# as_number:
# - '65563'
# - '65568'
# - '65569'
# comm_list: BGPCommunity
#
# - action: deny
# description: rmap2-40-deny
# match:
# ip:
# multicast:
# group_range:
# first: 239.0.0.1
# last: 239.255.255.255
# rp:
# prefix: 192.0.2.0/24
# rp_type: ASM
# source: 203.0.113.0/24
# route_types:
# - level-1
# - level-2
# tags:
# - 2
# sequence: 40
#
# - route_map: rmap3
# entries:
# - sequence: 10
# description: "*** first stanza ***"
# action: permit
# set:
# ip:
# next_hop:
# verify_availability:
# - address: 3.3.3.3
# track: 1
# - address: 4.4.4.4
# track: 3
#
# - sequence: 20
# description: "*** second stanza ***"
# action: permit
# set:
# ip:
# next_hop:
# address: 6.6.6.6 2.2.2.2
# load_share: true
# drop_on_fail: true
#
# - sequence: 30
# description: "*** third stanza ***"
# action: permit
# set:
# ip:
# next_hop:
# peer_address: true
#
# - sequence: 40
# description: "*** fourth stanza ***"
# action: permit
# set:
# ip:
# next_hop:
# unchanged: true
# redist_unchanged: true
#
# commands:
# - no route-map rmap1 permit 10
# - route-map rmap1 deny 20
# - no match community BGPCommunity1 BGPCommunity2
# - match community BGPCommunity4 BGPCommunity5
# - no match ip address prefix-list AllowPrefix1 AllowPrefix2
# - match ip address prefix-list AllowPrefix1
# - no set dampening 30 1500 10000 120
# - set community local-AS
# - route-map rmap3 permit 10
# - no set ip next-hop verify-availability 4.4.4.4 track 3
# - route-map rmap3 permit 20
# - no set ip next-hop 6.6.6.6 2.2.2.2 load-share drop-on-fail
# - set ip next-hop peer-address
# - route-map rmap3 permit 30
# - no set ip next-hop peer-address
# - set ip next-hop 6.6.6.6 2.2.2.2 load-share drop-on-fail
# - no route-map rmap3 permit 40
#
# after:
# - route_map: rmap1
# entries:
# - sequence: 20
# action: deny
# description: rmap1-20-deny
# match:
# community:
# community_list:
# - BGPCommunity4
# - BGPCommunity5
# ip:
# address:
# prefix_lists:
# - AllowPrefix1
# set:
# community:
# local_as: True
#
# - route_map: rmap2
# entries:
# - action: permit
# continue_sequence: 40
# description: rmap2-20-permit
# match:
# interfaces:
# - Ethernet1/1
# ipv6:
# address:
# prefix_lists:
# - AllowIPv6Prefix
# sequence: 20
# set:
# as_path:
# prepend:
# as_number:
# - '65563'
# - '65568'
# - '65569'
# comm_list: BGPCommunity
#
# - action: deny
# description: rmap2-40-deny
# match:
# ip:
# multicast:
# group_range:
# first: 239.0.0.1
# last: 239.255.255.255
# rp:
# prefix: 192.0.2.0/24
# rp_type: ASM
# source: 203.0.113.0/24
# route_types:
# - level-1
# - level-2
# tags:
# - 2
# sequence: 40
#
# - route_map: rmap3
# entries:
# - sequence: 10
# description: "*** first stanza ***"
# action: permit
# set:
# ip:
# next_hop:
# verify_availability:
# - address: 3.3.3.3
# track: 1
# - sequence: 20
# description: "*** second stanza ***"
# action: permit
# set:
# ip:
# next_hop:
# peer_address: true
# - sequence: 30
# description: "*** third stanza ***"
# action: permit
# set:
# ip:
# next_hop:
# address: 6.6.6.6 2.2.2.2
# load_share: true
# drop_on_fail: true
# After state:
# ------------
# nxos-9k-rdo# show running-config | section "^route-map"
# route-map rmap1 deny 20
# description rmap1-20-deny
# match community BGPCommunity4 BGPCommunity5
# match ip address prefix-list AllowPrefix1
# set community local-AS
# route-map rmap2 permit 20
# match interface Ethernet1/1
# match ipv6 address prefix-list AllowIPv6Prefix
# set as-path prepend 65563 65568 65569
# description rmap2-20-permit
# continue 40
# set comm-list BGPCommunity delete
# route-map rmap2 deny 40
# match ip multicast source 203.0.113.0/24 group-range 239.0.0.1 to 239.255.255.255 rp 192.0.2.0/24 rp-type ASM
# match route-type level-1 level-2
# match tag 2
# description rmap2-40-deny
# route-map rmap3 permit 10
# description *** first stanza ***
# set ip next-hop verify-availability 3.3.3.3 track 1
# route-map rmap3 permit 20
# description *** second stanza ***
# set ip next-hop peer-address
# route-map rmap3 permit 30
# description *** third stanza ***
# set ip next-hop 6.6.6.6 2.2.2.2 load-share drop-on-fail
# Using overridden
# Before state:
# ------------
# nxos-9k-rdo# show running-config | section "^route-map"
# route-map rmap1 permit 10
# match as-number 65564
# match as-path Allow40
# match ip address acl_1
# description rmap1-10-permit
# route-map rmap1 deny 20
# match community BGPCommunity1 BGPCommunity2
# match ip address prefix-list AllowPrefix1 AllowPrefix2
# description rmap1-20-deny
# set dampening 30 1500 10000 120
# route-map rmap2 permit 20
# match interface Ethernet1/1
# match ipv6 address prefix-list AllowIPv6Prefix
# set as-path prepend 65563 65568 65569
# description rmap2-20-permit
# continue 40
# set comm-list BGPCommunity delete
# route-map rmap2 deny 40
# match ip multicast source 203.0.113.0/24 group-range 239.0.0.1 to 239.255.255.255 rp 192.0.2.0/24 rp-type ASM
# match route-type level-1 level-2
# match tag 2
# description rmap2-40-deny
- name: Override all route-maps configuration with provided configuration
cisco.nxos.nxos_route_maps:
config:
- route_map: rmap1
entries:
- sequence: 20
action: deny
description: rmap1-20-deny
match:
community:
community_list:
- BGPCommunity4
- BGPCommunity5
ip:
address:
prefix_lists:
- AllowPrefix1
set:
community:
local_as: True
state: overridden
# Task output
# -------------
# before:
# - route_map: rmap1
# entries:
# - action: permit
# description: rmap1-10-permit
# match:
# as_number:
# asn:
# - '65564'
# as_path:
# - Allow40
# ip:
# address:
# access_list: acl_1
# sequence: 10
#
# - action: deny
# description: rmap1-20-deny
# match:
# community:
# community_list:
# - BGPCommunity1
# - BGPCommunity2
# ip:
# address:
# prefix_lists:
# - AllowPrefix1
# - AllowPrefix2
# sequence: 20
# set:
# dampening:
# half_life: 30
# max_suppress_time: 120
# start_reuse_route: 1500
# start_suppress_route: 10000
#
# - route_map: rmap2
# entries:
# - action: permit
# continue_sequence: 40
# description: rmap2-20-permit
# match:
# interfaces:
# - Ethernet1/1
# ipv6:
# address:
# prefix_lists:
# - AllowIPv6Prefix
# sequence: 20
# set:
# as_path:
# prepend:
# as_number:
# - '65563'
# - '65568'
# - '65569'
# comm_list: BGPCommunity
#
# - action: deny
# description: rmap2-40-deny
# match:
# ip:
# multicast:
# group_range:
# first: 239.0.0.1
# last: 239.255.255.255
# rp:
# prefix: 192.0.2.0/24
# rp_type: ASM
# source: 203.0.113.0/24
# route_types:
# - level-1
# - level-2
# tags:
# - 2
# sequence: 40
#
# commands:
# - no route-map rmap1 permit 10
# - route-map rmap1 deny 20
# - no match community BGPCommunity1 BGPCommunity2
# - match community BGPCommunity4 BGPCommunity5
# - no match ip address prefix-list AllowPrefix1 AllowPrefix2
# - match ip address prefix-list AllowPrefix1
# - no set dampening 30 1500 10000 120
# - set community local-AS
# - no route-map rmap2 permit 20
# - no route-map rmap2 deny 40
#
# after:
# - route_map: rmap1
# entries:
# - sequence: 20
# action: deny
# description: rmap1-20-deny
# match:
# community:
# community_list:
# - BGPCommunity4
# - BGPCommunity5
# ip:
# address:
# prefix_lists:
# - AllowPrefix1
# set:
# community:
# local_as: True
#
# After state:
# ------------
# nxos-9k-rdo# sh running-config | section "^route-map"
# route-map rmap1 deny 20
# description rmap1-20-deny
# match community BGPCommunity4 BGPCommunity5
# match ip address prefix-list AllowPrefix1
# set community local-AS
# Using deleted to delete a single route-map
# Before state:
# ------------
# nxos-9k-rdo# show running-config | section "^route-map"
# route-map rmap1 permit 10
# match as-number 65564
# match as-path Allow40
# match ip address acl_1
# description rmap1-10-permit
# route-map rmap1 deny 20
# match community BGPCommunity1 BGPCommunity2
# match ip address prefix-list AllowPrefix1 AllowPrefix2
# description rmap1-20-deny
# set dampening 30 1500 10000 120
# route-map rmap2 permit 20
# match interface Ethernet1/1
# match ipv6 address prefix-list AllowIPv6Prefix
# set as-path prepend 65563 65568 65569
# description rmap2-20-permit
# continue 40
# set comm-list BGPCommunity delete
# route-map rmap2 deny 40
# match ip multicast source 203.0.113.0/24 group-range 239.0.0.1 to 239.255.255.255 rp 192.0.2.0/24 rp-type ASM
# match route-type level-1 level-2
# match tag 2
# description rmap2-40-deny
- name: Delete single route-map
cisco.nxos.nxos_route_maps:
config:
- route_map: rmap1
state: deleted
# Task output
# -------------
# before:
# - route_map: rmap1
# entries:
# - action: permit
# description: rmap1-10-permit
# match:
# as_number:
# asn:
# - '65564'
# as_path:
# - Allow40
# ip:
# address:
# access_list: acl_1
# sequence: 10
#
# - action: deny
# description: rmap1-20-deny
# match:
# community:
# community_list:
# - BGPCommunity1
# - BGPCommunity2
# ip:
# address:
# prefix_lists:
# - AllowPrefix1
# - AllowPrefix2
# sequence: 20
# set:
# dampening:
# half_life: 30
# max_suppress_time: 120
# start_reuse_route: 1500
# start_suppress_route: 10000
#
# - route_map: rmap2
# entries:
# - action: permit
# continue_sequence: 40
# description: rmap2-20-permit
# match:
# interfaces:
# - Ethernet1/1
# ipv6:
# address:
# prefix_lists:
# - AllowIPv6Prefix
# sequence: 20
# set:
# as_path:
# prepend:
# as_number:
# - '65563'
# - '65568'
# - '65569'
# comm_list: BGPCommunity
#
# - action: deny
# description: rmap2-40-deny
# match:
# ip:
# multicast:
# group_range:
# first: 239.0.0.1
# last: 239.255.255.255
# rp:
# prefix: 192.0.2.0/24
# rp_type: ASM
# source: 203.0.113.0/24
# route_types:
# - level-1
# - level-2
# tags:
# - 2
# sequence: 40
#
# commands:
# - no route-map rmap1 permit 10
# - no route-map rmap1 deny 20
#
# after:
# - route_map: rmap2
# entries:
# - action: permit
# continue_sequence: 40
# description: rmap2-20-permit
# match:
# interfaces:
# - Ethernet1/1
# ipv6:
# address:
# prefix_lists:
# - AllowIPv6Prefix
# sequence: 20
# set:
# as_path:
# prepend:
# as_number:
# - '65563'
# - '65568'
# - '65569'
# comm_list: BGPCommunity
#
# - action: deny
# description: rmap2-40-deny
# match:
# ip:
# multicast:
# group_range:
# first: 239.0.0.1
# last: 239.255.255.255
# rp:
# prefix: 192.0.2.0/24
# rp_type: ASM
# source: 203.0.113.0/24
# route_types:
# - level-1
# - level-2
# tags:
# - 2
# sequence: 40
#
# After state:
# ------------
# nxos-9k-rdo# sh running-config | section "^route-map"
# route-map rmap2 permit 20
# match interface Ethernet1/1
# match ipv6 address prefix-list AllowIPv6Prefix
# set as-path prepend 65563 65568 65569
# description rmap2-20-permit
# continue 40
# set comm-list BGPCommunity delete
# route-map rmap2 deny 40
# match ip multicast source 203.0.113.0/24 group-range 239.0.0.1 to 239.255.255.255 rp 192.0.2.0/24 rp-type ASM
# match route-type level-1 level-2
# match tag 2
# description rmap2-40-deny
# Using deleted to delete all route-maps from the device running-config
# Before state:
# ------------
# nxos-9k-rdo# show running-config | section "^route-map"
# route-map rmap1 permit 10
# match as-number 65564
# match as-path Allow40
# match ip address acl_1
# description rmap1-10-permit
# route-map rmap1 deny 20
# match community BGPCommunity1 BGPCommunity2
# match ip address prefix-list AllowPrefix1 AllowPrefix2
# description rmap1-20-deny
# set dampening 30 1500 10000 120
# route-map rmap2 permit 20
# match interface Ethernet1/1
# match ipv6 address prefix-list AllowIPv6Prefix
# set as-path prepend 65563 65568 65569
# description rmap2-20-permit
# continue 40
# set comm-list BGPCommunity delete
# route-map rmap2 deny 40
# match ip multicast source 203.0.113.0/24 group-range 239.0.0.1 to 239.255.255.255 rp 192.0.2.0/24 rp-type ASM
# match route-type level-1 level-2
# match tag 2
# description rmap2-40-deny
- name: Delete all route-maps
cisco.nxos.nxos_route_maps:
state: deleted
# Task output
# -------------
# before:
# - route_map: rmap1
# entries:
# - action: permit
# description: rmap1-10-permit
# match:
# as_number:
# asn:
# - '65564'
# as_path:
# - Allow40
# ip:
# address:
# access_list: acl_1
# sequence: 10
#
# - action: deny
# description: rmap1-20-deny
# match:
# community:
# community_list:
# - BGPCommunity1
# - BGPCommunity2
# ip:
# address:
# prefix_lists:
# - AllowPrefix1
# - AllowPrefix2
# sequence: 20
# set:
# dampening:
# half_life: 30
# max_suppress_time: 120
# start_reuse_route: 1500
# start_suppress_route: 10000
#
# - route_map: rmap2
# entries:
# - action: permit
# continue_sequence: 40
# description: rmap2-20-permit
# match:
# interfaces:
# - Ethernet1/1
# ipv6:
# address:
# prefix_lists:
# - AllowIPv6Prefix
# sequence: 20
# set:
# as_path:
# prepend:
# as_number:
# - '65563'
# - '65568'
# - '65569'
# comm_list: BGPCommunity
#
# - action: deny
# description: rmap2-40-deny
# match:
# ip:
# multicast:
# group_range:
# first: 239.0.0.1
# last: 239.255.255.255
# rp:
# prefix: 192.0.2.0/24
# rp_type: ASM
# source: 203.0.113.0/24
# route_types:
# - level-1
# - level-2
# tags:
# - 2
# sequence: 40
#
# commands:
# - no route-map rmap1 permit 10
# - no route-map rmap1 deny 20
# - no route-map rmap2 permit 20
# - no route-map rmap2 deny 40
#
# after: []
#
# After state:
# ------------
# nxos-9k-rdo# sh running-config | section "^route-map"
- name: Render platform specific configuration lines with state rendered (without connecting to the device)
cisco.nxos.nxos_route_maps:
config:
- route_map: rmap1
entries:
- sequence: 10
action: permit
description: rmap1-10-permit
match:
ip:
address:
access_list: acl_1
as_path: Allow40
as_number:
asn: 65564
- sequence: 20
action: deny
description: rmap1-20-deny
match:
community:
community_list:
- BGPCommunity1
- BGPCommunity2
ip:
address:
prefix_lists:
- AllowPrefix1
- AllowPrefix2
set:
dampening:
half_life: 30
start_reuse_route: 1500
start_suppress_route: 10000
max_suppress_time: 120
- route_map: rmap2
entries:
- sequence: 20
action: permit
description: rmap2-20-permit
continue_sequence: 40
match:
ipv6:
address:
prefix_lists: AllowIPv6Prefix
interfaces: "{{ nxos_int1 }}"
set:
as_path:
prepend:
as_number:
- 65563
- 65568
- 65569
comm_list: BGPCommunity
- sequence: 40
action: deny
description: rmap2-40-deny
match:
route_types:
- level-1
- level-2
tags: 2
ip:
multicast:
rp:
prefix: 192.0.2.0/24
rp_type: ASM
source: 203.0.113.0/24
group_range:
first: 239.0.0.1
last: 239.255.255.255
state: rendered
# Task Output (redacted)
# -----------------------
# rendered:
# - "route-map rmap1 permit 10"
# - "match as-number 65564"
# - "match as-path Allow40"
# - "match ip address acl_1"
# - "description rmap1-10-permit"
# - "route-map rmap1 deny 20"
# - "match community BGPCommunity1 BGPCommunity2"
# - "match ip address prefix-list AllowPrefix1 AllowPrefix2"
# - "description rmap1-20-deny"
# - "set dampening 30 1500 10000 120"
# - "route-map rmap2 permit 20"
# - "match interface Ethernet1/1"
# - "match ipv6 address prefix-list AllowIPv6Prefix"
# - "set as-path prepend 65563 65568 65569"
# - "description rmap2-20-permit"
# - "continue 40"
# - "set comm-list BGPCommunity delete"
# - "route-map rmap2 deny 40"
# - "match ip multicast source 203.0.113.0/24 group-range 239.0.0.1 to 239.255.255.255 rp 192.0.2.0/24 rp-type ASM"
# - "match route-type level-1 level-2"
# - "match tag 2"
# - "description rmap2-40-deny"
# Using parsed
# parsed.cfg
# ------------
# route-map rmap1 permit 10
# match as-number 65564
# match as-path Allow40
# match ip address acl_1
# description rmap1-10-permit
# route-map rmap1 deny 20
# match community BGPCommunity1 BGPCommunity2
# match ip address prefix-list AllowPrefix1 AllowPrefix2
# description rmap1-20-deny
# set dampening 30 1500 10000 120
# route-map rmap2 permit 20
# match interface Ethernet1/1
# match ipv6 address prefix-list AllowIPv6Prefix
# set as-path prepend 65563 65568 65569
# description rmap2-20-permit
# continue 40
# set comm-list BGPCommunity delete
# route-map rmap2 deny 40
# match ip multicast source 203.0.113.0/24 group-range 239.0.0.1 to 239.255.255.255 rp 192.0.2.0/24 rp-type ASM
# match route-type level-1 level-2
# match tag 2
# description rmap2-40-deny
- name: Parse externally provided route-maps configuration
cisco.nxos.nxos_route_maps:
running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}"
state: parsed
# Task output (redacted)
# -----------------------
# parsed:
# - route_map: rmap1
# entries:
# - action: permit
# description: rmap1-10-permit
# match:
# as_number:
# asn:
# - '65564'
# as_path:
# - Allow40
# ip:
# address:
# access_list: acl_1
# sequence: 10
#
# - action: deny
# description: rmap1-20-deny
# match:
# community:
# community_list:
# - BGPCommunity1
# - BGPCommunity2
# ip:
# address:
# prefix_lists:
# - AllowPrefix1
# - AllowPrefix2
# sequence: 20
# set:
# dampening:
# half_life: 30
# max_suppress_time: 120
# start_reuse_route: 1500
# start_suppress_route: 10000
#
# - route_map: rmap2
# entries:
# - action: permit
# continue_sequence: 40
# description: rmap2-20-permit
# match:
# interfaces:
# - Ethernet1/1
# ipv6:
# address:
# prefix_lists:
# - AllowIPv6Prefix
# sequence: 20
# set:
# as_path:
# prepend:
# as_number:
# - '65563'
# - '65568'
# - '65569'
# comm_list: BGPCommunity
#
# - action: deny
# description: rmap2-40-deny
# match:
# ip:
# multicast:
# group_range:
# first: 239.0.0.1
# last: 239.255.255.255
# rp:
# prefix: 192.0.2.0/24
# rp_type: ASM
# source: 203.0.113.0/24
# route_types:
# - level-1
# - level-2
# tags:
# - 2
# sequence: 40
# Using gathered
# Existing route-map config
# ---------------------------
# nxos-9k-rdo# show running-config | section "^route-map"
# route-map rmap1 permit 10
# match as-number 65564
# match as-path Allow40
# match ip address acl_1
# description rmap1-10-permit
# route-map rmap2 permit 20
# match interface Ethernet1/1
# match ipv6 address prefix-list AllowIPv6Prefix
# set as-path prepend 65563 65568 65569
# description rmap2-20-permit
# continue 40
# set comm-list BGPCommunity delete
- name: Gather route-maps facts using gathered
cisco.nxos.nxos_route_maps:
state: gathered
# gathered:
# - route_map: rmap1
# entries:
# - action: permit
# description: rmap1-10-permit
# match:
# as_number:
# asn:
# - '65564'
# as_path:
# - Allow40
# ip:
# address:
# access_list: acl_1
# sequence: 10
#
# - route_map: rmap2
# entries:
# - action: permit
# continue_sequence: 40
# description: rmap2-20-permit
# match:
# interfaces:
# - Ethernet1/1
# ipv6:
# address:
# prefix_lists:
# - AllowIPv6Prefix
# sequence: 20
# set:
# as_path:
# prepend:
# as_number:
# - '65563'
# - '65568'
# - '65569'
# comm_list: BGPCommunity
#
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The resulting configuration model invocation. Returned: when changed Sample: |
|
The configuration prior to the model invocation. Returned: always Sample: |
|
The set of commands pushed to the remote device. Returned: always Sample: |