Route Maps resource module.
Version added: 2.2.0
- This module manages route maps configuration on devices running Cisco NX-OS.
Note
- Tested against NX-OS 9.3.6.
- Unsupported for Cisco MDS
- This module works with connection
network_cli
andhttpapi
.
# 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
#
Common return values are documented here, the following are the fields unique to this module:
- Nilashish Chakraborty (@NilashishC)