cisco.nxos.nxos_bgp_global 模块 – BGP 全局资源模块。
注意
此模块是 cisco.nxos 集合 (版本 9.2.1) 的一部分。
如果您使用的是 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install cisco.nxos。
要在 playbook 中使用它,请指定:cisco.nxos.nxos_bgp_global。
cisco.nxos 1.4.0 中的新增功能
概要
- 此模块管理在运行 Cisco NX-OS 的设备上的全局 BGP 配置。 
参数
| 参数 | 注释 | 
|---|---|
| BGP 进程配置列表。 | |
| 配置关联组。 | |
| 关联组 ID。 | |
| 路由器的自治系统编号。 | |
| 定义默认最佳路径选择算法。 | |
| 比较来自不同 AS 的路径上的 MED。 选项 
 | |
| AS 路径。 | |
| 在最佳路径选择期间忽略 AS 路径。 选项 
 | |
| 选择多路径时放宽 AS 路径限制。 选项 
 | |
| 当可用路径多于 max path 配置时,使用 neighborid 作为决定因素。 选项 
 | |
| 比较相同 EBGP 路径的路由器 ID。 选项 
 | |
| 在最佳路径选择中忽略成本社区。 选项 
 | |
| 在最佳路径选择期间忽略下一跳的 IGP 度量。 选项 
 | |
| MED | |
| 仅比较来自联盟内部发起的路径的 MED。 选项 
 | |
| 将缺少的 MED 视为最高的 MED。 选项 
 | |
| 并非总是在来自同一 AS 的路径中选择最佳 MED 路径。 选项 
 | |
| 配置路由反射器集群 ID。 | |
| AS 联盟参数。 | |
| 设置路由域联盟 AS。 | |
| BGP 联盟中的对等 AS。 | |
| 禁用对等体的出站策略的批量评估。 | |
| IPv4 地址族设置。 | |
| 要应用的前缀列表的名称。 | |
| IPv6 地址族设置。 | |
| 要应用的前缀列表的名称。 | |
| 基于下一跳的批量处理。 选项 
 | |
| 设置策略批量处理。 选项 
 | |
| 设置 MED 更改的抑制间隔。 | |
| 强制邻居 AS 是 AS-PATH 属性中的第一个 AS (EBGP)。 选项 
 | |
| 启用 BGP 增强的错误处理。 选项 
 | |
| 结构站点来源。 | |
| 如果与直接连接的 BGP 对等体的链路断开,则立即重置会话。 选项 
 | |
| 在受控重启时刷新 RIB 中的路由。 选项 
 | |
| 配置优雅重启功能。 | |
| 配置优雅重启辅助模式功能。 选项 
 | |
| 向对等体通告的重启最大时间。 | |
| 启用优雅重启。 选项 
 | |
| 保留重启对等体的陈旧路由的最大时间。 | |
| BGP 协议的优雅关机。 | |
| 在所有路由上发送优雅关机社区。 | |
| 应用路由映射以修改出站属性。 | |
| 激活优雅关机。 选项 
 | |
| 降低携带优雅关机社区的路由的优先级。 选项 
 | |
| 从 BGP 角度隔离此路由器。 | |
| 撤回本地和远程 BGP 路由。 选项 
 | |
| 撤回远程 BGP 路由以隔离此路由器。 选项 
 | |
| 记录邻居启动/关闭事件的消息。 选项 
 | |
| 允许来自 EBGP 邻居的 AS-PATH 属性,对 AS 数量进行限制。 | |
| 处理 BGP 邻居关闭事件,原因各不相同。 | |
| 加速邻居的 IP/IPv6 邻接的硬件更新。 选项 
 | |
| 配置 BGP 邻居。 | |
| 邻居的双向快速检测。 | |
| 多跳会话。 | |
| 配置 BFD 会话间隔参数。 | |
| 最小 RX 间隔。 | |
| 检测乘数。 | |
| TX 间隔(毫秒)。 | |
| 设置 BFD 多跳。 选项 
 | |
| 为该邻居设置 BFD。 选项 
 | |
| 单跳会话。 选项 
 | |
| 指定服务器 ID 以激活对等体的 BMP 监控。 | |
| 功能。 | |
| 抑制 4 字节 AS 功能。 选项 
 | |
| 邻居特定的描述。 | |
| 禁用对直接连接的对等体的检查。 选项 
 | |
| 不要与该邻居协商能力。 选项 
 | |
| 设置TCP传输的dscp值。 | |
| 动态能力 选项 
 | |
| 指定远程对端的跳数TTL。 | |
| 此邻居的优雅关机。 | |
| 发送优雅关机社区。 | |
| 应用路由映射以修改出站属性。 | |
| 设置激活。 选项 
 | |
| 继承模板。 | |
| 要继承的对等体模板。 | |
| 要继承的对等会话模板。 | |
| 指定eBGP邻居的本地AS号。 已弃用,请改用local_as_config,事实信息将始终作为local_as_config as_number的一部分呈现local_as信息 此选项已弃用,并将在2027-01-01之后的发行版中删除。 | |
| 本地自治系统编号选项。 | |
| 设置指定eBGP邻居的本地AS号。 | |
| 使用本地AS号或真实AS号连接。 选项 
 | |
| 不要将本地AS号添加到来自eBGP邻居的更新中。 选项 
 | |
| 仅将本地AS号添加到发送到eBGP邻居的更新中。 选项 
 | |
| 邻居上下事件的日志消息。 | |
| 禁用邻居上下事件的日志记录。 选项 
 | |
| 设置log-neighbor-changes。 选项 
 | |
| 低内存情况下的行为。 | |
| 内存压力下不关闭此对等体。 选项 
 | |
| 邻居或接口的IP地址/前缀。 | |
| 配置关联组。 | |
| 关联组 ID。 | |
| 为邻居配置密码。 | |
| 0 指定未加密的邻居密码。 3 指定将随后使用3DES加密的邻居密码。 7 指定将随后使用Cisco类型7加密的邻居密码。 | |
| 身份验证密码。 | |
| BGP路径属性可选过滤。 | |
| 动作。 选项 
 | |
| 路径属性范围。 | |
| 路径属性范围结束值。 | |
| 路径属性范围起始值。 | |
| 路径属性类型 | |
| 邻居方向 选项 
 | |
| 指定邻居的自治系统编号。 | |
| 与前缀对等AS号匹配的路由映射。 | |
| 从出站更新中删除私有AS号。 | |
| 全部。 选项 
 | |
| 替换。 选项 
 | |
| 删除私有AS。 选项 
 | |
| 管理式关闭此邻居。 选项 
 | |
| 配置保活和保持计时器。 | |
| 保持时间(秒)。 | |
| 保活间隔(秒)。 | |
| BGP传输连接。 | |
| 指定连接类型。 | |
| 仅允许被动连接设置。 选项 
 | |
| 启用TTL安全机制。 | |
| 指定远程对端的跳数。 | |
| 指定BGP会话和更新的源。 | |
| 下一跳解析选项。 | |
| 禁止使用默认路由进行下一跳地址解析。 选项 
 | |
| vxlan多站点边界网关的辅助路由区分器。 | |
| 为所有VRF和L2VNI生成辅助RD。 选项 
 | |
| 指定ID的2字节值。 | |
| 配置连接重新连接间隔。 | |
| 指定用作路由器ID的IP地址。 | |
| 管理式关闭BGP协议。 选项 
 | |
| 仅向对等体通告已在硬件中编程的路由。 选项 
 | |
| 配置与BGP相关的计时器。 | |
| 配置重启后第一个最佳路径的超时。 | |
| 配置update-delay-always选项。 选项 
 | |
| 最佳路径超时(秒)。 | |
| 配置不同的BGP保活和保持时间。 | |
| 保持时间(秒)。 | |
| 保活间隔(秒)。 | |
| 前缀对等体超时(秒)。 | |
| 配置前缀对等体的等待计时器。 | |
| 虚拟路由器上下文配置。 | |
| 配置allocate-index。 | |
| 定义默认最佳路径选择算法。 | |
| 比较来自不同 AS 的路径上的 MED。 选项 
 | |
| AS 路径。 | |
| 在最佳路径选择期间忽略 AS 路径。 选项 
 | |
| 选择多路径时放宽 AS 路径限制。 选项 
 | |
| 当可用路径多于 max path 配置时,使用 neighborid 作为决定因素。 选项 
 | |
| 比较相同 EBGP 路径的路由器 ID。 选项 
 | |
| 在最佳路径选择中忽略成本社区。 选项 
 | |
| 在最佳路径选择期间忽略下一跳的 IGP 度量。 选项 
 | |
| MED | |
| 仅比较来自联盟内部发起的路径的 MED。 选项 
 | |
| 将缺少的 MED 视为最高的 MED。 选项 
 | |
| 并非总是在来自同一 AS 的路径中选择最佳 MED 路径。 选项 
 | |
| 配置路由反射器集群 ID。 | |
| AS 联盟参数。 | |
| 设置路由域联盟 AS。 | |
| BGP 联盟中的对等 AS。 | |
| 配置优雅重启功能。 | |
| 配置优雅重启辅助模式功能。 选项 
 | |
| 向对等体通告的重启最大时间。 | |
| 启用优雅重启。 选项 
 | |
| 保留重启对等体的陈旧路由的最大时间。 | |
| 指定此VRF的本地AS。 | |
| 记录邻居启动/关闭事件的消息。 选项 
 | |
| 允许来自 EBGP 邻居的 AS-PATH 属性,对 AS 数量进行限制。 | |
| 处理 BGP 邻居关闭事件,原因各不相同。 | |
| 加速邻居的 IP/IPv6 邻接的硬件更新。 选项 
 | |
| 配置 BGP 邻居。 | |
| 邻居的双向快速检测。 | |
| 多跳会话。 | |
| 配置 BFD 会话间隔参数。 | |
| 最小 RX 间隔。 | |
| 检测乘数。 | |
| TX 间隔(毫秒)。 | |
| 设置 BFD 多跳。 选项 
 | |
| 为该邻居设置 BFD。 选项 
 | |
| 单跳会话。 选项 
 | |
| 指定服务器 ID 以激活对等体的 BMP 监控。 | |
| 功能。 | |
| 抑制 4 字节 AS 功能。 选项 
 | |
| 邻居特定的描述。 | |
| 禁用对直接连接的对等体的检查。 选项 
 | |
| 不要与该邻居协商能力。 选项 
 | |
| 设置TCP传输的dscp值。 | |
| 动态能力 选项 
 | |
| 指定远程对端的跳数TTL。 | |
| 此邻居的优雅关机。 | |
| 发送优雅关机社区。 | |
| 应用路由映射以修改出站属性。 | |
| 设置激活。 选项 
 | |
| 继承模板。 | |
| 要继承的对等体模板。 | |
| 要继承的对等会话模板。 | |
| 指定eBGP邻居的本地AS号。 已弃用,请改用local_as_config,事实信息将始终作为local_as_config as_number的一部分呈现local_as信息 此选项已弃用,并将在2027-01-01之后的发行版中删除。 | |
| 本地自治系统编号选项。 | |
| 设置指定eBGP邻居的本地AS号。 | |
| 使用本地AS号或真实AS号连接。 选项 
 | |
| 不要将本地AS号添加到来自eBGP邻居的更新中。 选项 
 | |
| 仅将本地AS号添加到发送到eBGP邻居的更新中。 选项 
 | |
| 邻居上下事件的日志消息。 | |
| 禁用邻居上下事件的日志记录。 选项 
 | |
| 设置log-neighbor-changes。 选项 
 | |
| 低内存情况下的行为。 | |
| 内存压力下不关闭此对等体。 选项 
 | |
| 邻居或接口的IP地址/前缀。 | |
| 配置关联组。 | |
| 关联组 ID。 | |
| 为邻居配置密码。 | |
| 0 指定未加密的邻居密码。 3 指定将随后使用3DES加密的邻居密码。 7 指定将随后使用Cisco类型7加密的邻居密码。 | |
| 身份验证密码。 | |
| BGP路径属性可选过滤。 | |
| 动作。 选项 
 | |
| 路径属性范围。 | |
| 路径属性范围结束值。 | |
| 路径属性范围起始值。 | |
| 路径属性类型 | |
| 邻居方向 选项 
 | |
| 指定邻居的自治系统编号。 | |
| 与前缀对等AS号匹配的路由映射。 | |
| 从出站更新中删除私有AS号。 | |
| 全部。 选项 
 | |
| 替换。 选项 
 | |
| 删除私有AS。 选项 
 | |
| 管理式关闭此邻居。 选项 
 | |
| 配置保活和保持计时器。 | |
| 保持时间(秒)。 | |
| 保活间隔(秒)。 | |
| BGP传输连接。 | |
| 指定连接类型。 | |
| 仅允许被动连接设置。 选项 
 | |
| 启用TTL安全机制。 | |
| 指定远程对端的跳数。 | |
| 指定BGP会话和更新的源。 | |
| 配置连接重新连接间隔。 | |
| 指定用作路由器ID的IP地址。 | |
| 配置与BGP相关的计时器。 | |
| 配置重启后第一个最佳路径的超时。 | |
| 配置update-delay-always选项。 选项 
 | |
| 最佳路径超时(秒)。 | |
| 配置不同的BGP保活和保持时间。 | |
| 保持时间(秒)。 | |
| 保活间隔(秒)。 | |
| 前缀对等体超时(秒)。 | |
| 配置前缀对等体的等待计时器。 | |
| VRF名称。 | |
| 此选项仅与状态parsed一起使用。 此选项的值应为通过执行命令show running-config | section ‘^router bgp’从NX-OS设备接收到的输出。 状态parsed从 | |
| 配置应保留到的状态。 状态purged将从目标设备中删除所有BGP配置。谨慎使用此状态。 状态deleted仅删除此模块管理的BGP属性,不会完全否定BGP进程。从而保留BGP上下文下的地址族相关配置。 如果在要删除的邻居或VRF上下文中存在地址族配置行,则运行状态deleted和replaced将导致错误。请使用cisco.nxos.nxos_bgp_af或cisco.nxos.nxos_bgp_neighbor_af模块进行之前的清理。 如果BGP已配置为与任务中提供的ASN不同的ASN,则状态 对于此模块,状态 有关更多详细信息,请参阅示例。 选项 
 | 
注释
注意
- 针对NX-OS 9.3.6进行了测试。 
- 不支持Cisco MDS 
- 此模块适用于连接 - network_cli和- httpapi。
示例
# Using merged
# Before state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# Nexus9000v#
- name: Merge the provided configuration with the existing running configuration
  cisco.nxos.nxos_bgp_global:
    config:
      as_number: 65563
      router_id: 192.168.1.1
      bestpath:
        as_path:
          multipath_relax: true
        compare_neighborid: true
        cost_community_ignore: true
      confederation:
        identifier: 42
        peers:
          - 65020
          - 65030
          - 65040
      log_neighbor_changes: true
      maxas_limit: 20
      neighbors:
        - neighbor_address: 192.168.1.100
          neighbor_affinity_group:
            group_id: 160
          bmp_activate_server: 1
          remote_as: 65563
          description: NBR-1
          low_memory:
            exempt: true
        - neighbor_address: 192.168.1.101
          remote_as: 65563
          password:
            encryption: 7
            key: 12090404011C03162E
      neighbor_down:
        fib_accelerate: true
      vrfs:
        - vrf: site-1
          allocate_index: 5000
          local_as: 200
          log_neighbor_changes: true
          neighbors:
            - neighbor_address: 198.51.100.1
              description: site-1-nbr-1
              password:
                encryption: 3
                key: 13D4D3549493D2877B1DC116EE27A6BE
              remote_as: 65562
            - neighbor_address: 198.51.100.2
              remote_as: 65562
              description: site-1-nbr-2
        - vrf: site-2
          local_as: 300
          log_neighbor_changes: true
          neighbors:
            - neighbor_address: 203.0.113.2
              description: site-2-nbr-1
              password:
                encryption: 3
                key: AF92F4C16A0A0EC5BDF56CF58BC030F6
              remote_as: 65568
          neighbor_down:
            fib_accelerate: true
# Task output:
# ------------
# before: {}
#
# commands:
#  - router bgp 65563
#  - bestpath as-path multipath-relax
#  - bestpath compare-neighborid
#  - bestpath cost-community ignore
#  - confederation identifier 42
#  - log-neighbor-changes
#  - maxas-limit 20
#  - neighbor-down fib-accelerate
#  - router-id 192.168.1.1
#  - confederation peers 65020 65030 65040
#  - neighbor 192.168.1.100
#  - remote-as 65563
#  - affinity-group 160
#  - bmp-activate-server 1
#  - description NBR-1
#  - low-memory exempt
#  - neighbor 192.168.1.101
#  - remote-as 65563
#  - password 7 12090404011C03162E
#  - vrf site-1
#  - allocate-index 5000
#  - local-as 200
#  - log-neighbor-changes
#  - neighbor 198.51.100.1
#  - remote-as 65562
#  - description site-1-nbr-1
#  - password 3 13D4D3549493D2877B1DC116EE27A6BE
#  - neighbor 198.51.100.2
#  - remote-as 65562
#  - description site-1-nbr-2
#  - vrf site-2
#  - local-as 300
#  - log-neighbor-changes
#  - neighbor-down fib-accelerate
#  - neighbor 203.0.113.2
#  - remote-as 65568
#  - description site-2-nbr-1
#  - password 3 AF92F4C16A0A0EC5BDF56CF58BC030F6
#
# after:
#    as_number: '65563'
#    bestpath:
#      as_path:
#        multipath_relax: true
#      compare_neighborid: true
#      cost_community_ignore: true
#    confederation:
#      identifier: '42'
#      peers:
#      - '65020'
#      - '65030'
#      - '65040'
#    log_neighbor_changes: true
#    maxas_limit: 20
#    neighbor_down:
#      fib_accelerate: true
#    neighbors:
#    - bmp_activate_server: 1
#      description: NBR-1
#      low_memory:
#        exempt: true
#      neighbor_address: 192.168.1.100
#      neighbor_affinity_group:
#        group_id: 160
#      remote_as: '65563'
#    - neighbor_address: 192.168.1.101
#      password:
#        encryption: 7
#        key: 12090404011C03162E
#      remote_as: '65563'
#    router_id: 192.168.1.1
#    vrfs:
#    - allocate_index: 5000
#      local_as: '200'
#      log_neighbor_changes: true
#      neighbors:
#      - description: site-1-nbr-1
#        neighbor_address: 198.51.100.1
#        password:
#          encryption: 3
#          key: 13D4D3549493D2877B1DC116EE27A6BE
#        remote_as: '65562'
#      - description: site-1-nbr-2
#        neighbor_address: 198.51.100.2
#        remote_as: '65562'
#      vrf: site-1
#    - local_as: '300'
#      log_neighbor_changes: true
#      neighbor_down:
#        fib_accelerate: true
#      neighbors:
#      - description: site-2-nbr-1
#        neighbor_address: 203.0.113.2
#        password:
#          encryption: 3
#          key: AF92F4C16A0A0EC5BDF56CF58BC030F6
#        remote_as: '65568'
#      vrf: site-2
# After state:
# ------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65563
#   router-id 192.168.1.1
#   confederation identifier 42
#   confederation peers 65020 65030 65040
#   bestpath as-path multipath-relax
#   bestpath cost-community ignore
#   bestpath compare-neighborid
#   neighbor-down fib-accelerate
#   maxas-limit 20
#   log-neighbor-changes
#   neighbor 192.168.1.100
#     low-memory exempt
#     bmp-activate-server 1
#     remote-as 65563
#     description NBR-1
#     affinity-group 160
#   neighbor 192.168.1.101
#     remote-as 65563
#     password 7 12090404011C03162E
#   vrf site-1
#     local-as 200
#     log-neighbor-changes
#     allocate-index 5000
#     neighbor 198.51.100.1
#       remote-as 65562
#       description site-1-nbr-1
#       password 3 13D4D3549493D2877B1DC116EE27A6BE
#     neighbor 198.51.100.2
#       remote-as 65562
#       description site-1-nbr-2
#   vrf site-2
#     local-as 300
#     neighbor-down fib-accelerate
#     log-neighbor-changes
#     neighbor 203.0.113.2
#       remote-as 65568
#       description site-2-nbr-1
#       password 3 AF92F4C16A0A0EC5BDF56CF58BC030F6
# Using replaced
# Before state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65563
#   router-id 192.168.1.1
#   confederation identifier 42
#   confederation peers 65020 65030 65040
#   bestpath as-path multipath-relax
#   bestpath cost-community ignore
#   bestpath compare-neighborid
#   neighbor-down fib-accelerate
#   maxas-limit 20
#   log-neighbor-changes
#   neighbor 192.168.1.100
#     low-memory exempt
#     bmp-activate-server 1
#     remote-as 65563
#     description NBR-1
#     affinity-group 160
#   neighbor 192.168.1.101
#     remote-as 65563
#     password 7 12090404011C03162E
#   vrf site-1
#     local-as 200
#     log-neighbor-changes
#     allocate-index 5000
#     neighbor 198.51.100.1
#       remote-as 65562
#       description site-1-nbr-1
#       password 3 13D4D3549493D2877B1DC116EE27A6BE
#     neighbor 198.51.100.2
#       remote-as 65562
#       description site-1-nbr-2
#   vrf site-2
#     local-as 300
#     neighbor-down fib-accelerate
#     log-neighbor-changes
#     neighbor 203.0.113.2
#       remote-as 65568
#       description site-2-nbr-1
#       password 3 AF92F4C16A0A0EC5BDF56CF58BC030F6
- name: Replace BGP configuration with provided configuration
  cisco.nxos.nxos_bgp_global:
    config:
      as_number: 65563
      router_id: 192.168.1.1
      bestpath:
        compare_neighborid: true
        cost_community_ignore: true
      confederation:
        identifier: 42
        peers:
          - 65020
          - 65030
          - 65050
      maxas_limit: 40
      neighbors:
        - neighbor_address: 192.168.1.100
          neighbor_affinity_group:
            group_id: 160
          bmp_activate_server: 1
          remote_as: 65563
          description: NBR-1
          low_memory:
            exempt: true
      neighbor_down:
        fib_accelerate: true
      vrfs:
        - vrf: site-2
          local_as: 300
          log_neighbor_changes: true
          neighbors:
            - neighbor_address: 203.0.113.2
              password:
                encryption: 7
                key: 12090404011C03162E
          neighbor_down:
            fib_accelerate: true
    state: replaced
# Task output:
# ------------
#  before:
#    as_number: '65563'
#    bestpath:
#      as_path:
#        multipath_relax: true
#      compare_neighborid: true
#      cost_community_ignore: true
#    confederation:
#      identifier: '42'
#      peers:
#      - '65020'
#      - '65030'
#      - '65040'
#    log_neighbor_changes: true
#    maxas_limit: 20
#    neighbor_down:
#      fib_accelerate: true
#    neighbors:
#    - bmp_activate_server: 1
#      description: NBR-1
#      low_memory:
#        exempt: true
#      neighbor_address: 192.168.1.100
#      neighbor_affinity_group:
#        group_id: 160
#      remote_as: '65563'
#    - neighbor_address: 192.168.1.101
#      password:
#        encryption: 7
#        key: 12090404011C03162E
#      remote_as: '65563'
#    router_id: 192.168.1.1
#    vrfs:
#    - allocate_index: 5000
#      local_as: '200'
#      log_neighbor_changes: true
#      neighbors:
#      - description: site-1-nbr-1
#        neighbor_address: 198.51.100.1
#        password:
#          encryption: 3
#          key: 13D4D3549493D2877B1DC116EE27A6BE
#        remote_as: '65562'
#      - description: site-1-nbr-2
#        neighbor_address: 198.51.100.2
#        remote_as: '65562'
#      vrf: site-1
#    - local_as: '300'
#      log_neighbor_changes: true
#      neighbor_down:
#        fib_accelerate: true
#      neighbors:
#      - description: site-2-nbr-1
#        neighbor_address: 203.0.113.2
#        password:
#          encryption: 3
#          key: AF92F4C16A0A0EC5BDF56CF58BC030F6
#        remote_as: '65568'
#      vrf: site-2
#
# commands:
#  - router bgp 65563
#  - no bestpath as-path multipath-relax
#  - no log-neighbor-changes
#  - maxas-limit 40
#  - no confederation peers 65020 65030 65040
#  - confederation peers 65020 65030 65050
#  - no neighbor 192.168.1.101
#  - vrf site-2
#  - neighbor 203.0.113.2
#  - no remote-as 65568
#  - no description site-2-nbr-1
#  - password 7 12090404011C03162E
#  - no vrf site-1
#  after:
#    as_number: '65563'
#    bestpath:
#      compare_neighborid: true
#      cost_community_ignore: true
#    confederation:
#      identifier: '42'
#      peers:
#      - '65020'
#      - '65030'
#      - '65050'
#    maxas_limit: 40
#    neighbor_down:
#      fib_accelerate: true
#    neighbors:
#    - bmp_activate_server: 1
#      description: NBR-1
#      low_memory:
#        exempt: true
#      neighbor_address: 192.168.1.100
#      neighbor_affinity_group:
#        group_id: 160
#      remote_as: '65563'
#    router_id: 192.168.1.1
#    vrfs:
#    - local_as: '300'
#      log_neighbor_changes: true
#      neighbor_down:
#        fib_accelerate: true
#      neighbors:
#      - neighbor_address: 203.0.113.2
#        password:
#          encryption: 7
#          key: 12090404011C03162E
#      vrf: site-2
#
# After state:
# ------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65563
#   router-id 192.168.1.1
#   confederation identifier 42
#   confederation peers 65020 65030 65050
#   bestpath cost-community ignore
#   bestpath compare-neighborid
#   neighbor-down fib-accelerate
#   maxas-limit 40
#   neighbor 192.168.1.100
#     low-memory exempt
#     bmp-activate-server 1
#     remote-as 65563
#     description NBR-1
#     affinity-group 160
#   vrf site-2
#     local-as 300
#     neighbor-down fib-accelerate
#     log-neighbor-changes
#     neighbor 203.0.113.2
#       password 7 12090404011C03162E
# Using deleted
# Before state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65563
#   router-id 192.168.1.1
#   confederation identifier 42
#   confederation peers 65020 65030 65040
#   bestpath as-path multipath-relax
#   bestpath cost-community ignore
#   bestpath compare-neighborid
#   neighbor-down fib-accelerate
#   maxas-limit 20
#   log-neighbor-changes
#   address-family ipv4 unicast
#     default-metric 400
#     suppress-inactive
#     default-information originate
#   address-family ipv6 multicast
#     wait-igp-convergence
#     redistribute eigrp eigrp-1 route-map site-1-rmap
#   neighbor 192.168.1.100
#     low-memory exempt
#     bmp-activate-server 1
#     remote-as 65563
#     description NBR-1
#     affinity-group 160
#   neighbor 192.168.1.101
#     remote-as 65563
#     password 7 12090404011C03162E
#   vrf site-1
#     local-as 200
#     log-neighbor-changes
#     allocate-index 5000
#     address-family ipv4 multicast
#       maximum-paths 40
#       dampen-igp-metric 1200
#     neighbor 198.51.100.1
#       remote-as 65562
#       description site-1-nbr-1
#       password 3 13D4D3549493D2877B1DC116EE27A6BE
#     neighbor 198.51.100.2
#       remote-as 65562
#       description site-1-nbr-2
#   vrf site-2
#     local-as 300
#     neighbor-down fib-accelerate
#     log-neighbor-changes
#     neighbor 203.0.113.2
#       remote-as 65568
#       description site-1-nbr-1
#       password 3 AF92F4C16A0A0EC5BDF56CF58BC030F6
- name: Delete BGP configurations handled by this module
  cisco.nxos.nxos_bgp_global:
    state: deleted
# Task output:
# ------------
# before:
#    as_number: '65563'
#    bestpath:
#      as_path:
#        multipath_relax: true
#      compare_neighborid: true
#      cost_community_ignore: true
#    confederation:
#      identifier: '42'
#      peers:
#      - '65020'
#      - '65030'
#      - '65040'
#    log_neighbor_changes: true
#    maxas_limit: 20
#    neighbor_down:
#      fib_accelerate: true
#    neighbors:
#    - bmp_activate_server: 1
#      description: NBR-1
#      low_memory:
#        exempt: true
#      neighbor_address: 192.168.1.100
#      neighbor_affinity_group:
#        group_id: 160
#      remote_as: '65563'
#    - neighbor_address: 192.168.1.101
#      password:
#        encryption: 7
#        key: 12090404011C03162E
#      remote_as: '65563'
#    router_id: 192.168.1.1
#    vrfs:
#    - allocate_index: 5000
#      local_as: '200'
#      log_neighbor_changes: true
#      neighbors:
#      - description: site-1-nbr-1
#        neighbor_address: 198.51.100.1
#        password:
#          encryption: 3
#          key: 13D4D3549493D2877B1DC116EE27A6BE
#        remote_as: '65562'
#      - description: site-1-nbr-2
#        neighbor_address: 198.51.100.2
#        remote_as: '65562'
#      vrf: site-1
#    - local_as: '300'
#      log_neighbor_changes: true
#      neighbor_down:
#        fib_accelerate: true
#      neighbors:
#      - description: site-1-nbr-1
#        neighbor_address: 203.0.113.2
#        password:
#          encryption: 3
#          key: AF92F4C16A0A0EC5BDF56CF58BC030F6
#        remote_as: '65568'
#      vrf: site-2
#
# commands:
#   - router bgp 65563
#   - no bestpath as-path multipath-relax
#   - no bestpath compare-neighborid
#   - no bestpath cost-community ignore
#   - no confederation identifier 42
#   - no log-neighbor-changes
#   - no maxas-limit 20
#   - no neighbor-down fib-accelerate
#   - no router-id 192.168.1.1
#   - no confederation peers 65020 65030 65040
#   - no neighbor 192.168.1.100
#   - no neighbor 192.168.1.101
#   - no vrf site-1
#   - no vrf site-2
#
#  after:
#    as_number: '65563'
#
# After state:
# ------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65563
#   address-family ipv4 unicast
#     default-metric 400
#     suppress-inactive
#     default-information originate
#   address-family ipv6 multicast
#     wait-igp-convergence
#     redistribute eigrp eigrp-1 route-map site-1-rmap
#
# Using purged
# Before state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65563
#   router-id 192.168.1.1
#   confederation identifier 42
#   confederation peers 65020 65030 65040
#   bestpath as-path multipath-relax
#   bestpath cost-community ignore
#   bestpath compare-neighborid
#   neighbor-down fib-accelerate
#   maxas-limit 20
#   log-neighbor-changes
#   address-family ipv4 unicast
#     default-metric 400
#     suppress-inactive
#     default-information originate
#   address-family ipv6 multicast
#     wait-igp-convergence
#     redistribute eigrp eigrp-1 route-map site-1-rmap
#   neighbor 192.168.1.100
#     low-memory exempt
#     bmp-activate-server 1
#     remote-as 65563
#     description NBR-1
#     affinity-group 160
#   neighbor 192.168.1.101
#     remote-as 65563
#     password 7 12090404011C03162E
#   vrf site-1
#     local-as 200
#     log-neighbor-changes
#     allocate-index 5000
#     address-family ipv4 multicast
#       maximum-paths 40
#       dampen-igp-metric 1200
#     neighbor 198.51.100.1
#       remote-as 65562
#       description site-1-nbr-1
#       password 3 13D4D3549493D2877B1DC116EE27A6BE
#     neighbor 198.51.100.2
#       remote-as 65562
#       description site-1-nbr-2
#   vrf site-2
#     local-as 300
#     neighbor-down fib-accelerate
#     log-neighbor-changes
#     neighbor 203.0.113.2
#       remote-as 65568
#       description site-1-nbr-1
#       password 3 AF92F4C16A0A0EC5BDF56CF58BC030F6
- name: Purge all BGP configurations from the device
  cisco.nxos.nxos_bgp_global:
    state: purged
# Task output:
# ------------
# before:
#    as_number: '65563'
#    bestpath:
#      as_path:
#        multipath_relax: true
#      compare_neighborid: true
#      cost_community_ignore: true
#    confederation:
#      identifier: '42'
#      peers:
#      - '65020'
#      - '65030'
#      - '65040'
#    log_neighbor_changes: true
#    maxas_limit: 20
#    neighbor_down:
#      fib_accelerate: true
#    neighbors:
#    - bmp_activate_server: 1
#      description: NBR-1
#      low_memory:
#        exempt: true
#      neighbor_address: 192.168.1.100
#      neighbor_affinity_group:
#        group_id: 160
#      remote_as: '65563'
#    - neighbor_address: 192.168.1.101
#      password:
#        encryption: 7
#        key: 12090404011C03162E
#      remote_as: '65563'
#    router_id: 192.168.1.1
#    vrfs:
#    - allocate_index: 5000
#      local_as: '200'
#      log_neighbor_changes: true
#      neighbors:
#      - description: site-1-nbr-1
#        neighbor_address: 198.51.100.1
#        password:
#          encryption: 3
#          key: 13D4D3549493D2877B1DC116EE27A6BE
#        remote_as: '65562'
#      - description: site-1-nbr-2
#        neighbor_address: 198.51.100.2
#        remote_as: '65562'
#      vrf: site-1
#    - local_as: '300'
#      log_neighbor_changes: true
#      neighbor_down:
#        fib_accelerate: true
#      neighbors:
#      - description: site-1-nbr-1
#        neighbor_address: 203.0.113.2
#        password:
#          encryption: 3
#          key: AF92F4C16A0A0EC5BDF56CF58BC030F6
#        remote_as: '65568'
#      vrf: site-2
#
# commands:
#   - no router bgp 65563
#
#  after: {}
#
# After state:
# ------------
# Nexus9000v# show running-config | section "^router bgp"
# Nexus9000v#
# Using rendered
- name: Render platform specific configuration lines (without connecting to the device)
  cisco.nxos.nxos_bgp_global:
    config:
      as_number: 65563
      router_id: 192.168.1.1
      bestpath:
        as_path:
          multipath_relax: true
        compare_neighborid: true
        cost_community_ignore: true
      confederation:
        identifier: 42
        peers:
          - 65020
          - 65030
          - 65040
      log_neighbor_changes: true
      maxas_limit: 20
      neighbors:
        - neighbor_address: 192.168.1.100
          neighbor_affinity_group:
            group_id: 160
          bmp_activate_server: 1
          remote_as: 65563
          description: NBR-1
          low_memory:
            exempt: true
        - neighbor_address: 192.168.1.101
          remote_as: 65563
          password:
            encryption: 7
            key: 12090404011C03162E
      neighbor_down:
        fib_accelerate: true
      vrfs:
        - vrf: site-1
          allocate_index: 5000
          local_as: 200
          log_neighbor_changes: true
          neighbors:
            - neighbor_address: 198.51.100.1
              description: site-1-nbr-1
              password:
                encryption: 3
                key: 13D4D3549493D2877B1DC116EE27A6BE
              remote_as: 65562
            - neighbor_address: 198.51.100.2
              remote_as: 65562
              description: site-1-nbr-2
        - vrf: site-2
          local_as: 300
          log_neighbor_changes: true
          neighbors:
            - neighbor_address: 203.0.113.2
              description: site-1-nbr-1
              password:
                encryption: 3
                key: AF92F4C16A0A0EC5BDF56CF58BC030F6
              remote_as: 65568
          neighbor_down:
            fib_accelerate: true
# Task output:
# ------------
# rendered:
#   - router bgp 65563
#   - bestpath as-path multipath-relax
#   - bestpath compare-neighborid
#   - bestpath cost-community ignore
#   - confederation identifier 42
#   - log-neighbor-changes
#   - maxas-limit 20
#   - neighbor-down fib-accelerate
#   - router-id 192.168.1.1
#   - confederation peers 65020 65030 65040
#   - neighbor 192.168.1.100
#   - remote-as 65563
#   - affinity-group 160
#   - bmp-activate-server 1
#   - description NBR-1
#   - low-memory exempt
#   - neighbor 192.168.1.101
#   - remote-as 65563
#   - password 7 12090404011C03162E
#   - vrf site-1
#   - allocate-index 5000
#   - local-as 200
#   - log-neighbor-changes
#   - neighbor 198.51.100.1
#   - remote-as 65562
#   - description site-1-nbr-1
#   - password 3 13D4D3549493D2877B1DC116EE27A6BE
#   - neighbor 198.51.100.2
#   - remote-as 65562
#   - description site-1-nbr-2
#   - vrf site-2
#   - local-as 300
#   - log-neighbor-changes
#   - neighbor-down fib-accelerate
#   - neighbor 203.0.113.2
#   - remote-as 65568
#   - description site-1-nbr-1
#   - password 3 AF92F4C16A0A0EC5BDF56CF58BC030F6
# Using parsed
# parsed.cfg
# ------------
# router bgp 65563
#   router-id 192.168.1.1
#   confederation identifier 42
#   confederation peers 65020 65030 65040
#   bestpath as-path multipath-relax
#   bestpath cost-community ignore
#   bestpath compare-neighborid
#   neighbor-down fib-accelerate
#   maxas-limit 20
#   log-neighbor-changes
#   neighbor 192.168.1.100
#     low-memory exempt
#     bmp-activate-server 1
#     remote-as 65563
#     description NBR-1
#     affinity-group 160
#   neighbor 192.168.1.101
#     remote-as 65563
#     password 7 12090404011C03162E
#   vrf site-1
#     local-as 200
#     log-neighbor-changes
#     allocate-index 5000
#     neighbor 198.51.100.1
#       remote-as 65562
#       description site-1-nbr-1
#       password 3 13D4D3549493D2877B1DC116EE27A6BE
#     neighbor 198.51.100.2
#       remote-as 65562
#       description site-1-nbr-2
#   vrf site-2
#     local-as 300
#     neighbor-down fib-accelerate
#     log-neighbor-changes
#     neighbor 203.0.113.2
#       remote-as 65568
#       description site-1-nbr-1
#       password 3 AF92F4C16A0A0EC5BDF56CF58BC030F6
- name: Parse externally provided BGP config
  cisco.nxos.nxos_bgp_global:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed
# Task output:
# ------------
#  parsed:
#    as_number: '65563'
#    bestpath:
#      as_path:
#        multipath_relax: true
#      compare_neighborid: true
#      cost_community_ignore: true
#    confederation:
#      identifier: '42'
#      peers:
#      - '65020'
#      - '65030'
#      - '65040'
#    log_neighbor_changes: true
#    maxas_limit: 20
#    neighbor_down:
#      fib_accelerate: true
#    neighbors:
#    - bmp_activate_server: 1
#      description: NBR-1
#      low_memory:
#        exempt: true
#      neighbor_address: 192.168.1.100
#      neighbor_affinity_group:
#        group_id: 160
#      remote_as: '65563'
#    - neighbor_address: 192.168.1.101
#      password:
#        encryption: 7
#        key: 12090404011C03162E
#      remote_as: '65563'
#    router_id: 192.168.1.1
#    vrfs:
#    - allocate_index: 5000
#      local_as: '200'
#      log_neighbor_changes: true
#      neighbors:
#      - description: site-1-nbr-1
#        neighbor_address: 198.51.100.1
#        password:
#          encryption: 3
#          key: 13D4D3549493D2877B1DC116EE27A6BE
#        remote_as: '65562'
#      - description: site-1-nbr-2
#        neighbor_address: 198.51.100.2
#        remote_as: '65562'
#      vrf: site-1
#    - local_as: '300'
#      log_neighbor_changes: true
#      neighbor_down:
#        fib_accelerate: true
#      neighbors:
#      - description: site-1-nbr-1
#        neighbor_address: 203.0.113.2
#        password:
#          encryption: 3
#          key: AF92F4C16A0A0EC5BDF56CF58BC030F6
#        remote_as: '65568'
#      vrf: site-2
# Using gathered
# existing config
#
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65563
#   router-id 192.168.1.1
#   confederation identifier 42
#   confederation peers 65020 65030 65050
#   bestpath cost-community ignore
#   bestpath compare-neighborid
#   neighbor-down fib-accelerate
#   maxas-limit 40
#   neighbor 192.168.1.100
#     low-memory exempt
#     bmp-activate-server 1
#     remote-as 65563
#     description NBR-1
#     affinity-group 160
#   vrf site-1
#   vrf site-2
#     local-as 300
#     neighbor-down fib-accelerate
#     log-neighbor-changes
#     neighbor 203.0.113.2
#       password 7 12090404011C03162E
- name: Gather BGP facts using gathered
  cisco.nxos.nxos_bgp_global:
    state: gathered
# Task output:
# ------------
#  gathered:
#    as_number: '65563'
#    bestpath:
#      compare_neighborid: true
#      cost_community_ignore: true
#    confederation:
#      identifier: '42'
#      peers:
#      - '65020'
#      - '65030'
#      - '65050'
#    maxas_limit: 40
#    neighbor_down:
#      fib_accelerate: true
#    neighbors:
#    - bmp_activate_server: 1
#      description: NBR-1
#      low_memory:
#        exempt: true
#      neighbor_address: 192.168.1.100
#      neighbor_affinity_group:
#        group_id: 160
#      remote_as: '65563'
#    router_id: 192.168.1.1
#    vrfs:
#    - vrf: site-1
#    - local_as: '300'
#      log_neighbor_changes: true
#      neighbor_down:
#        fib_accelerate: true
#      neighbors:
#      - neighbor_address: 203.0.113.2
#        password:
#          encryption: 7
#          key: 12090404011C03162E
#      vrf: site-2
# Remove a neighbor having AF configurations with state replaced (will fail)
# Before state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   log-neighbor-changes
#   maxas-limit 20
#   router-id 198.51.100.2
#   neighbor 203.0.113.2
#     address-family ipv4 unicast
#       next-hop-self
#     remote-as 65538
#     affinity-group 160
#     description NBR-1
#     low-memory exempt
#   neighbor 192.0.2.1
#     remote-as 65537
#     password 7 12090404011C03162E
- name: Remove a neighbor having AF configurations (should fail)
  cisco.nxos.nxos_bgp_global:
    config:
      as_number: 65536
      router_id: 198.51.100.2
      maxas_limit: 20
      log_neighbor_changes: true
      neighbors:
        - neighbor_address: 192.0.2.1
          remote_as: 65537
          password:
            encryption: 7
            key: 12090404011C03162E
    state: replaced
# Task output:
# ------------
# fatal: [Nexus9000v]: FAILED! => changed=false
#    msg: Neighbor 203.0.113.2 has address-family configurations.
#         Please use the nxos_bgp_neighbor_af module to remove those first.
# Remove a VRF having AF configurations with state replaced (will fail)
# Before state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   log-neighbor-changes
#   maxas-limit 20
#   router-id 198.51.100.2
#   neighbor 192.0.2.1
#     remote-as 65537
#     password 7 12090404011C03162E
#   vrf site-1
#     address-family ipv4 unicast
#       default-information originate
#     neighbor 203.0.113.2
#       remote-as 65538
#       affinity-group 160
#       description NBR-1
#       low-memory exempt
#   vrf site-2
#     neighbor-down fib-accelerate
- name: Remove a VRF having AF configurations (should fail)
  cisco.nxos.nxos_bgp_global:
    config:
      as_number: 65536
      router_id: 198.51.100.2
      maxas_limit: 20
      log_neighbor_changes: true
      neighbors:
        - neighbor_address: 192.0.2.1
          remote_as: 65537
          password:
            encryption: 7
            key: 12090404011C03162E
      vrfs:
        - vrf: site-2
          neighbor_down:
            fib_accelerate: true
    state: replaced
# Task output:
# ------------
# fatal: [Nexus9000v]: FAILED! => changed=false
#    msg: VRF site-1 has address-family configurations.
#         Please use the nxos_bgp_af module to remove those first.
返回值
此处记录了常见的返回值here,以下是此模块特有的字段
| 键 | 描述 | 
|---|---|
| 生成的配置模型调用。 返回:已更改时 示例: | |
| 模型调用之前的配置。 返回:始终 示例: | |
| 推送到远程设备的命令集。 返回:始终 示例: | |
| 从远程设备收集的网络资源事实,作为结构化数据。 返回:当state为 示例: | |
| 根据模块argspec将running_config选项中提供的设备原生配置解析为结构化数据。 返回:当state为 示例: | |
| 以设备原生格式(离线)呈现任务中提供的配置。 返回:当state为 示例: | 
