cisco.nxos.nxos_bgp_neighbor_address_family 模块 – BGP 邻居地址族资源模块。

注意

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

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

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

要在 playbook 中使用它,请指定: cisco.nxos.nxos_bgp_neighbor_address_family

cisco.nxos 2.0.0 中的新增功能

概要

  • 此模块管理在运行 Cisco NX-OS 的设备上 BGP 邻居地址族的配置。

参数

参数

注释

config

字典

BGP 邻居 AF 配置。

as_number

字符串

路由器的自治系统编号。

neighbors

列表 / 元素=字典

BGP 邻居 AF 配置列表。

address_family

列表 / 元素=字典

BGP 邻居地址族相关配置。

advertise_map

字典

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

exist_map

字符串

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

non_exist_map

字符串

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

route_map

字符串 / 必需

路由映射名称。

advertisement_interval

整数

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

afi

字符串 / 必需

地址族指示符。

选项

  • "ipv4"

  • "ipv6"

  • "link-state"

  • "vpnv4"

  • "vpnv6"

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

字典

继承模板。

sequence

整数

序列号。

template

字符串

模板名称。

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

字符串

将策略应用于传出路由。

rewrite_evpn_rt_asn

布尔值

自动为 EBGP 邻居生成 RT。

选项

  • false

  • true

rewrite_rt_asn

布尔值

自动为 EBGP 邻居生成 RT。

选项

  • false

  • true

route_map

字典

将路由映射应用于邻居。

inbound

字符串

将策略应用于传入路由。

outbound

字符串

将策略应用于传出路由。

route_reflector_client

布尔值

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

选项

  • false

  • true

safi

字符串

子地址族指示符。

选项

  • "unicast"

  • "multicast"

  • "mvpn"

  • "evpn"

send_community

字典

向此邻居发送社区属性。

both

布尔值

发送标准和扩展社区属性。

选项

  • false

  • true

extended

布尔值

发送扩展社区属性。

选项

  • false

  • true

set

布尔值

Set send-community attribute.

选项

  • false

  • true

standard

布尔值

发送标准社区属性。

选项

  • false

  • true

soft_reconfiguration_inbound

字典

软重新配置。

always

布尔值

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

选项

  • false

  • true

set

布尔值

设置 soft-reconfiguration inbound 属性。

选项

  • false

  • true

soo

字符串

指定 Site-of-origin extcommunity。

suppress_inactive

布尔值

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

选项

  • false

  • true

unsuppress_map

字符串

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

weight

整数

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

neighbor_address

字符串 / 必需

邻居的 IP/IPv6 地址。

vrfs

列表 / 元素=字典

虚拟路由上下文。

neighbors

列表 / 元素=字典

BGP 邻居 AF 配置列表。

address_family

列表 / 元素=字典

BGP 邻居地址族相关配置。

advertise_map

字典

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

exist_map

字符串

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

non_exist_map

字符串

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

route_map

字符串 / 必需

路由映射名称。

advertisement_interval

整数

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

afi

字符串 / 必需

地址族指示符。

选项

  • "ipv4"

  • "ipv6"

  • "link-state"

  • "vpnv4"

  • "vpnv6"

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

字典

继承模板。

sequence

整数

序列号。

template

字符串

模板名称。

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

字符串

将策略应用于传出路由。

rewrite_evpn_rt_asn

布尔值

自动为 EBGP 邻居生成 RT。

选项

  • false

  • true

rewrite_rt_asn

布尔值

自动为 EBGP 邻居生成 RT。

选项

  • false

  • true

route_map

字典

将路由映射应用于邻居。

inbound

字符串

将策略应用于传入路由。

outbound

字符串

将策略应用于传出路由。

route_reflector_client

布尔值

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

选项

  • false

  • true

safi

字符串

子地址族指示符。

选项

  • "unicast"

  • "multicast"

  • "mvpn"

  • "evpn"

send_community

字典

向此邻居发送社区属性。

both

布尔值

发送标准和扩展社区属性。

选项

  • false

  • true

extended

布尔值

发送扩展社区属性。

选项

  • false

  • true

set

布尔值

Set send-community attribute.

选项

  • false

  • true

standard

布尔值

发送标准社区属性。

选项

  • false

  • true

soft_reconfiguration_inbound

字典

软重新配置。

always

布尔值

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

选项

  • false

  • true

set

布尔值

设置 soft-reconfiguration inbound 属性。

选项

  • false

  • true

soo

字符串

指定 Site-of-origin extcommunity。

suppress_inactive

布尔值

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

选项

  • false

  • true

unsuppress_map

字符串

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

weight

整数

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

neighbor_address

字符串 / 必需

邻居的 IP/IPv6 地址。

vrf

字符串

VRF 名称。

running_config

字符串

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

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

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

state

字符串

配置应保留到的状态。

状态 *deleted* 只删除此模块管理的 BGP 属性,不会完全否定 BGP 进程。

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

选项

  • "merged" ← (默认)

  • "replaced"

  • "overridden"

  • "deleted"

  • "parsed"

  • "gathered"

  • "rendered"

备注

注意

  • 针对 NX-OS 9.3.6 进行了测试。

  • 不支持 Cisco MDS

  • 要管理 BGP 地址族配置,请使用 cisco.nxos.nxos_bgp_address_family 模块。

  • 此模块适用于连接 network_clihttpapi

示例

# 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_neighbor_address_family: &id001
    config:
      as_number: 65536
      neighbors:
        - neighbor_address: 192.0.2.32
          address_family:
            - afi: ipv4
              safi: unicast
              maximum_prefix:
                max_prefix_limit: 20
                generate_warning_threshold: 75
              weight: 100
              prefix_list:
                inbound: rmap1
                outbound: rmap2
            - afi: ipv6
              safi: unicast
        - neighbor_address: 192.0.2.33
          address_family:
            - afi: ipv4
              safi: multicast
              inherit:
                template: BasePolicy
                sequence: 200
      vrfs:
        - vrf: site-1
          neighbors:
            - neighbor_address: 203.0.113.1
              address_family:
                - afi: ipv4
                  safi: unicast
                  suppress_inactive: true
                  next_hop_self:
                    set: true
            - neighbor_address: 203.0.113.2
              address_family:
                - afi: ipv6
                  safi: unicast
                - afi: ipv4
                  safi: multicast
                  send_community:
                    set: true

# Task output:
# ------------
#  before: {}
#
#  commands:
#  - router bgp 65536
#  - neighbor 192.0.2.32
#  - address-family ipv4 unicast
#  - maximum-prefix 20 75
#  - weight 100
#  - prefix-list rmap1 in
#  - prefix-list rmap2 out
#  - address-family ipv6 unicast
#  - neighbor 192.0.2.33
#  - address-family ipv4 multicast
#  - inherit peer-policy BasePolicy 200
#  - vrf site-1
#  - neighbor 203.0.113.1
#  - address-family ipv4 unicast
#  - suppress-inactive
#  - next-hop-self
#  - neighbor 203.0.113.2
#  - address-family ipv6 unicast
#  - address-family ipv4 multicast
#  - send-community
#
#  after:
#    as_number: "65536"
#    neighbors:
#      - neighbor_address: 192.0.2.32
#        address_family:
#          - afi: ipv4
#            safi: unicast
#            maximum_prefix:
#              max_prefix_limit: 20
#              generate_warning_threshold: 75
#            weight: 100
#            prefix_list:
#              inbound: rmap1
#              outbound: rmap2
#          - afi: ipv6
#            safi: unicast
#      - neighbor_address: 192.0.2.33
#        address_family:
#          - afi: ipv4
#            safi: multicast
#            inherit:
#              template: BasePolicy
#              sequence: 200
#    vrfs:
#      - vrf: site-1
#        neighbors:
#          - neighbor_address: 203.0.113.1
#            address_family:
#              - afi: ipv4
#                safi: unicast
#                suppress_inactive: true
#                next_hop_self:
#                  set: true
#          - neighbor_address: 203.0.113.2
#            address_family:
#              - afi: ipv4
#                safi: multicast
#                send_community:
#                  set: true
#              - afi: ipv6
#                safi: unicast

# After state:
# ------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   neighbor 192.0.2.32
#     address-family ipv4 unicast
#       maximum-prefix 20 75
#       weight 100
#       prefix-list rmap1 in
#       prefix-list rmap2 out
#     address-family ipv6 unicast
#   neighbor 192.0.2.33
#     address-family ipv4 multicast
#       inherit peer-policy BasePolicy 200
#   vrf site-1
#     neighbor 203.0.113.1
#       address-family ipv4 unicast
#         suppress-inactive
#         next-hop-self
#     neighbor 203.0.113.2
#       address-family ipv4 multicast
#         send-community
#       address-family ipv6 unicast
#

# Using replaced

# Before state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   neighbor 192.0.2.32
#     address-family ipv4 unicast
#       maximum-prefix 20 75
#       weight 100
#       prefix-list rmap1 in
#       prefix-list rmap2 out
#     address-family ipv6 unicast
#   neighbor 192.0.2.33
#     address-family ipv4 multicast
#       inherit peer-policy BasePolicy 200
#   vrf site-1
#     neighbor 203.0.113.1
#       address-family ipv4 unicast
#         suppress-inactive
#         next-hop-self
#     neighbor 203.0.113.2
#       address-family ipv4 multicast
#         send-community
#       address-family ipv6 unicast
#

- name: Replace specified neighbor AFs with given configuration
  cisco.nxos.nxos_bgp_neighbor_address_family: &replaced
    config:
      as_number: 65536
      neighbors:
        - neighbor_address: 192.0.2.32
          address_family:
            - afi: ipv4
              safi: unicast
              weight: 110
            - afi: ipv6
              safi: unicast
        - neighbor_address: 192.0.2.33
          address_family:
            - afi: ipv4
              safi: multicast
              inherit:
                template: BasePolicy
                sequence: 200
      vrfs:
        - vrf: site-1
          neighbors:
            - neighbor_address: 203.0.113.1
              address_family:
                - afi: ipv4
                  safi: unicast
            - neighbor_address: 203.0.113.2
              address_family:
                - afi: ipv6
                  safi: unicast
                - afi: ipv4
                  safi: multicast
                  send_community:
                    set: true
    state: replaced

# Task output:
# ------------
#  before:
#    as_number: "65536"
#    neighbors:
#      - neighbor_address: 192.0.2.32
#        address_family:
#          - afi: ipv4
#            safi: unicast
#            maximum_prefix:
#              max_prefix_limit: 20
#              generate_warning_threshold: 75
#            weight: 100
#            prefix_list:
#              inbound: rmap1
#              outbound: rmap2
#          - afi: ipv6
#            safi: unicast
#      - neighbor_address: 192.0.2.33
#        address_family:
#          - afi: ipv4
#            safi: multicast
#            inherit:
#              template: BasePolicy
#              sequence: 200
#    vrfs:
#      - vrf: site-1
#        neighbors:
#          - neighbor_address: 203.0.113.1
#            address_family:
#              - afi: ipv4
#                safi: unicast
#                suppress_inactive: true
#                next_hop_self:
#                  set: true
#          - neighbor_address: 203.0.113.2
#            address_family:
#              - afi: ipv4
#                safi: multicast
#                send_community:
#                  set: true
#              - afi: ipv6
#                safi: unicast
#
#  commands:
#    - router bgp 65536
#    - neighbor 192.0.2.32
#    - address-family ipv4 unicast
#    - no maximum-prefix 20 75
#    - weight 110
#    - no prefix-list rmap1 in
#    - no prefix-list rmap2 out
#    - vrf site-1
#    - neighbor 203.0.113.1
#    - address-family ipv4 unicast
#    - no suppress-inactive
#    - no next-hop-self
#
#  after:
#    as_number: "65536"
#    neighbors:
#      - neighbor_address: 192.0.2.32
#        address_family:
#          - afi: ipv4
#            safi: unicast
#            weight: 110
#          - afi: ipv6
#            safi: unicast
#      - neighbor_address: 192.0.2.33
#        address_family:
#          - afi: ipv4
#            safi: multicast
#            inherit:
#              template: BasePolicy
#              sequence: 200
#    vrfs:
#      - vrf: site-1
#        neighbors:
#          - neighbor_address: 203.0.113.1
#            address_family:
#              - afi: ipv4
#                safi: unicast
#          - neighbor_address: 203.0.113.2
#            address_family:
#              - afi: ipv4
#                safi: multicast
#                send_community:
#                  set: true
#              - afi: ipv6
#                safi: unicast

# After state:
# ------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   neighbor 192.0.2.32
#     address-family ipv4 unicast
#       weight 110
#     address-family ipv6 unicast
#   neighbor 192.0.2.33
#     address-family ipv4 multicast
#       inherit peer-policy BasePolicy 200
#   vrf site-1
#     neighbor 203.0.113.1
#       address-family ipv4 unicast
#     neighbor 203.0.113.2
#       address-family ipv4 multicast
#         send-community
#       address-family ipv6 unicast
#

# Using overridden

# Before state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   neighbor 192.0.2.32
#     address-family ipv4 unicast
#       maximum-prefix 20 75
#       weight 100
#       prefix-list rmap1 in
#       prefix-list rmap2 out
#     address-family ipv6 unicast
#   neighbor 192.0.2.33
#     address-family ipv4 multicast
#       inherit peer-policy BasePolicy 200
#   vrf site-1
#     neighbor 203.0.113.1
#       address-family ipv4 unicast
#         suppress-inactive
#         next-hop-self
#     neighbor 203.0.113.2
#       address-family ipv4 multicast
#         send-community
#       address-family ipv6 unicast
#

- name: Override all BGP AF configuration with provided configuration
  cisco.nxos.nxos_bgp_neighbor_address_family:
    config:
      as_number: 65536
      neighbors:
        - neighbor_address: 192.0.2.32
          address_family:
            - afi: ipv4
              safi: unicast
      vrfs:
        - vrf: site-1
          neighbors:
            - neighbor_address: 203.0.113.1
              address_family:
                - afi: ipv4
                  safi: unicast
                  suppress_inactive: true
                  next_hop_self:
                    set: true
    state: overridden

# Task output:
# ------------
#  before:
#    as_number: "65536"
#    neighbors:
#      - neighbor_address: 192.0.2.32
#        address_family:
#          - afi: ipv4
#            safi: unicast
#            maximum_prefix:
#              max_prefix_limit: 20
#              generate_warning_threshold: 75
#            weight: 100
#            prefix_list:
#              inbound: rmap1
#              outbound: rmap2
#          - afi: ipv6
#            safi: unicast
#      - neighbor_address: 192.0.2.33
#        address_family:
#          - afi: ipv4
#            safi: multicast
#            inherit:
#              template: BasePolicy
#              sequence: 200
#    vrfs:
#      - vrf: site-1
#        neighbors:
#          - neighbor_address: 203.0.113.1
#            address_family:
#              - afi: ipv4
#                safi: unicast
#                suppress_inactive: true
#                next_hop_self:
#                  set: true
#          - neighbor_address: 203.0.113.2
#            address_family:
#              - afi: ipv4
#                safi: multicast
#                send_community:
#                  set: true
#              - afi: ipv6
#                safi: unicast
#
#  commands:
#    - router bgp 65536
#    - neighbor 192.0.2.32
#    - address-family ipv4 unicast
#    - no maximum-prefix 20 75
#    - no weight 100
#    - no prefix-list rmap1 in
#    - no prefix-list rmap2 out
#    - no address-family ipv6 unicast
#    - neighbor 192.0.2.33
#    - no address-family ipv4 multicast
#    - vrf site-1
#    - neighbor 203.0.113.2
#    - no address-family ipv4 multicast
#    - no address-family ipv6 unicast
#
#  after:
#    as_number: "65536"
#    neighbors:
#      - neighbor_address: 192.0.2.32
#        address_family:
#          - afi: ipv4
#            safi: unicast
#    vrfs:
#      - vrf: site-1
#        neighbors:
#          - neighbor_address: 203.0.113.1
#            address_family:
#              - afi: ipv4
#                safi: unicast
#                suppress_inactive: true
#                next_hop_self:
#                  set: true

# After state:
# ------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   neighbor 192.0.2.32
#     address-family ipv4 unicast
#   vrf site-1
#     neighbor 203.0.113.1
#       address-family ipv4 unicast
#         suppress-inactive
#         next-hop-self

# Using deleted to remove specified neighbor AFs

# Before state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   neighbor 192.0.2.32
#     address-family ipv4 unicast
#       maximum-prefix 20 75
#       weight 100
#       prefix-list rmap1 in
#       prefix-list rmap2 out
#     address-family ipv6 unicast
#   neighbor 192.0.2.33
#     address-family ipv4 multicast
#       inherit peer-policy BasePolicy 200
#   vrf site-1
#     neighbor 203.0.113.1
#       address-family ipv4 unicast
#         suppress-inactive
#         next-hop-self
#     neighbor 203.0.113.2
#       address-family ipv4 multicast
#         send-community
#       address-family ipv6 unicast
#

- name: Delete BGP configs handled by this module
  cisco.nxos.nxos_bgp_neighbor_address_family:
    config:
      as_number: 65536
      neighbors:
        - neighbor_address: 192.0.2.32
          address_family:
            - afi: ipv4
              safi: unicast
      vrfs:
        - vrf: site-1
          neighbors:
            - neighbor_address: 203.0.113.2
              address_family:
                - afi: ipv6
                  safi: unicast
    state: deleted

# Task output:
# ------------
#  before:
#    as_number: "65536"
#    neighbors:
#      - neighbor_address: 192.0.2.32
#        address_family:
#          - afi: ipv4
#            safi: unicast
#            maximum_prefix:
#              max_prefix_limit: 20
#              generate_warning_threshold: 75
#            weight: 100
#            prefix_list:
#              inbound: rmap1
#              outbound: rmap2
#          - afi: ipv6
#            safi: unicast
#      - neighbor_address: 192.0.2.33
#        address_family:
#          - afi: ipv4
#            safi: multicast
#            inherit:
#              template: BasePolicy
#              sequence: 200
#    vrfs:
#      - vrf: site-1
#        neighbors:
#          - neighbor_address: 203.0.113.1
#            address_family:
#              - afi: ipv4
#                safi: unicast
#                suppress_inactive: true
#                next_hop_self:
#                  set: true
#          - neighbor_address: 203.0.113.2
#            address_family:
#              - afi: ipv4
#                safi: multicast
#                send_community:
#                  set: true
#              - afi: ipv6
#                safi: unicast
#
#  commands:
#    - router bgp 65536
#    - neighbor 192.0.2.32
#    - no address-family ipv4 unicast
#    - vrf site-1
#    - neighbor 203.0.113.2
#    - no address-family ipv6 unicast
#
#  after:
#    as_number: "65536"
#    neighbors:
#      - neighbor_address: 192.0.2.32
#        address_family:
#          - afi: ipv6
#            safi: unicast
#      - neighbor_address: 192.0.2.33
#        address_family:
#          - afi: ipv4
#            safi: multicast
#            inherit:
#              template: BasePolicy
#              sequence: 200
#    vrfs:
#      - vrf: site-1
#        neighbors:
#          - neighbor_address: 203.0.113.1
#            address_family:
#              - afi: ipv4
#                safi: unicast
#                suppress_inactive: true
#                next_hop_self:
#                  set: true
#          - neighbor_address: 203.0.113.2
#            address_family:
#              - afi: ipv4
#                safi: multicast
#                send_community:
#                  set: true
#
# After state:
# ------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   neighbor 192.0.2.32
#     address-family ipv6 unicast
#   neighbor 192.0.2.33
#     address-family ipv4 multicast
#       inherit peer-policy BasePolicy 200
#   vrf site-1
#     neighbor 203.0.113.1
#       address-family ipv4 unicast
#         suppress-inactive
#         next-hop-self
#     neighbor 203.0.113.2
#       address-family ipv4 multicast
#         send-community
#

# Using deleted to remove all neighbor AFs

# Before state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   neighbor 192.0.2.32
#     address-family ipv4 unicast
#       maximum-prefix 20 75
#       weight 100
#       prefix-list rmap1 in
#       prefix-list rmap2 out
#     address-family ipv6 unicast
#   neighbor 192.0.2.33
#     address-family ipv4 multicast
#       inherit peer-policy BasePolicy 200
#   vrf site-1
#     neighbor 203.0.113.1
#       address-family ipv4 unicast
#         suppress-inactive
#         next-hop-self
#     neighbor 203.0.113.2
#       address-family ipv4 multicast
#         send-community
#       address-family ipv6 unicast
#

- name: Delete all BGP neighbor AF configs handled by this module
  cisco.nxos.nxos_bgp_neighbor_address_family:
    state: deleted

# Task output:
# ------------
#  before:
#    as_number: "65536"
#    neighbors:
#      - neighbor_address: 192.0.2.32
#        address_family:
#          - afi: ipv4
#            safi: unicast
#            maximum_prefix:
#              max_prefix_limit: 20
#              generate_warning_threshold: 75
#            weight: 100
#            prefix_list:
#              inbound: rmap1
#              outbound: rmap2
#          - afi: ipv6
#            safi: unicast
#      - neighbor_address: 192.0.2.33
#        address_family:
#          - afi: ipv4
#            safi: multicast
#            inherit:
#              template: BasePolicy
#              sequence: 200
#    vrfs:
#      - vrf: site-1
#        neighbors:
#          - neighbor_address: 203.0.113.1
#            address_family:
#              - afi: ipv4
#                safi: unicast
#                suppress_inactive: true
#                next_hop_self:
#                  set: true
#          - neighbor_address: 203.0.113.2
#            address_family:
#              - afi: ipv4
#                safi: multicast
#                send_community:
#                  set: true
#              - afi: ipv6
#                safi: unicast
#
#  commands:
#    - router bgp 65536
#    - neighbor 192.0.2.32
#    - no address-family ipv4 unicast
#    - no address-family ipv6 unicast
#    - neighbor 192.0.2.33
#    - no address-family ipv4 multicast
#    - vrf site-1
#    - neighbor 203.0.113.1
#    - no address-family ipv4 unicast
#    - neighbor 203.0.113.2
#    - no address-family ipv6 unicast
#    - no address-family ipv4 multicast
#
#  after:
#    as_number: "65536"
#
# After state:
# ------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   neighbor 192.0.2.32
#   neighbor 192.0.2.33
#   vrf site-1
#     neighbor 203.0.113.1
#     neighbor 203.0.113.2
#

# Using rendered

- name: Render platform specific configuration lines with state rendered (without connecting to the device)
  cisco.nxos.nxos_bgp_neighbor_address_family:
    config:
      as_number: 65536
      neighbors:
        - neighbor_address: 192.0.2.32
          address_family:
            - afi: ipv4
              safi: unicast
              maximum_prefix:
                max_prefix_limit: 20
                generate_warning_threshold: 75
              weight: 100
              prefix_list:
                inbound: rmap1
                outbound: rmap2
            - afi: ipv6
              safi: unicast
        - neighbor_address: 192.0.2.33
          address_family:
            - afi: ipv4
              safi: multicast
              inherit:
                template: BasePolicy
                sequence: 200
      vrfs:
        - vrf: site-1
          neighbors:
            - neighbor_address: 203.0.113.1
              address_family:
                - afi: ipv4
                  safi: unicast
                  suppress_inactive: true
                  next_hop_self:
                    set: true
            - neighbor_address: 203.0.113.2
              address_family:
                - afi: ipv6
                  safi: unicast
                - afi: ipv4
                  safi: multicast
                  send_community:
                    set: true
    state: rendered

# Task output:
# ------------
#  rendered:
#    - router bgp 65536
#    - neighbor 192.0.2.32
#    - address-family ipv4 unicast
#    - maximum-prefix 20 75
#    - weight 100
#    - prefix-list rmap1 in
#    - prefix-list rmap2 out
#    - address-family ipv6 unicast
#    - neighbor 192.0.2.33
#    - address-family ipv4 multicast
#    - inherit peer-policy BasePolicy 200
#    - vrf site-1
#    - neighbor 203.0.113.1
#    - address-family ipv4 unicast
#    - suppress-inactive
#    - next-hop-self
#    - neighbor 203.0.113.2
#    - address-family ipv6 unicast
#    - address-family ipv4 multicast
#    - send-community

# Using parsed

# parsed.cfg
# ------------
# router bgp 65536
#   neighbor 192.0.2.32
#     address-family ipv4 unicast
#       maximum-prefix 20 75
#       weight 100
#       prefix-list rmap1 in
#       prefix-list rmap2 out
#     address-family ipv6 unicast
#   neighbor 192.0.2.33
#     address-family ipv4 multicast
#       inherit peer-policy BasePolicy 200
#   vrf site-1
#     neighbor 203.0.113.1
#       address-family ipv4 unicast
#         suppress-inactive
#         next-hop-self
#     neighbor 203.0.113.2
#       address-family ipv4 multicast
#         send-community
#       address-family ipv6 unicast

- name: Parse externally provided BGP neighbor AF config
  register: result
  cisco.nxos.nxos_bgp_neighbor_address_family:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed

# Task output:
# ------------
#  parsed:
#    as_number: "65536"
#    neighbors:
#      - neighbor_address: 192.0.2.32
#        address_family:
#          - afi: ipv4
#           safi: unicast
#           maximum_prefix:
#              max_prefix_limit: 20
#              generate_warning_threshold: 75
#           weight: 100
#            prefix_list:
#              inbound: rmap1
#              outbound: rmap2
#          - afi: ipv6
#            safi: unicast
#      - neighbor_address: 192.0.2.33
#        address_family:
#          - afi: ipv4
#            safi: multicast
#            inherit:
#              template: BasePolicy
#              sequence: 200
#    vrfs:
#      - vrf: site-1
#        neighbors:
#          - neighbor_address: 203.0.113.1
#            address_family:
#              - afi: ipv4
#                safi: unicast
#                suppress_inactive: true
#                next_hop_self:
#                  set: true
#          - neighbor_address: 203.0.113.2
#            address_family:
#              - afi: ipv4
#                safi: multicast
#                send_community:
#                  set: true
#              - afi: ipv6
#                safi: unicast

返回值

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

描述

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", "neighbor 192.0.2.32", "address-family ipv4 unicast"]

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", "neighbor 192.0.2.32", "address-family ipv4 unicast"]

作者

  • Nilashish Chakraborty (@NilashishC)