Manages Route Maps resource module
Version added: 2.1.0
- This module configures and manages the attributes of Route Mapd on Arista EOS platforms.
Note
- Tested against Arista EOS 4.24.6F
- This module works with connection
network_cli
. See the EOS Platform Options.
# Using merged
# Before state
# veos#show running-config | section route-map
# veos#
- name: Merge provided configuration with device configuration
arista.eos.eos_route_maps:
config:
- route_map: "mapmerge"
entries:
- description: "merged_map"
action: "permit"
sequence: 10
match:
router_id: 22
- description: "newmap"
action: "deny"
sequence: 25
continue_sequence: 45
match:
interface: "Ethernet1"
- route_map: "mapmerge2"
entries:
- sub_route_map:
name: "mapmerge"
action: "deny"
sequence: 45
set:
metric:
value: 25
add: "igp-metric"
as_path:
prepend:
last_as: 2
match:
ipv6:
resolved_next_hop: "list1"
state: merged
# After State:
# veos#show running-config | section route-map
# route-map mapmerge permit 10
# description merged_map
# match router-id prefix-list 22
# !
# route-map mapmerge deny 25
# description newmap
# match interface Ethernet1
# continue 45
# !
# route-map mapmerge2 deny 45
# match ipv6 resolved-next-hop prefix-list list1
# sub-route-map mapmerge
# set metric 25 +igp-metric
# set as-path prepend last-as 2
# !
# route-map test permit 10
# veos#
# Module Execution:
# "after": [
# {
# "entries": [
# {
# "action": "permit",
# "description": "merged_map",
# "match": {
# "router_id": "22"
# },
# "sequence": 10
# },
# {
# "action": "deny",
# "continue_sequence": 45,
# "description": "newmap",
# "match": {
# "interface": "Ethernet1"
# },
# "sequence": 25
# }
# ],
# "route_map": "mapmerge"
# },
# {
# "entries": [
# {
# "action": "deny",
# "match": {
# "ipv6": {
# "resolved_next_hop": "list1"
# }
# },
# "sequence": 45,
# "set": {
# "as_path": {
# "prepend": {
# "last_as": 2
# }
# },
# "metric": {
# "add": "igp-metric",
# "value": "25"
# }
# },
# "sub_route_map": {
# "name": "mapmerge"
# }
# }
# ],
# "route_map": "mapmerge2"
# }
# ],
# "before": {},
# "changed": true,
# "commands": [
# "route-map mapmerge permit 10",
# "match router-id prefix-list 22",
# "description merged_map",
# "route-map mapmerge deny 25",
# "match interface Ethernet1",
# "description newmap",
# "continue 45",
# "route-map mapmerge2 deny 45",
# "match ipv6 resolved-next-hop prefix-list list1",
# "set metric 25 +igp-metric",
# "set as-path prepend last-as 2",
# "sub-route-map mapmerge"
# ],
#
# Using replaced:
# Before State:
# veos#show running-config | section route-map
# route-map mapmerge permit 10
# description merged_map
# match router-id prefix-list 22
# !
# route-map mapmerge deny 25
# description newmap
# match interface Ethernet1
# continue 45
# !
# route-map mapmerge2 deny 45
# match ipv6 resolved-next-hop prefix-list list1
# sub-route-map mapmerge
# set metric 25 +igp-metric
# set as-path prepend last-as 2
# !
# veos#
- name: Replace
arista.eos.eos_route_maps:
config:
- route_map: "mapmerge"
entries:
- action: "permit"
sequence: 10
match:
ipv6:
resolved_next_hop: "listr"
- action: "deny"
sequence: 90
set:
extcommunity:
rt:
vpn: "22:11"
delete: true
ip:
unchanged: true
state: replaced
# After State:
# veos#show running-config | section route-map
# route-map mapmerge permit 10
# match ipv6 resolved-next-hop prefix-list listr
# !
# route-map mapmerge deny 25
# description newmap
# match interface Ethernet1
# continue 45
# !
# route-map mapmerge deny 90
# set ip next-hop unchanged
# set extcommunity rt 22:11 delete
# !
# route-map mapmerge2 deny 45
# match ipv6 resolved-next-hop prefix-list list1
# sub-route-map mapmerge
# set metric 25 +igp-metric
# set as-path prepend last-as 2
# !
#
# Module Execution:
#
# "after": [
# {
# "entries": [
# {
# "action": "permit",
# "match": {
# "ipv6": {
# "resolved_next_hop": "listr"
# }
# },
# "sequence": 10
# },
# {
# "action": "deny",
# "continue_sequence": 45,
# "description": "newmap",
# "match": {
# "interface": "Ethernet1"
# },
# "sequence": 25
# },
# {
# "action": "deny",
# "sequence": 90,
# "set": {
# "extcommunity": {
# "rt": {
# "delete": true,
# "vpn": "22:11"
# }
# },
# "ip": {
# "unchanged": true
# }
# }
# }
# ],
# "route_map": "mapmerge"
# },
# {
# "entries": [
# {
# "action": "deny",
# "match": {
# "ipv6": {
# "resolved_next_hop": "list1"
# }
# },
# "sequence": 45,
# "set": {
# "as_path": {
# "prepend": {
# "last_as": 2
# }
# },
# "metric": {
# "add": "igp-metric",
# "value": "25"
# }
# },
# "sub_route_map": {
# "name": "mapmerge"
# }
# }
# ],
# "route_map": "mapmerge2"
# },
# {
# "entries": [
# {
# "action": "permit",
# "sequence": 10
# }
# ],
# "route_map": "test"
# }
# ],
# "before": [
# {
# "entries": [
# {
# "action": "permit",
# "description": "merged_map",
# "match": {
# "router_id": "22"
# },
# "sequence": 10
# },
# {
# "action": "deny",
# "continue_sequence": 45,
# "description": "newmap",
# "match": {
# "interface": "Ethernet1"
# },
# "sequence": 25
# }
# ],
# "route_map": "mapmerge"
# },
# {
# "entries": [
# {
# "action": "deny",
# "match": {
# "ipv6": {
# "resolved_next_hop": "list1"
# }
# },
# "sequence": 45,
# "set": {
# "as_path": {
# "prepend": {
# "last_as": 2
# }
# },
# "metric": {
# "add": "igp-metric",
# "value": "25"
# }
# },
# "sub_route_map": {
# "name": "mapmerge"
# }
# }
# ],
# "route_map": "mapmerge2"
# }
# ],
# "changed": true,
# "commands": [
# "route-map mapmerge permit 10",
# "match ipv6 resolved-next-hop prefix-list listr",
# "no match router-id prefix-list 22",
# "no description",
# "route-map mapmerge deny 90",
# "set extcommunity rt 22:11 delete",
# "set ip next-hop unchanged"
# ],
#
#
# Using Overridden:
# Before state:
# veos#show running-config | section route-map
# route-map mapmerge permit 10
# match ipv6 resolved-next-hop prefix-list listr
# !
# route-map mapmerge deny 25
# description newmap
# match interface Ethernet1
# continue 45
# !
# route-map mapmerge deny 90
# set ip next-hop unchanged
# set extcommunity rt 22:11 delete
# !
# route-map mapmerge2 deny 45
# match ipv6 resolved-next-hop prefix-list list1
# sub-route-map mapmerge
# set metric 25 +igp-metric
# set as-path prepend last-as 2
# !
# route-map test permit 10
# veos#
- name: Override
arista.eos.eos_route_maps:
config:
- route_map: "mapmerge"
entries:
- action: "permit"
sequence: 10
match:
ipv6:
resolved_next_hop: "listr"
- action: "deny"
sequence: 90
set:
metric:
igp_param: "igp-nexthop-cost"
state: overridden
# After State:
# veos#show running-config | section route-map
# route-map mapmerge permit 10
# match ipv6 resolved-next-hop prefix-list listr
# !
# route-map mapmerge deny 90
# set metric igp-nexthop-cost
# veos#
#
#
# "after": [
# {
# "entries": [
# {
# "action": "permit",
# "match": {
# "ipv6": {
# "resolved_next_hop": "listr"
# }
# },
# "sequence": 10
# },
# {
# "action": "deny",
# "sequence": 90,
# "set": {
# "metric": {
# "igp_param": "igp-nexthop-cost"
# }
# }
# }
# ],
# "route_map": "mapmerge"
# }
# ],
# "before": [
# {
# "entries": [
# {
# "action": "permit",
# "match": {
# "ipv6": {
# "resolved_next_hop": "listr"
# }
# },
# "sequence": 10
# },
# {
# "action": "deny",
# "continue_sequence": 45,
# "description": "newmap",
# "match": {
# "interface": "Ethernet1"
# },
# "sequence": 25
# },
# {
# "action": "deny",
# "sequence": 90,
# "set": {
# "extcommunity": {
# "rt": {
# "delete": true,
# "vpn": "22:11"
# }
# },
# "ip": {
# "unchanged": true
# }
# }
# }
# ],
# "route_map": "mapmerge"
# },
# {
# "entries": [
# {
# "action": "deny",
# "match": {
# "ipv6": {
# "resolved_next_hop": "list1"
# }
# },
# "sequence": 45,
# "set": {
# "as_path": {
# "prepend": {
# "last_as": 2
# }
# },
# "metric": {
# "add": "igp-metric",
# "value": "25"
# }
# },
# "sub_route_map": {
# "name": "mapmerge"
# }
# }
# ],
# "route_map": "mapmerge2"
# },
# {
# "entries": [
# {
# "action": "permit",
# "sequence": 10
# }
# ],
# "route_map": "test"
# }
# ],
# "changed": true,
# "commands": [
# "no route-map mapmerge deny 25",
# "no route-map mapmerge2 deny 45",
# "no route-map test permit 10",
# "route-map mapmerge deny 90",
# "set metric igp-nexthop-cost",
# "no set ip next-hop unchanged",
# "no set extcommunity rt 22:11 delete"
# ],
#
# Using deleted:
# Before State:
# veos#show running-config | section route-map
# route-map mapmerge permit 10
# description merged_map
# match router-id prefix-list 22
# match ipv6 resolved-next-hop prefix-list listr
# !
# route-map mapmerge deny 25
# description newmap
# match interface Ethernet1
# continue 45
# !
# route-map mapmerge deny 90
# set metric igp-nexthop-cost
# !
# route-map mapmerge2 deny 45
# match ipv6 resolved-next-hop prefix-list list1
# sub-route-map mapmerge
# set metric 25 +igp-metric
# set as-path prepend last-as 2
# veos#
- name: Delete route-map
arista.eos.eos_route_maps:
config:
- route_map: "mapmerge"
state: deleted
become: true
tags:
- deleted1
# After State:
# veos#show running-config | section route-map
# route-map mapmerge2 deny 45
# match ipv6 resolved-next-hop prefix-list list1
# sub-route-map mapmerge
# set metric 25 +igp-metric
# set as-path prepend last-as 2
# veos#
#
# Module Execution:
#
# "after": [
# {
# "entries": [
# {
# "action": "deny",
# "match": {
# "ipv6": {
# "resolved_next_hop": "list1"
# }
# },
# "sequence": 45,
# "set": {
# "as_path": {
# "prepend": {
# "last_as": 2
# }
# },
# "metric": {
# "add": "igp-metric",
# "value": "25"
# }
# },
# "sub_route_map": {
# "name": "mapmerge"
# }
# }
# ],
# "route_map": "mapmerge2"
# }
# ],
# "before": [
# {
# "entries": [
# {
# "action": "permit",
# "description": "merged_map",
# "match": {
# "ipv6": {
# "resolved_next_hop": "listr"
# },
# "router_id": "22"
# },
# "sequence": 10
# },
# {
# "action": "deny",
# "continue": 45,
# "description": "newmap",
# "match": {
# "interface": "Ethernet1"
# },
# "sequence": 25
# },
# {
# "action": "deny",
# "sequence": 90,
# "set": {
# "metric": {
# "igp_param": "igp-nexthop-cost"
# }
# }
# }
# ],
# "route_map": "mapmerge"
# },
# {
# "entries": [
# {
# "action": "deny",
# "match": {
# "ipv6": {
# "resolved_next_hop": "list1"
# }
# },
# "sequence": 45,
# "set": {
# "as_path": {
# "prepend": {
# "last_as": 2
# }
# },
# "metric": {
# "add": "igp-metric",
# "value": "25"
# }
# },
# "sub_route_map": {
# "name": "mapmerge"
# }
# }
# ],
# "route_map": "mapmerge2"
# }
# ],
# "changed": true,
# "commands": [
# "no route-map mapmerge"
# ],
# Using deleted to delete all route-maps:
# Before State:
# veos#show running-config | section route-map
# route-map mapmerge permit 10
# description merged_map
# match router-id prefix-list 22
# !
# route-map mapmerge deny 25
# description newmap
# match interface Ethernet1
# continue 45
# !
# route-map mapmerge2 deny 45
# match ipv6 resolved-next-hop prefix-list list1
# sub-route-map mapmerge
# set metric 25 +igp-metric
# set as-path prepend last-as 2
# veos#
- name: Delete all route-maps
arista.eos.eos_route_maps:
state: deleted
# After State:
# ------------
# veos#show running-config | section route-map
# veos#
#
# Module Execution:
#
# "after": {},
# "before": [
# {
# "entries": [
# {
# "action": "permit",
# "description": "merged_map",
# "match": {
# "router_id": "22"
# },
# "sequence": 10
# },
# {
# "action": "deny",
# "continue": 45,
# "description": "newmap",
# "match": {
# "interface": "Ethernet1"
# },
# "sequence": 25
# }
# ],
# "route_map": "mapmerge"
# },
# {
# "entries": [
# {
# "action": "deny",
# "match": {
# "ipv6": {
# "resolved_next_hop": "list1"
# }
# },
# "sequence": 45,
# "set": {
# "as_path": {
# "prepend": {
# "last_as": 2
# }
# },
# "metric": {
# "add": "igp-metric",
# "value": "25"
# }
# },
# "sub_route_map": {
# "name": "mapmerge"
# }
# }
# ],
# "route_map": "mapmerge2"
# }
# ],
# "changed": true,
# "commands": [
# "no route-map mapmerge",
# "no route-map mapmerge2"
# ],
# Using gathered:
# Device configs:
# veos#show running-config | section route-map
# route-map mapmerge permit 10
# description merged_map
# match router-id prefix-list 22
# !
# route-map mapmerge deny 25
# description newmap
# match interface Ethernet1
# continue 45
# !
# route-map mapmerge2 deny 45
# match ipv6 resolved-next-hop prefix-list list1
# sub-route-map mapmerge
# set metric 25 +igp-metric
# set as-path prepend last-as 2
# veos#
- name: gather configs
arista.eos.eos_route_maps:
state: gathered
# Module Execution:
# "gathered": [
# {
# "entries": [
# {
# "action": "permit",
# "description": "merged_map",
# "match": {
# "router_id": "22"
# },
# "sequence": 10
# },
# {
# "action": "deny",
# "continue_sequence": 45,
# "description": "newmap",
# "match": {
# "interface": "Ethernet1"
# },
# "sequence": 25
# }
# ],
# "route_map": "mapmerge"
# },
# {
# "entries": [
# {
# "action": "deny",
# "match": {
# "ipv6": {
# "resolved_next_hop": "list1"
# }
# },
# "sequence": 45,
# "set": {
# "as_path": {
# "prepend": {
# "last_as": 2
# }
# },
# "metric": {
# "add": "igp-metric",
# "value": "25"
# }
# },
# "sub_route_map": {
# "name": "mapmerge"
# }
# }
# ],
# "route_map": "mapmerge2"
# }
# ],
# Using rendered:
- name: Render provided configuration
arista.eos.eos_route_maps:
config:
- route_map: "mapmerge"
entries:
- description: "merged_map"
action: "permit"
sequence: 10
match:
router_id: 22
set:
bgp: 20
- description: "newmap"
action: "deny"
sequence: 25
continue_sequence: 45
match:
interface: "Ethernet1"
- route_map: "mapmerge2"
entries:
- sub_route_map:
name: "mapmerge"
action: "deny"
sequence: 45
set:
metric:
value: 25
add: "igp-metric"
as_path:
prepend:
last_as: 2
match:
ipv6:
resolved_next_hop: "list1"
state: rendered
# Task output:
# ------------
# "rendered": [
# "route-map mapmerge permit 10",
# "match router-id prefix-list 22",
# "set bgp bestpath as-path weight 20",
# "description merged_map",
# "route-map mapmerge deny 25",
# "match interface Ethernet1",
# "description newmap",
# "continue 45",
# "route-map mapmerge2 deny 45",
# "match ipv6 resolved-next-hop prefix-list list1",
# "set metric 25 +igp-metric",
# "set as-path prepend last-as 2",
# "sub-route-map mapmerge"
# ]
# Using parsed:
# parsed.cfg
# route-map mapmerge permit 10
# description merged_map
# match router-id prefix-list 22
# set bgp bestpath as-path weight 20
# !
# route-map mapmerge deny 25
# description newmap
# match interface Ethernet1
# continue 45
# !
# route-map mapmerge2 deny 45
# match ipv6 resolved-next-hop prefix-list list1
# sub-route-map mapmerge
# set metric 25 +igp-metric
# set as-path prepend last-as 2
- name: parse configs
arista.eos.eos_route_maps:
running_config: "{{ lookup('file', './parsed.cfg') }}"
state: parsed
# Module Execution:
# "parsed": [
# {
# "entries": [
# {
# "action": "permit",
# "description": "merged_map",
# "match": {
# "router_id": "22"
# },
# "sequence": 10,
# "set": {
# "bgp": 20
# }
# },
# {
# "action": "deny",
# "continue_sequence": 45,
# "description": "newmap",
# "match": {
# "interface": "Ethernet1"
# },
# "sequence": 25
# }
# ],
# "route_map": "mapmerge"
# },
# {
# "entries": [
# {
# "action": "deny",
# "match": {
# "ipv6": {
# "resolved_next_hop": "list1"
# }
# },
# "sequence": 45,
# "set": {
# "as_path": {
# "prepend": {
# "last_as": 2
# }
# },
# "metric": {
# "add": "igp-metric",
# "value": "25"
# }
# },
# "sub_route_map": {
# "name": "mapmerge"
# }
# }
# ],
# "route_map": "mapmerge2"
# }
# ]
- Gomathi Selvi Srinivasan (@GomathiselviS)