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

注意

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

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

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

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

arista.eos 2.1.0 中的新增功能

摘要

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

参数

参数

注释

config

列表 / 元素=字典

路由映射选项列表

entries

列表 / 元素=字典

路由映射条目。

action

字符串

匹配路由的操作

选项

  • "拒绝"

  • "允许"

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_list

字符串

社区名称列表(以 CSV 格式)。

exact_match

布尔值

进行社区的精确匹配。

选项

  • false

  • true

instances

字符串

匹配社区实例的数量(使用比较运算符,例如 <= 60 和 >= 40)。

extcommunity

字典

扩展社区列表名称。

community_list

字符串

社区名称列表(以 CSV 格式)。

exact_match

布尔值

进行社区的精确匹配。

选项

  • 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_list

字符串

社区名称列表(以 CSV 格式)。

exact_match

布尔值

进行社区的精确匹配。

选项

  • false

  • true

instances

字符串

匹配社区实例的数量(使用比较运算符,例如 <= 60 和 >= 40)。

extcommunity

字典

扩展社区列表名称。

community_list

字符串

社区名称列表(以 CSV 格式)。

exact_match

布尔值

进行社区的精确匹配。

选项

  • false

  • true

large_community

字典

扩展社区列表名称。

community_list

字符串

社区名称列表(以 CSV 格式)。

exact_match

布尔值

进行社区的精确匹配。

选项

  • 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_list

字符串

社区名称列表(以 CSV 格式)。

exact_match

布尔值

进行社区的精确匹配。

选项

  • false

  • true

local_preference

整数

BGP 本地优先级。

metric

整数

路由度量。

metric_type

字符串

路由度量类型。

选项

  • "类型-1"

  • "类型-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

字典

社区属性。

additive

布尔值

添加到现有社区。

选项

  • false

  • true

delete

布尔值

删除匹配的社区。

选项

  • false

  • true

graceful_shutdown

布尔值

优雅关机。

选项

  • false

  • true

internet

布尔值

Internet 社区

选项

  • false

  • true

list

字符串

社区列表名称。

local_as

布尔值

不要发送到本地 AS 外部。

选项

  • false

  • true

no_advertise

布尔值

不要向任何对等体通告。

选项

  • false

  • true

no_export

布尔值

不要导出到下一个 AS。

选项

  • false

  • true

number

字符串

社区编号(以 CSV 格式)。

graceful_shutdown

布尔值

优雅关机

选项

  • false

  • true

none

布尔值

无社区属性。

选项

  • false

  • true

distance

整数

设置协议无关距离。

evpn

布尔值

向 eBGP 对等体通告时保留下一跳。

选项

  • false

  • true

extcommunity

字典

BGP 扩展社区属性。

lbw

字典

链路带宽值。

aggregate

布尔值

聚合链路带宽。

选项

  • false

  • true

divide

字符串

划分链路带宽。

选项

  • "相等"

  • "比例"

value

字符串

链路带宽扩展社区值。

none

布尔值

无属性。

选项

  • false

  • true

rt

字典

路由目标扩展社区

additive

布尔值

添加到现有社区。

选项

  • false

  • true

delete

布尔值

删除匹配的社区。

选项

  • false

  • true

vpn

字符串

VPN 扩展社区。

soo

字典

站点起源扩展社区。

additive

布尔值

添加到现有社区。

选项

  • false

  • true

delete

布尔值

删除匹配的社区。

选项

  • false

  • true

vpn

字符串

VPN 扩展社区。

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

字符串

路由度量类型。

选项

  • "类型-1"

  • "类型-2"

nexthop

字典

路由下一跳。

max_metric

布尔值

设置 IGP 最大度量值。

选项

  • false

  • true

value

整数

IGP 度量值。

origin

字符串

设置 bgp 原点。

选项

  • "egp"

  • "igp"

  • "incomplete"

segment_index

整数

MPLS 分段路由分段索引。

tag

整数

路由标签

weight

整数

BGP 权重。

source

字典

重命名/复制配置

action

字符串

重命名或复制配置

选项

  • "重命名"

  • "复制"

overwrite

布尔值

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

选项

  • false

  • true

source_map_name

字符串

源路由映射名称。

statement

字符串

语句名称

sub_route_map

字典

子路由映射

invert_result

布尔值

反转子路由映射结果

选项

  • false

  • true

name

字符串

子路由映射名称

route_map

字符串

路由映射名称。

running_config

字符串

此选项仅在 state 为 *parsed* 时使用。

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

已解析的`state`从`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)