cisco.nxos.nxos_bgp_templates 模块 – BGP 模板资源模块。

注意

此模块是 cisco.nxos 集合 (版本 9.2.1) 的一部分。

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

要安装它,请使用: ansible-galaxy collection install cisco.nxos

要在剧本中使用它,请指定: cisco.nxos.nxos_bgp_templates

cisco.nxos 4.2.0 中的新增功能

概要

  • 此模块管理在运行 Cisco NX-OS 的设备上的 BGP 模板。

参数

参数

注释

config

字典

BGP 模板列表。

as_number

字符串

路由器的自治系统编号。

neighbor

列表 / 元素=字典

配置 BGP 对等体模板。

address_family

列表 / 元素=字典

为对等体配置地址族。

advertise_map

字典

指定用于条件通告的路由映射。

exist_map

字符串

条件路由映射,仅当条件中存在前缀时才通告。

non_exist_map

字符串

条件路由映射,仅当条件中不存在前缀时才通告。

route_map

字符串 / 必需

路由映射名称。

advertisement_interval

整数

发送 BGP 路由更新之间的最小间隔。

afi

字符串 / 必需

地址族指示器。

选项

  • "ipv4"

  • "ipv6"

  • "link-state"

  • "l2vpn"

allowas_in

字典

接受 AS 路径中包含我的 AS 的路径。

max_occurences

整数

AS 编号出现的次数,默认为 3。

set

布尔值

激活 allowas-in 属性。

选项

  • false

  • true

as_override

布尔值

发送更新时覆盖匹配的 AS 号。

选项

  • false

  • true

capability

字典

向对等体通告能力。

additional_paths

字典

附加路径能力。

receive

字符串

附加路径接收能力。

选项

  • "enable"

  • "disable"

send

字符串

附加路径发送能力。

选项

  • "enable"

  • "disable"

default_originate

字典

向此对等体发起默认路由。

route_map

字符串

路由映射,用于指定发起默认路由的条件。

set

布尔值

设置 default-originate 属性。

选项

  • false

  • true

disable_peer_as_check

布尔值

禁用在通告时检查对等体 AS 号。

选项

  • false

  • true

filter_list

字典

过滤列表的名称。

inbound

字符串

将策略应用于传入路由。

outbound

字符串

将策略应用于传出路由。

inherit

字典

继承对等体策略模板。

peer_policy

字符串

要继承的对等体策略模板。

maximum_prefix

字典

来自此邻居的最大前缀数。

generate_warning_threshold

整数

生成警告的阈值百分比。

max_prefix_limit

整数

最大前缀限制。

restart_interval

整数

超过限制后重新启动 bgp 连接。

warning_only

布尔值

仅在超过限制时给出警告消息。

选项

  • false

  • true

next_hop_self

字典

将我们的地址设置为 nexthop(非反射)。

all_routes

布尔值

将我们的地址设置为所有路由的 nexthop。

选项

  • false

  • true

set

布尔值

设置 next-hop-self 属性。

选项

  • false

  • true

next_hop_third_party

布尔值

如果可能,计算第三方 nexthop。

选项

  • false

  • true

prefix_list

字典

应用前缀列表。

inbound

字符串

将策略应用于传入路由。

outbound

字符串

将策略应用于传出路由。

route_map

字典

将路由映射应用于邻居。

inbound

字符串

要应用于传入路由的策略名称。

outbound

字符串

要应用于传出路由的策略名称。

route_reflector_client

布尔值

将邻居配置为路由反射器客户端。

选项

  • false

  • true

safi

字符串

子地址族指示器。

选项

  • "unicast"

  • "multicast"

  • "mvpn"

  • "evpn"

send_community

字符串

将社区属性发送给此邻居。

选项

  • "standard"

  • "extended"

  • "both"

soft_reconfiguration_inbound

字典

软重新配置。

always

布尔值

始终执行传入软重新配置。

选项

  • false

  • true

set

布尔值

设置 soft-reconfiguration inbound 属性。

选项

  • false

  • true

soo

字符串

指定源站点 extcommunity。

suppress_inactive

布尔值

仅向对等体通告活动路由。

选项

  • false

  • true

unsuppress_map

字符串

路由映射,用于选择性地取消抑制被抑制的路由。

weight

整数

设置来自此邻居的路由的默认权重。

bfd

字典

邻居的双向快速检测。

multihop

字典

多跳会话。

interval

字典

配置 BFD 会话间隔参数。

min_rx_interval

整数 / 必需

最小 RX 间隔。

multiplier

整数 / 必需

检测乘数。

tx_interval

整数 / 必需

TX 间隔(毫秒)。

set

布尔值

设置 BFD 多跳。

选项

  • false

  • true

set

布尔值

为此邻居设置 BFD。

选项

  • false

  • true

singlehop

布尔值

单跳会话。

选项

  • false

  • true

bmp_activate_server

整数

指定用于激活对等体 BMP 监控的服务器 ID。

capability

字典

能力。

suppress_4_byte_as

布尔值

抑制 4 字节 AS 能力。

选项

  • false

  • true

description

字符串

邻居特定的描述。

disable_connected_check

布尔值

禁用直接连接对等体的检查。

选项

  • false

  • true

dont_capability_negotiate

布尔值

不要与此邻居协商能力。

选项

  • false

  • true

dscp

字符串

设置TCP传输的DSCP值。

dynamic_capability

布尔值

动态能力

选项

  • false

  • true

ebgp_multihop

整数

指定远程对端的Multihop TTL。

graceful_shutdown

字典

此邻居的优雅关机。

activate

字典

发送优雅关机社区。

route_map

字符串

应用路由映射来修改出站属性。

set

布尔值

设置activate。

选项

  • false

  • true

inherit

字典

继承模板。

peer_session

字符串

要继承的对等会话模板。

local_as

字符串

指定eBGP邻居的本地AS号。

log_neighbor_changes

字典

记录邻居上下线事件的消息。

disable

布尔值

禁用邻居上下线事件的日志记录。

选项

  • false

  • true

set

布尔值

设置log-neighbor-changes。

选项

  • false

  • true

low_memory

字典

低内存情况下的行为。

exempt

布尔值

内存压力下不关闭此对等端。

选项

  • false

  • true

name

字符串

BGP对等端模板的名称。

password

字典

为邻居配置密码。

encryption

整数

0 指定未加密的邻居密码。

3 指定接下来将使用3DES加密的邻居密码。

7 指定接下来将使用Cisco 7型加密的邻居密码。

key

字符串

身份验证密码。

path_attribute

列表 / 元素=字典

BGP路径属性可选过滤。

action

字符串

操作。

选项

  • "discard"

  • "treat-as-withdraw"

range

字典

路径属性范围。

end

整数

路径属性范围结束值。

start

整数

路径属性范围起始值。

type

整数

路径属性类型

remote_as

字符串

指定邻居的自治系统编号。

remove_private_as

字典

从出站更新中删除私有AS号。

all

布尔值

全部。

选项

  • false

  • true

replace_as

布尔值

替换。

选项

  • false

  • true

set

布尔值

删除私有AS。

选项

  • false

  • true

shutdown

布尔值

管理性地关闭此邻居。

选项

  • false

  • true

timers

字典

配置keepalive和hold定时器。

holdtime

整数

保持时间(秒)。

keepalive

整数

Keepalive间隔(秒)。

transport

字典

BGP传输连接。

connection_mode

字典

指定连接类型。

passive

布尔值

仅允许被动连接设置。

选项

  • false

  • true

ttl_security

字典

启用TTL安全机制。

hops

整数

指定远程对端的跳数。

update_source

字符串

指定BGP会话和更新的源。

running_config

字符串

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

此选项的值应为通过执行命令 **show running-config bgp | section ‘template’** 从NX-OS设备接收到的输出。

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

state

字符串

配置应保留的状态。

有关更多详细信息,请参阅示例。

选项

  • "merged" ← (默认)

  • "replaced"

  • "overridden"

  • "deleted"

  • "parsed"

  • "gathered"

  • "rendered"

注释

注意

  • 在NX-OS 9.3.6上进行了测试。

  • 不支持Cisco MDS

  • 此模块可与连接 network_clihttpapi 配合使用。

示例

# Using merged

# Before state:
# --------------
#
# nxos9k# show running-config | section "^router bgp"
# nxos9k#

- name: Merge the provided configuration with the existing running configuration
  cisco.nxos.nxos_bgp_templates:
    config:
      as_number: 65536
      neighbor:
        - name: neighbor_tmplt_1
          address_family:
            - afi: ipv4
              safi: unicast
              advertise_map:
                route_map: rmap1
                non_exist_map: nemap1
              advertisement_interval: 60
              disable_peer_as_check: true
          bmp_activate_server: 2
          capability:
            suppress_4_byte_as: true
          description: Test_BGP_PEER_TEMPLATE_1
          local_as: 65536
          remote_as: 65001

        - name: neighbor_tmplt_2
          description: Test_BGP_PEER_TEMPLATE_2
          address_family:
            - afi: ipv4
              safi: multicast
              advertise_map:
                route_map: rmap1
                exist_map: emap1
              as_override: true
              filter_list:
                inbound: flist1
                outbound: flist2
          inherit:
            peer_session: psession1
          timers:
            holdtime: 100
            keepalive: 45
# Task Output:
# ------------
# before: {}
#
# commands:
#   - router bgp 65536
#   - template peer neighbor_tmplt_1
#   - bmp-activate-server 2
#   - capability suppress 4-byte-as
#   - description Test_BGP_PEER_TEMPLATE_1
#   - local-as 65536
#   - remote-as 65001
#   - address-family ipv4 unicast
#   - advertise-map rmap1 non-exist-map nemap1
#   - advertisement-interval 60
#   - disable-peer-as-check
#   - template peer neighbor_tmplt_2
#   - description Test_BGP_PEER_TEMPLATE_2
#   - inherit peer-session psession1
#   - timers 45 100
#   - address-family ipv4 multicast
#   - advertise-map rmap1 exist-map emap1
#   - as-override
#   - filter-list flist1 in
#   - filter-list flist2 out
#
# after:
#   as_number: "65536"
#   neighbor:
#     - name: neighbor_tmplt_1
#       address_family:
#         - afi: ipv4
#           safi: unicast
#           advertise_map:
#             non_exist_map: nemap1
#             route_map: rmap1
#           advertisement_interval: 60
#           disable_peer_as_check: true
#       bmp_activate_server: 2
#       capability:
#         suppress_4_byte_as: true
#       description: Test_BGP_PEER_TEMPLATE_1
#       local_as: "65536"
#       remote_as: "65001"
#
#     - name: neighbor_tmplt_2
#       description: Test_BGP_PEER_TEMPLATE_2
#       address_family:
#         - afi: ipv4
#           safi: multicast
#           advertise_map:
#             exist_map: emap1
#             route_map: rmap1
#           as_override: true
#           filter_list:
#             inbound: flist1
#             outbound: flist2
#       inherit:
#         peer_session: psession1
#       timers:
#         holdtime: 100
#         keepalive: 45

# After state:
# --------------
#
# nxos9k# show running-config | section "^router bgp"
# router bgp 65536
#   template peer neighbor_tmplt_1
#     capability suppress 4-byte-as
#     bmp-activate-server 2
#     description Test_BGP_PEER_TEMPLATE_1
#     local-as 65536
#     remote-as 65001
#     address-family ipv4 unicast
#      advertise-map rmap1 non-exist-map nemap1
#      advertisement-interval 60
#      disable-peer-as-check
#   template peer neighbor_tmplt_2
#     description Test_BGP_PEER_TEMPLATE_2
#     inherit peer-session psession1
#     timers 45 100
#     address-family ipv4 multicast
#      advertise-map rmap1 exist-map emap1
#      as-override
#      filter-list flist1 in
#      filter-list flist2 out

# Using replaced

# Before state:
# -------------
#
# nxos9k# show running-config | section "^router bgp"
# router bgp 65536
#   template peer neighbor_tmplt_1
#     capability suppress 4-byte-as
#     description Test_BGP_PEER_TEMPLATE_1
#     bmp-activate-server 2
#     local-as 65536
#     remote-as 65001
#     address-family ipv4 unicast
#      advertise-map rmap1 non-exist-map nemap1
#      advertisement-interval 60
#      disable-peer-as-check
#   template peer neighbor_tmplt_2
#     description Test_BGP_PEER_TEMPLATE_2
#     inherit peer-session psession1
#     timers 45 100
#     address-family ipv4 multicast
#      advertise-map rmap1 exist-map emap1
#      as-override
#      filter-list flist1 in
#      filter-list flist2 out

- name: Replace BGP templates configuration with provided configuration
  cisco.nxos.nxos_bgp_templates:
    config:
      as_number: 65536
      neighbor:
        - name: neighbor_tmplt_1
          address_family:
            - afi: ipv4
              safi: unicast
              advertise_map:
                route_map: rmap1
                non_exist_map: nemap1
              advertisement_interval: 60
              disable_peer_as_check: true
          inherit:
            peer_session: psession1
          description: Test_BGP_PEER_TEMPLATE_1
          local_as: 65537
    state: replaced

# Task output:
# ------------
#
# before:
#   as_number: "65536"
#   neighbor:
#     - name: neighbor_tmplt_1
#       address_family:
#         - afi: ipv4
#           safi: unicast
#           advertise_map:
#             non_exist_map: nemap1
#             route_map: rmap1
#           advertisement_interval: 60
#           disable_peer_as_check: true
#       bmp_activate_server: 2
#       capability:
#         suppress_4_byte_as: true
#       description: Test_BGP_PEER_TEMPLATE_1
#       local_as: "65536"
#       remote_as: "65001"
#
#     - name: neighbor_tmplt_2
#       description: Test_BGP_PEER_TEMPLATE_2
#       address_family:
#         - afi: ipv4
#           safi: multicast
#           advertise_map:
#             exist_map: emap1
#             route_map: rmap1
#           as_override: true
#           filter_list:
#             inbound: flist1
#             outbound: flist2
#       inherit:
#         peer_session: psession1
#       timers:
#         holdtime: 100
#         keepalive: 45
#
# commands:
#   - router bgp 65536
#   - template peer neighbor_tmplt_1
#   - no bmp-activate-server 2
#   - no capability suppress 4-byte-as
#   - inherit peer-session psession1
#   - local-as 65537
#   - no remote-as 65001
#
# after:
#   as_number: "65536"
#   neighbor:
#     - name: neighbor_tmplt_1
#       address_family:
#         - afi: ipv4
#           safi: unicast
#           advertise_map:
#             non_exist_map: nemap1
#             route_map: rmap1
#           advertisement_interval: 60
#           disable_peer_as_check: true
#       description: Test_BGP_PEER_TEMPLATE_1
#       inherit:
#         peer_session: psession1
#       local_as: "65537"
#
#     - name: neighbor_tmplt_2
#       description: Test_BGP_PEER_TEMPLATE_2
#       address_family:
#         - afi: ipv4
#           safi: multicast
#           advertise_map:
#             exist_map: emap1
#             route_map: rmap1
#           as_override: true
#           filter_list:
#             inbound: flist1
#             outbound: flist2
#       inherit:
#         peer_session: psession1
#       timers:
#         holdtime: 100
#         keepalive: 45

# After state:
# ------------
#
# nxos9k# show running-config | section "^router bgp"
# router bgp 65536
#   template peer neighbor_tmplt_1
#     inherit peer-session psession1
#     description Test_BGP_PEER_TEMPLATE_1
#     local-as 65537
#     address-family ipv4 unicast
#      advertise-map rmap1 non-exist-map nemap1
#      advertisement-interval 60
#      disable-peer-as-check
#   template peer neighbor_tmplt_2
#     description Test_BGP_PEER_TEMPLATE_2
#     inherit peer-session psession1
#     bmp-activate-server 2
#     timers 45 100
#     address-family ipv4 multicast
#      advertise-map rmap1 exist-map emap1
#      as-override
#      filter-list flist1 in
#      filter-list flist2 out

# Using overridden
#
# Before state:
# -------------
#
# nxos9k# show running-config | section "^router bgp"
# router bgp 65536
#   template peer neighbor_tmplt_1
#     capability suppress 4-byte-as
#     description Test_BGP_PEER_TEMPLATE_1
#     bmp-activate-server 2
#     local-as 65536
#     remote-as 65001
#     address-family ipv4 unicast
#      advertise-map rmap1 non-exist-map nemap1
#      advertisement-interval 60
#      disable-peer-as-check
#   template peer neighbor_tmplt_2
#     description Test_BGP_PEER_TEMPLATE_2
#     inherit peer-session psession1
#     timers 45 100
#     address-family ipv4 multicast
#      advertise-map rmap1 exist-map emap1
#      as-override
#      filter-list flist1 in
#      filter-list flist2 out

- name: Override BGP templates configuration with provided configuration
  cisco.nxos.nxos_bgp_templates:
    config:
      as_number: 65536
      neighbor:
        - name: neighbor_tmplt_1
          address_family:
            - afi: ipv4
              safi: unicast
              advertise_map:
                route_map: rmap1
                non_exist_map: nemap1
              advertisement_interval: 60
              disable_peer_as_check: true
          inherit:
            peer_session: psession1
          description: Test_BGP_PEER_TEMPLATE_1
          local_as: 65537
    state: overridden

# Task output:
# ------------
#
# before:
#   as_number: "65536"
#   neighbor:
#     - name: neighbor_tmplt_1
#       address_family:
#         - afi: ipv4
#           safi: unicast
#           advertise_map:
#             non_exist_map: nemap1
#             route_map: rmap1
#           advertisement_interval: 60
#           disable_peer_as_check: true
#       bmp_activate_server: 2
#       capability:
#         suppress_4_byte_as: true
#       description: Test_BGP_PEER_TEMPLATE_1
#       local_as: "65536"
#       remote_as: "65001"
#
#     - name: neighbor_tmplt_2
#       description: Test_BGP_PEER_TEMPLATE_2
#       address_family:
#         - afi: ipv4
#           safi: multicast
#           advertise_map:
#             exist_map: emap1
#             route_map: rmap1
#           as_override: true
#           filter_list:
#             inbound: flist1
#             outbound: flist2
#       inherit:
#         peer_session: psession1
#       timers:
#         holdtime: 100
#         keepalive: 45
#
# commands:
#   - router bgp 65536
#   - template peer neighbor_tmplt_1
#   - no bmp-activate-server 2
#   - no capability suppress 4-byte-as
#   - inherit peer-session psession1
#   - local-as 65537
#   - no remote-as 65001
#   - no template peer neighbor_tmplt_2
#
# after:
#   as_number: "65536"
#   neighbor:
#     - name: neighbor_tmplt_1
#       address_family:
#         - afi: ipv4
#           safi: unicast
#           advertise_map:
#             non_exist_map: nemap1
#             route_map: rmap1
#           advertisement_interval: 60
#           disable_peer_as_check: true
#       description: Test_BGP_PEER_TEMPLATE_1
#       inherit:
#         peer_session: psession1
#       local_as: "65537"

# After state:
# ------------
#
# nxos9k# show running-config | section "^router bgp"
# router bgp 65536
#   template peer neighbor_tmplt_1
#     inherit peer-session psession1
#     description Test_BGP_PEER_TEMPLATE_1
#     local-as 65537
#     address-family ipv4 unicast
#      advertise-map rmap1 non-exist-map nemap1
#      advertisement-interval 60
#      disable-peer-as-check

# Using deleted

# Before state:
# --------------
#
# nxos9k# show running-config | section "^router bgp"
# router bgp 65536
#   template peer neighbor_tmplt_1
#     capability suppress 4-byte-as
#     description Test_BGP_PEER_TEMPLATE_1
#     bmp-activate-server 2
#     local-as 65536
#     remote-as 65001
#     address-family ipv4 unicast
#      advertise-map rmap1 non-exist-map nemap1
#      advertisement-interval 60
#      disable-peer-as-check
#   template peer neighbor_tmplt_2
#     description Test_BGP_PEER_TEMPLATE_2
#     inherit peer-session psession1
#     timers 45 100
#     address-family ipv4 multicast
#      advertise-map rmap1 exist-map emap1
#      as-override
#      filter-list flist1 in
#      filter-list flist2 out

- name: Delete BGP configs handled by this module
  cisco.nxos.nxos_bgp_templates:
    state: deleted

# Task output:
# ------------
#
# before:
#   as_number: "65536"
#   neighbor:
#     - name: neighbor_tmplt_1
#       address_family:
#         - afi: ipv4
#           safi: unicast
#           advertise_map:
#             non_exist_map: nemap1
#             route_map: rmap1
#           advertisement_interval: 60
#           disable_peer_as_check: true
#       bmp_activate_server: 2
#       capability:
#         suppress_4_byte_as: true
#       description: Test_BGP_PEER_TEMPLATE_1
#       local_as: "65536"
#       remote_as: "65001"
#
#     - name: neighbor_tmplt_2
#       description: Test_BGP_PEER_TEMPLATE_2
#       address_family:
#         - afi: ipv4
#           safi: multicast
#           advertise_map:
#             exist_map: emap1
#             route_map: rmap1
#           as_override: true
#           filter_list:
#             inbound: flist1
#             outbound: flist2
#       inherit:
#         peer_session: psession1
#       timers:
#         holdtime: 100
#         keepalive: 45
#
# commands:
#   - router bgp 65536
#   - no template peer neighbor_tmplt_1
#   - no template peer neighbor_tmplt_2
#
# after: {}

# After state:
# -------------
# nxos9k# show running-config | section "^router bgp"
# nxos9k#

返回值

常见的返回值已在此处记录 此处,以下是此模块特有的字段

描述

after

字典

模块执行后的结果配置。

返回:已更改时

示例: "This output will always be in the same format as the module argspec.\n"

before

字典

模块执行之前的配置。

返回:statemergedreplacedoverriddendeletedpurged

示例: "This output will always be in the same format as the module argspec.\n"

commands

列表 / 元素=字符串

推送到远程设备的命令集。

返回:statemergedreplacedoverriddendeletedpurged

示例: ["router bgp 65536", "template peer neighbor_tmplt_1", "no bmp-activate-server 2", "no capability suppress 4-byte-as", "inherit peer-session psession1", "local-as 65537", "no remote-as 65001", "no template peer neighbor_tmplt_2"]

gathered

字典

从远程设备收集的关于网络资源的事实,以结构化数据的形式呈现。

返回:stategathered

示例: "This output will always be in the same format as the module argspec.\n"

parsed

字典

根据模块argspec将 *running_config* 选项中提供的设备原生配置解析为结构化数据。

返回:stateparsed

示例: "This output will always be in the same format as the module argspec.\n"

rendered

列表 / 元素=字符串

以设备原生格式(离线)呈现的任务中提供的配置。

返回:staterendered

示例: ["router bgp 65536", "template peer neighbor_tmplt_1", "bmp-activate-server 2", "no capability suppress 4-byte-as", "no template peer neighbor_tmplt_2"]

作者

  • Nilashish Chakraborty (@NilashishC)