arista.eos.eos_route_maps 模块 – 管理路由映射资源模块

注意

此模块是 arista.eos 集合(版本 10.0.1)的一部分。

如果您正在使用 ansible 包,您可能已经安装了这个集合。 它不包含在 ansible-core 中。 要检查它是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用: ansible-galaxy collection install arista.eos

要在 playbook 中使用它,请指定: arista.eos.eos_route_maps

arista.eos 2.1.0 中的新增功能

概要

  • 此模块配置和管理 Arista EOS 平台上的路由映射的属性。

参数

参数

注释

config

列表 / 元素=字典

路由映射选项的列表

entries

列表 / 元素=字典

路由映射条目。

action

字符串

匹配路由的动作

选择

  • "deny"

  • "permit"

continue_sequence

整数

路由映射条目序列号。

description

字符串

路由映射的描述。

match

字典

路由映射匹配规则。

aggregate_role

字典

BGP 贡献者-聚合关系中的角色。

contributor

布尔值

BGP 聚合的贡献者。

选择

  • false

  • true

route_map

字符串

要应用于聚合路由的路由映射。

as

整数

BGP AS 号。

as_path

字典

设置 AS 路径。

length

字符串

指定 AS 路径长度(带有比较运算符,如 <= 60 和 >= 40)。

path_list

字符串

AS 路径列表名称。

community

字典

BGP community 属性。

community_list

字符串

community 名称列表(以 CSV 格式)。

exact_match

布尔值

对 community 进行精确匹配。

选择

  • false

  • true

instances

字符串

匹配 community 实例数(带有比较运算符,如 <= 60 和 >= 40)。

extcommunity

字典

扩展 community 列表名称。

community_list

字符串

community 名称列表(以 CSV 格式)。

exact_match

布尔值

对 community 进行精确匹配。

选择

  • false

  • true

interface

字符串

接口名称。

invert_result

字典

反转匹配结果。

aggregate_role

字典

BGP 贡献者-聚合关系中的角色。

contributor

布尔值

BGP 聚合的贡献者。

选择

  • false

  • true

route_map

字符串

要应用于聚合路由的路由映射。

as_path

字典

设置 AS 路径。

length

字符串

指定 AS 路径长度(带有比较运算符,如 <= 60 和 >= 40)。

path_list

字符串

AS 路径列表名称。

community

字典

BGP community 属性。

community_list

字符串

community 名称列表(以 CSV 格式)。

exact_match

布尔值

对 community 进行精确匹配。

选择

  • false

  • true

instances

字符串

匹配 community 实例数(带有比较运算符,如 <= 60 和 >= 40)。

extcommunity

字典

扩展 community 列表名称。

community_list

字符串

community 名称列表(以 CSV 格式)。

exact_match

布尔值

对 community 进行精确匹配。

选择

  • false

  • true

large_community

字典

扩展 community 列表名称。

community_list

字符串

community 名称列表(以 CSV 格式)。

exact_match

布尔值

对 community 进行精确匹配。

选择

  • false

  • true

ip

字典

设置 IP 特定信息。

address

字典

下一跳目标。

access_list

字符串

IP 访问列表。

dynamic

布尔值

配置动态前缀列表。

选择

  • false

  • true

prefix_list

字符串

前缀列表。

next_hop

字符串

下一跳前缀列表。

resolved_next_hop

字符串

路由解析的前缀列表。

ipv6

字典

设置 IPv6 特定信息。

address

字典

下一跳目标。

access_list

字符串

IP 访问列表。

dynamic

布尔值

配置动态前缀列表。

选择

  • false

  • true

prefix_list

字符串

前缀列表。

next_hop

字符串

下一跳前缀列表。

resolved_next_hop

字符串

路由解析的前缀列表。

isis_level

字符串

IS-IS 级别。

large_community

字典

扩展 community 列表名称。

community_list

字符串

community 名称列表(以 CSV 格式)。

exact_match

布尔值

对 community 进行精确匹配。

选择

  • false

  • true

local_preference

整数

BGP 本地优先级。

metric

整数

路由指标。

metric_type

字符串

路由指标类型。

选择

  • "type-1"

  • "type-2"

route_type

字符串

路由类型

router_id

字符串

路由器 ID。

source_protocol

字符串

源路由协议,

tag

整数

路由标签

sequence

整数

序列中的索引。

set

字典

设置路由属性。

as_path

字典

设置 AS 路径。

match

字典

匹配整个 AS 路径。

as_number

字符串

要使用的 AS 号(包括 auto;以 CSV 格式)

none

布尔值

删除匹配的 AS 号

选择

  • false

  • true

prepend

字典

添加到 AS 路径前面。

as_number

字符串

要添加的 AS 号(包括 auto;以 CSV 格式)

last_as

整数

添加最后 AS 号的次数。

bgp

整数

BGP AS 路径多路径权重。

community_attributes

字典

BGP community 属性。

community

字典

community 属性。

additive

布尔值

添加到现有 community。

选择

  • false

  • true

delete

布尔值

删除匹配的 community。

选择

  • false

  • true

graceful_shutdown

布尔值

优雅关闭。

选择

  • false

  • true

internet

布尔值

Internet community

选择

  • false

  • true

list

字符串

community 列表名称。

local_as

布尔值

不要在本地 AS 外部发送。

选择

  • false

  • true

no_advertise

布尔值

不要通告给任何对等方。

选择

  • false

  • true

no_export

布尔值

不要导出到下一个 AS。

选择

  • false

  • true

number

字符串

community 号码(以 CSV 格式)。

graceful_shutdown

布尔值

优雅关闭

选择

  • false

  • true

none

布尔值

无 community 属性。

选择

  • false

  • true

distance

整数

设置独立于协议的距离。

evpn

布尔值

通告到 eBGP 对等方时保留下一跳。

选择

  • false

  • true

extcommunity

字典

BGP 扩展 community 属性。

lbw

字典

链接带宽值。

aggregate

布尔值

聚合链接带宽。

选择

  • false

  • true

divide

字符串

划分链接带宽。

选择

  • "equal"

  • "ration"

value

字符串

链接带宽扩展 community 值。

none

布尔值

无属性。

选择

  • false

  • true

rt

字典

路由目标扩展 community

additive

布尔值

添加到现有 community。

选择

  • false

  • true

delete

布尔值

删除匹配的 community。

选择

  • false

  • true

vpn

字符串

VPN 扩展 community。

soo

字典

始发站点扩展 community。

additive

布尔值

添加到现有 community。

选择

  • false

  • true

delete

布尔值

删除匹配的 community。

选择

  • false

  • true

vpn

字符串

VPN 扩展 community。

ip

字典

设置 IP 特定信息。

address

字符串

下一跳地址。

peer_address

布尔值

使用 BGP 对等地址作为下一跳。

选择

  • false

  • true

unchanged

布尔值

通告给 eBGP 对等方时保留下一跳

选择

  • false

  • true

ipv6

字典

设置 IPv6 特定信息。

address

字符串

下一跳地址。

peer_address

布尔值

使用 BGP 对等地址作为下一跳。

选择

  • false

  • true

unchanged

布尔值

通告给 eBGP 对等方时保留下一跳

选择

  • false

  • true

isis_level

字符串

IS-IS 级别。

local_preference

整数

BGP 本地优先级。

metric

字典

路由指标。

add

字符串

添加 igp-metric / igp-nexthop-cost

选择

  • "igp-metric"

  • "igp-nexthop-cost"

igp_param

字符串

IGP 参数

选择

  • "igp-metric"

  • "igp-nexthop-cost"

value

字符串

要添加或减去的指标值(带有 +/- 符号)。

metric_type

字符串

路由指标类型。

选择

  • "type-1"

  • "type-2"

nexthop

字典

路由下一跳。

max_metric

布尔值

设置 IGP 最大指标值。

选择

  • false

  • true

value

整数

IGP 指标值。

origin

字符串

设置 BGP 始发。

选择

  • "egp"

  • "igp"

  • "incomplete"

segment_index

整数

MPLS 段路由段索引。

tag

整数

路由标签

weight

整数

BGP 权重。

source

字典

重命名/复制配置

action

字符串

重命名或复制配置

选择

  • "rename"

  • "copy"

overwrite

布尔值

如果为 true,则覆盖现有配置。

选择

  • false

  • true

source_map_name

字符串

源路由映射名称。

statement

字符串

语句名称

sub_route_map

字典

子路由映射

invert_result

布尔值

反转子路由映射结果

选择

  • false

  • true

name

字符串

子路由映射名称

route_map

字符串

路由映射名称。

running_config

字符串

此选项仅与状态 *parsed* 一起使用。

此选项的值应是通过执行命令 show running-config | section route-map 从 EOS 设备接收的输出。

状态 *parsed* 从 running_config 选项读取配置,并根据资源模块的 argspec 将其转换为 Ansible 结构化数据,然后该值将返回到结果中的 *parsed* 键中。

state

字符串

配置应保留的状态。

选择

  • "deleted"

  • "merged" ← (默认)

  • "overridden"

  • "replaced"

  • "gathered"

  • "rendered"

  • "parsed"

注释

注意

  • 已针对 Arista EOS 4.24.6F 进行测试

  • 此模块与连接 network_cli 一起使用。 请参阅 EOS 平台选项

示例

# 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)