cisco.iosxr.iosxr_bgp_neighbor_address_family 模块 – 用于配置 BGP 邻居地址族的资源模块。

注意

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

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

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

要在 playbook 中使用它,请指定:cisco.iosxr.iosxr_bgp_neighbor_address_family

cisco.iosxr 2.0.0 中的新功能

概要

  • 此模块在 Cisco IOS-XR 平台上配置和管理 BGP 全局属性。

参数

参数

注释

config

字典

BGP 邻居地址族配置。

as_number

字符串

自治系统号。

neighbors

列表 / 元素=字典

BGP 邻居地址族配置的列表。

address_family

列表 / 元素=字典

启用地址族并进入其配置模式

afi

字符串

地址族。

选项

  • "ipv4"

  • "ipv6"

  • "l2vpn"

  • "link-state"

  • "vpnv4"

  • "vpnv6"

aigp

字典

AIGP 属性

disable

布尔值

忽略 AIGP 属性。

选项

  • false

  • true

send_cost_community_disable

布尔值

发送 AIGP 属性。

选项

  • false

  • true

send_med

字典

发送 MED 选项。

disable

布尔值

disable 在 MED 中发送 AIGP 值。

选项

  • false

  • true

set

布尔值

set 在 MED 中发送 AIGP 值。

选项

  • false

  • true

set

布尔值

设置 AIGP 属性。

选项

  • false

  • true

allowas_in

字典

允许 AS 路径中存在我的 AS。

set

布尔值

set allowas_in

选项

  • false

  • true

value

整数

AS 编号出现的次数 1-10。

as_override

字典

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

inheritance_disable

布尔值

防止从父级继承 as-override。

选项

  • false

  • true

set

布尔值

set as_override

选项

  • false

  • true

bestpath_origin_as_allow_invalid

布尔值

更改默认路由选择标准。允许 BGP origin-AS knobs。

选项

  • false

  • true

capability_orf_prefix

字符串

向此邻居通告地址前缀 ORF 能力。

选项

  • "both"

  • "send"

  • "none"

  • "receive"

default_originate

字典

向此邻居始发默认路由。

inheritance_disable

布尔值

防止从父级继承 default-originate。

选项

  • false

  • true

route_policy

字符串

指定始发默认值的标准的路由策略

set

布尔值

设置默认路由。

选项

  • false

  • true

long_lived_graceful_restart

字典

启用长寿命优雅重启支持。

capable

布尔值

将邻居视为 LLGR 功能。

选项

  • false

  • true

stale_time

字典

清除长期失效路由之前等待的最长时间。

accept

整数

最大接受时间

send

整数

最大发送时间

maximum_prefix

字典

从此对等方接受的最大前缀数。

discard_extra_paths

布尔值

超过限制时丢弃额外的路径。

选项

  • false

  • true

max_limit

整数

最大前缀限制数量。<1-4294967295。

restart

整数

重启时间间隔。

threshold_value

整数

生成警告消息的阈值 (%) <1-100>。

warning_only

布尔值

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

选项

  • false

  • true

multipath

布尔值

来自此邻居的路径符合多路径条件。

选项

  • false

  • true

next_hop_self

字典

禁用此邻居的下一跳计算。

inheritance_disable

布尔值

防止从父级继承 next_hop_self。

选项

  • false

  • true

set

布尔值

设置下一跳 self。

选项

  • false

  • true

next_hop_unchanged

字典

禁用此邻居的下一跳计算。

inheritance_disable

布尔值

防止从父级继承 next_hop_unchanged。

选项

  • false

  • true

multipath

布尔值

在通告多路径之前不要覆盖下一跳。

选项

  • false

  • true

set

布尔值

设置下一跳 unchanged。

选项

  • false

  • true

optimal_route_reflection_group_name

字符串

配置 optimal-route-reflection 组。

orf_route_policy

字符串

指定 ORF 和入站筛选条件。

origin_as

字典

BGP origin-AS knobs。

validation

字典

BGP origin-AS 验证 knobs。

disable

布尔值

禁用 RPKI origin-AS 验证。

选项

  • false

  • true

remove_private_AS

字典

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

entire_aspath

布尔值

仅当路径中的所有 AS 都是私有时才删除。

选项

  • false

  • true

inbound

布尔值

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

选项

  • false

  • true

inheritance_disable

布尔值

防止从父级继承 remove-private-AS。

选项

  • false

  • true

set

布尔值

设置删除私有 AS。

选项

  • false

  • true

route_policy

字典

将路由策略应用于邻居。

inbound

字符串

将路由策略应用于入站路由。

outbound

字符串

将路由策略应用于出站路由。

route_reflector_client

字典

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

inheritance_disable

布尔值

防止从父级继承 route-reflector-client。

选项

  • false

  • true

set

布尔值

设置 route-reflector-client。

选项

  • false

  • true

safi

字符串

地址族修饰符

选项

  • "flowspec"

  • "mdt"

  • "multicast"

  • "mvpn"

  • "rt-filter"

  • "tunnel"

  • "unicast"

  • "labeled-unicast"

send_community_ebgp

字典

将 community 属性发送到此外部邻居。

inheritance_disable

布尔值

防止从父级继承 send_community_ebgp。

选项

  • false

  • true

set

布尔值

设置 send_community_ebgp。

选项

  • false

  • true

send_community_gshut_ebgp

字典

允许将 g-shut community 发送到此外部邻居。

inheritance_disable

布尔值

防止从父级继承 send_community_gshut_ebgp。

选项

  • false

  • true

set

布尔值

设置 send_community_gshut_ebgp。

选项

  • false

  • true

send_extended_community_ebgp

字典

向此外部邻居发送扩展团体属性。

inheritance_disable

布尔值

防止从父级继承 send_extended_community_ebgp。

选项

  • false

  • true

set

布尔值

设置 send_extended_community_ebgp。

选项

  • false

  • true

send_multicast_attributes

字典

向此邻居发送组播属性。

disable

布尔值

禁用发送组播属性。

选项

  • false

  • true

set

布尔值

设置 send_multicast_attributes。

选项

  • false

  • true

soft_reconfiguration

字典

每个邻居的软重配置。

inbound

字典

入站软重配置

始终

布尔值

允许此邻居的入站软重配置。始终使用软重配置,即使支持路由刷新。

选项

  • false

  • true

inheritance_disable

布尔值

防止从父级继承 soft_reconfiguration。

选项

  • false

  • true

set

布尔值

设置 inbound

选项

  • false

  • true

validation

字典

此邻居的 Flowspec 验证。

disable

布尔值

禁用验证。

选项

  • false

  • true

redirect

布尔值

Flowspec 重定向下一跳验证。

选项

  • false

  • true

set

布尔值

设置 validation。

选项

  • false

  • true

weight

整数

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

neighbor_address

字符串 / 必需

邻居路由器地址。

vrfs

列表 / 元素=字典

在 VRF 中配置 BGP 邻居 AF。

neighbors

列表 / 元素=字典

BGP 邻居地址族配置的列表。

address_family

列表 / 元素=字典

启用地址族并进入其配置模式

afi

字符串

地址族。

选项

  • "ipv4"

  • "ipv6"

aigp

字典

AIGP 属性

disable

布尔值

忽略 AIGP 属性。

选项

  • false

  • true

send_cost_community_disable

布尔值

发送 AIGP 属性。

选项

  • false

  • true

send_med

字典

发送 MED 选项。

disable

布尔值

disable 在 MED 中发送 AIGP 值。

选项

  • false

  • true

set

布尔值

set 在 MED 中发送 AIGP 值。

选项

  • false

  • true

set

布尔值

设置 AIGP 属性。

选项

  • false

  • true

allowas_in

字典

允许 AS 路径中存在我的 AS。

set

布尔值

set allowas_in

选项

  • false

  • true

value

整数

AS 编号出现的次数 1-10。

as_override

别名:as_overrride

字典

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

inheritance_disable

布尔值

防止从父级继承 as-override。

选项

  • false

  • true

set

布尔值

set as_override

选项

  • false

  • true

capability_orf_prefix

字符串

向此邻居通告地址前缀 ORF 能力。

选项

  • "both"

  • "send"

  • "none"

  • "receive"

default_originate

字典

向此邻居始发默认路由。

inheritance_disable

布尔值

防止从父级继承 default-originate。

选项

  • false

  • true

route_policy

字符串

指定始发默认值的标准的路由策略

set

布尔值

设置默认路由。

选项

  • false

  • true

long_lived_graceful_restart

字典

启用长寿命优雅重启支持。

capable

布尔值

将邻居视为 LLGR 功能。

选项

  • false

  • true

stale_time

字典

清除长期失效路由之前等待的最长时间。

accept

整数

最大接受时间

send

整数

最大发送时间

maximum_prefix

字典

从此对等方接受的最大前缀数。

discard_extra_paths

布尔值

超过限制时丢弃额外的路径。

选项

  • false

  • true

max_limit

整数

最大前缀限制数量。<1-4294967295。

restart

整数

重启时间间隔。

threshold_value

整数

生成警告消息的阈值 (%) <1-100>。

warning_only

布尔值

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

选项

  • false

  • true

multipath

布尔值

来自此邻居的路径符合多路径条件。

选项

  • false

  • true

next_hop_self

字典

禁用此邻居的下一跳计算。

inheritance_disable

布尔值

防止从父级继承 next_hop_self。

选项

  • false

  • true

set

布尔值

设置下一跳 self。

选项

  • false

  • true

next_hop_unchanged

字典

禁用此邻居的下一跳计算。

inheritance_disable

布尔值

防止从父级继承 next_hop_unchanged。

选项

  • false

  • true

multipath

布尔值

在通告多路径之前不要覆盖下一跳。

选项

  • false

  • true

set

布尔值

设置下一跳 unchanged。

选项

  • false

  • true

optimal_route_reflection_group_name

字符串

配置 optimal-route-reflection 组。

orf_route_policy

字符串

指定 ORF 和入站筛选条件。

remove_private_AS

字典

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

entire_aspath

布尔值

仅当路径中的所有 AS 都是私有时才删除。

选项

  • false

  • true

inbound

布尔值

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

选项

  • false

  • true

inheritance_disable

布尔值

防止从父级继承 remove-private-AS。

选项

  • false

  • true

set

布尔值

设置删除私有 AS。

选项

  • false

  • true

route_policy

字典

将路由策略应用于邻居。

inbound

字符串

将路由策略应用于入站路由。

outbound

字符串

将路由策略应用于出站路由。

route_reflector_client

字典

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

inheritance_disable

布尔值

防止从父级继承 route-reflector-client。

选项

  • false

  • true

set

布尔值

设置 route-reflector-client。

选项

  • false

  • true

safi

字符串

地址族修饰符

选项

  • "flowspec"

  • "multicast"

  • "mvpn"

  • "unicast"

  • "labeled-unicast"

send_community_ebgp

字典

将 community 属性发送到此外部邻居。

inheritance_disable

布尔值

防止从父级继承 send_community_ebgp。

选项

  • false

  • true

set

布尔值

设置 send_community_ebgp。

选项

  • false

  • true

send_community_gshut_ebgp

字典

允许将 g-shut community 发送到此外部邻居。

inheritance_disable

布尔值

防止从父级继承 send_community_gshut_ebgp。

选项

  • false

  • true

set

布尔值

设置 send_community_gshut_ebgp。

选项

  • false

  • true

send_extended_community_ebgp

字典

向此外部邻居发送扩展团体属性。

inheritance_disable

布尔值

防止从父级继承 send_extended_community_ebgp。

选项

  • false

  • true

set

布尔值

设置 send_extended_community_ebgp。

选项

  • false

  • true

site_of_origin

字符串

与邻居关联的起始站点扩展团体。

soft_reconfiguration

字典

每个邻居的软重配置。

inbound

字典

入站软重配置

始终

布尔值

允许此邻居的入站软重配置。始终使用软重配置,即使支持路由刷新。

选项

  • false

  • true

inheritance_disable

布尔值

防止从父级继承 soft_reconfiguration。

选项

  • false

  • true

set

布尔值

设置 inbound

选项

  • false

  • true

validation

字典

此邻居的 Flowspec 验证。

disable

布尔值

禁用验证。

选项

  • false

  • true

redirect

布尔值

Flowspec 重定向下一跳验证。

选项

  • false

  • true

set

布尔值

设置 validation。

选项

  • false

  • true

weight

整数

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

neighbor_address

字符串 / 必需

邻居路由器地址。

vrf

字符串

VRF 名称。

running_config

字符串

此选项仅在状态为 parsed 时使用。

此选项的值应是从 Iosxr 设备执行命令 show running-config router bgp 收到的输出。

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

state

字符串

配置应保留的状态。

选项

  • “已删除”

  • "merged" ← (默认)

  • “已覆盖”

  • “已替换”

  • “已收集”

  • “已呈现”

  • “已解析”

备注

注意

  • 此模块与连接 network_cli 一起使用。

示例

# Using merged
# Before state:
# -------------
# RP/0/0/CPU0:iosxr-02#show running-config router bgp
# Sat Feb 20 03:49:43.618 UTC
# router bgp 65536
#  bgp router-id 192.0.2.1
#  address-family ipv4 unicast
#  address-family vpnv4 unicast
#  neighbor 192.0.2.2
#   remote-as 65537
#  neighbor 192.0.2.3
#   remote-as 65538
#  vrf vrf1
#   rd auto
#   neighbor 192.0.2.4
#    remote-as 65539
#  vrf vrf2
#   rd auto
#   neighbor 192.0.2.5
#    remote-as 65540

- name: Merge the provided configuration with the existing running configuration
  cisco.iosxr.iosxr_bgp_neighbor_address_family:
    state: merged
    config:
      as_number: 65536
      neighbors:
        - neighbor_address: 192.0.2.2
          address_family:
            - afi: ipv4
              safi: unicast
              multipath: true
              default_originate:
                set: true
              weight: 5
        - neighbor_address: 192.0.2.3
          address_family:
            - afi: ipv4
              safi: unicast
              multipath: true
              default_originate:
                set: true
              weight: 4
      vrfs:
        - vrf: vrf1
          neighbors:
            - neighbor_address: 192.0.2.4
              address_family:
                - afi: ipv4
                  safi: unicast
                  multipath: true
                  default_originate:
                    set: true
                  capability_orf_prefix: both
        - vrf: vrf2
          neighbors:
            - neighbor_address: 192.0.2.5
              address_family:
                - afi: ipv4
                  safi: unicast
                  multipath: true
                  default_originate:
                    set: true
                  capability_orf_prefix: both
# Task output
# -------------
# commands:
# - router bgp 65536
# - neighbor 192.0.2.2
# - address-family ipv4 unicast
# - default-originate
# - multipath
# - weight 5
# - neighbor 192.0.2.3
# - address-family ipv4 unicast
# - default-originate
# - multipath
# - weight 4
# - vrf vrf1
# - neighbor 192.0.2.4
# - address-family ipv4 unicast
# - capability orf prefix both
# - default-originate
# - multipath
# - vrf vrf2
# - neighbor 192.0.2.5
# - address-family ipv4 unicast
# - capability orf prefix both
# - default-originate
# - multipath
#
#
# after:
#   as_number: 65536
#   neighbors:
#     - neighbor_address: 192.0.2.2
#       address_family:
#         - afi: "ipv4"
#           safi: "unicast"
#           multipath: true
#           default_originate:
#             set: true
#           weight: 5
#     - neighbor_address: 192.0.2.3
#       address_family:
#         - afi: "ipv4"
#           safi: "unicast"
#           multipath: true
#           default_originate:
#             set: true
#           weight: 4
#   vrfs:
#     - vrf: vrf1
#       neighbors:
#         - neighbor_address: 192.0.2.4
#           address_family:
#             - afi: "ipv4"
#               safi: "unicast"
#               multipath: true
#               default_originate:
#                 set: true
#               capability_orf_prefix: both
#     - vrf: vrf2
#       neighbors:
#         - neighbor_address: 192.0.2.5
#           address_family:
#             - afi: "ipv4"
#               safi: "unicast"
#               multipath: true
#               default_originate:
#                 set: true
#               capability_orf_prefix: both
#
#
# After state:
# -------------
# RP/0/0/CPU0:iosxr-02#show running-config router bgp
# Sat Feb 20 03:49:43.618 UTC
# router bgp 65536
#  bgp router-id 192.0.1.1
#  address-family ipv4 unicast
#  address-family vpnv4 unicast
#  neighbor 192.0.2.2
#   remote-as 65537
#   address-family ipv4 unicast
#     multipath
#     weight 5
#     default-originate
#  neighbor 1.1.1.2
#   remote-as 65538
#   address-family ipv4 unicast
#     multipath
#     weight 5
#     default-originate
#  vrf vrf1
#   rd auto
#   neighbor 192.0.2.4
#    remote-as 65539
#    address-family ipv4 unicast
#     multipath
#     capability orf prefix both
#     default-originate
#  vrf vrf2
#   rd auto
#   neighbor 192.0.2.5
#    remote-as 65540
#    address-family ipv4 unicast
#     multipath
#     capability orf prefix both
#     default-originate
#
#
# Using delete
# Before state:
# -------------
#
# RP/0/0/CPU0:iosxr-02#show running-config router bgp
# Sat Feb 20 03:49:43.618 UTC
# router bgp 65536
#  bgp router-id 192.0.1.1
#  address-family ipv4 unicast
#  address-family vpnv4 unicast
#  neighbor 192.0.2.2
#   remote-as 65537
#   address-family ipv4 unicast
#     multipath
#     weight 5
#     default-originate
#  neighbor 192.0.2.3
#   remote-as 65538
#   address-family ipv4 unicast
#     multipath
#     weight 5
#     default-originate
#  vrf vrf1
#   rd auto
#   neighbor 192.0.2.4
#    remote-as 65539
#    address-family ipv4 unicast
#     multipath
#     capability orf prefix both
#     default-originate
#  vrf vrf2
#   rd auto
#   neighbor 192.0.2.5
#    remote-as 65540
#    address-family ipv4 unicast
#     multipath
#     capability orf prefix both
#     default-originate

- name: Delete the provided configuration
  cisco.iosxr.iosxr_bgp_neighbor_address_family:
    state: deleted
    config:
      as_number: 65536
      neighbors:
        - neighbor_address: 192.0.2.2
          address_family:
            - afi: ipv4
              safi: unicast
              multipath: true
              default_originate:
                set: true
              weight: 5

# Task output
# -------------
#
# commands:
# - router bgp 65536
# - neighbor 192.0.2.2
# - no address-family ipv4 unicast
#
#
# after:
#   as_number: 65536
#   neighbors:
#     - neighbor_address: 192.0.2.3
#       address_family:
#         - afi: "ipv4"
#           safi: "unicast"
#           multipath: true
#           default_originate:
#             set: true
#           weight: 4
#   vrfs:
#     - vrf: vrf1
#       neighbors:
#         - neighbor_address: 192.0.2.4
#           address_family:
#             - afi: "ipv4"
#               safi: "unicast"
#               multipath: true
#               default_originate:
#                 set: true
#               capability_orf_prefix: both
#         - neighbor_address: 192.0.2.5
#           address_family:
#             - afi: "ipv4"
#               safi: "unicast"
#               multipath: true
#               default_originate:
#                 set: true
#               capability_orf_prefix: both
#
#
# Using Replaced
# Before state:
# -------------
#
# RP/0/0/CPU0:iosxr-02#show running-config router bgp
# Sat Feb 20 03:49:43.618 UTC
# router bgp 65536
#  bgp router-id 192.0.1.1
#  address-family ipv4 unicast
#  address-family vpnv4 unicast
#  neighbor 192.0.2.2
#   remote-as 65537
#   address-family ipv4 unicast
#     multipath
#     weight 5
#     default-originate
#  neighbor 192.0.2.3
#   remote-as 65538
#   address-family ipv4 unicast
#     multipath
#     weight 5
#     default-originate
#  vrf vrf1
#   rd auto
#   neighbor 192.0.2.4
#    remote-as 65539
#    address-family ipv4 unicast
#     multipath
#     capability orf prefix both
#     default-originate
#  vrf vrf2
#   rd auto
#   neighbor 192.0.2.5
#    remote-as 65540
#    address-family ipv4 unicast
#     multipath
#     capability orf prefix both
#     default-originate

- name: Replace the provided configuration with the existing running configuration
  cisco.iosxr.iosxr_bgp_neighbor_address_family:
    state: replaced
    config:
      as_number: 65536
      neighbors:
        - neighbor_address: 192.0.2.2
          address_family:
            - afi: ipv4
              safi: unicast
              default_originate:
                set: true
              weight: 4
# Task output
# -------------
# commands:
# - router bgp 65536
# - neighbor 192.0.2.2
# - address-family ipv4 unicast
# - no multipath
# - weight 4
#
# after:
#   as_number: 65536
#   neighbors:
#     - neighbor_address: 192.0.2.2
#       address_family:
#         - afi: "ipv4"
#           safi: "unicast"
#           multipath: true
#           default_originate:
#             set: true
#           weight: 4
#     - neighbor_address: 192.0.2.3
#       address_family:
#         - afi: "ipv4"
#           safi: "unicast"
#           multipath: true
#           default_originate:
#             set: true
#           weight: 5
#   vrfs:
#     - vrf: vrf1
#       neighbors:
#         - neighbor_address: 192.0.2.4
#           address_family:
#             - afi: "ipv4"
#               safi: "unicast"
#               multipath: true
#               default_originate:
#                 set: true
#               capability_orf_prefix: both
#         - neighbor_address: 192.0.2.5
#           address_family:
#             - afi: "ipv4"
#               safi: "unicast"
#               multipath: true
#               default_originate:
#                 set: true
#               capability_orf_prefix: both
#
# After state:
# -------------
# Nexus9000v# show running-config router bgp
# router bgp 65536
#  bgp router-id 192.0.1.1
#  address-family ipv4 unicast
#  address-family vpnv4 unicast
#  neighbor 192.0.2.2
#   remote-as 65537
#   address-family ipv4 unicast
#     multipath
#     weight 4
#     default-originate
#  neighbor 192.0.2.3
#   remote-as 65538
#   address-family ipv4 unicast
#     multipath
#     weight 5
#     default-originate
#  vrf vrf1
#   rd auto
#   neighbor 192.0.2.4
#    remote-as 65539
#    address-family ipv4 unicast
#     multipath
#     capability orf prefix both
#     default-originate
#  vrf vrf2
#   rd auto
#   neighbor 192.0.2.5
#    remote-as 65540
#    address-family ipv4 unicast
#     multipath
#     capability orf prefix both
#     default-originate
#
#
# Using overridden
# Before state:
# -------------
# RP/0/0/CPU0:iosxr-02#show running-config router bgp
# Sat Feb 20 03:49:43.618 UTC
# router bgp 65536
#  bgp router-id 192.0.1.1
#  address-family ipv4 unicast
#  address-family vpnv4 unicast
#  neighbor 192.0.2.2
#   remote-as 65537
#   address-family ipv4 unicast
#     multipath
#     weight 5
#     default-originate
#  neighbor 192.0.2.3
#   remote-as 65538
#   address-family ipv4 unicast
#     multipath
#     weight 5
#     default-originate
#  vrf vrf1
#   rd auto
#   neighbor 192.0.2.4
#    remote-as 65539
#    address-family ipv4 unicast
#     multipath
#     capability orf prefix both
#     default-originate
#  vrf vrf2
#   rd auto
#   neighbor 192.0.2.5
#    remote-as 65540
#    address-family ipv4 unicast
#     multipath
#     capability orf prefix both
#     default-originate

- name: override the provided configuration
  cisco.iosxr.iosxr_bgp_neighbor_address_family:
    state: overridden
    config:
      as_number: 65536
      neighbors:
        - neighbor_address: 192.0.2.2
          address_family:
            - afi: ipv4
              safi: unicast
              multipath: true
              default_originate:
                set: true
              weight: 5
# Task output
# -------------
#
# commands:
# - router bgp 65536
# - neighbor 192.0.2.3
# - no address-family ipv4 unicast
# - vrf vrf1
# - neighbor 192.0.2.4
# - no address-family ipv4 unicast
# - vrf vrf1
# - neighbor 192.0.2.5
# - no address-family ipv4 unicast
#
#
#
# after:
#   as_number: 65536
#   neighbors:
#     - neighbor_address: 192.0.2.2
#       address_family:
#         - afi: "ipv4"
#           safi: "unicast"
#           multipath: true
#           default_originate:
#             set: true
#           weight: 5
#
# After state:
# -------------
# RP/0/0/CPU0:iosxr-02#show running-config router bgp
# Sat Feb 20 03:49:43.618 UTC
# router bgp 65536
#  bgp router-id 192.0.1.1
#  address-family ipv4 unicast
#  address-family vpnv4 unicast
#  neighbor 192.0.2.2
#   remote-as 65537
#   address-family ipv4 unicast
#     multipath
#     weight 5
#     default-originate
#
#
#
# Using rendered
# Before state:
# -------------
# RP/0/0/CPU0:iosxr-02#show running-config router bgp
# Sat Feb 20 03:49:43.618 UTC
# router bgp 65536
#  bgp router-id 192.0.2.1
#  address-family ipv4 unicast
#  address-family vpnv4 unicast
#  neighbor 192.0.2.2
#   remote-as 65537
#  neighbor 192.0.2.3
#   remote-as 65538
#  vrf vrf1
#   rd auto
#   neighbor 192.0.2.4
#    remote-as 65539
#  vrf vrf2
#   rd auto
#   neighbor 192.0.2.5
#    remote-as 65540

- name: >-
    Render platform specific configuration lines with state rendered (without
    connecting to the device)
  cisco.iosxr.iosxr_bgp_neighbor_address_family:
    state: rendered
    config:
      as_number: 65536
      neighbors:
        - neighbor_address: 192.0.2.2
          address_family:
            - afi: ipv4
              safi: unicast
              multipath: true
              default_originate:
                set: true
              weight: 5
        - neighbor_address: 192.0.2.3
          address_family:
            - afi: ipv4
              safi: unicast
              multipath: true
              default_originate:
                set: true
              weight: 4
      vrfs:
        - vrf: vrf1
          neighbors:
            - neighbor_address: 192.0.2.4
              address_family:
                - afi: ipv4
                  safi: unicast
                  multipath: true
                  default_originate:
                    set: true
                  capability_orf_prefix: both
        - vrf: vrf2
          neighbors:
            - neighbor_address: 192.0.2.5
              address_family:
                - afi: ipv4
                  safi: unicast
                  multipath: true
                  default_originate:
                    set: true
                  capability_orf_prefix: both
# Task output
# -------------
# commands:
# - router bgp 65536
# - neighbor 192.0.2.2
# - address-family ipv4 unicast
# - default-originate
# - multipath
# - weight 5
# - neighbor 192.0.2.3
# - address-family ipv4 unicast
# - default-originate
# - multipath
# - weight 4
# - vrf vrf1
# - neighbor 192.0.2.4
# - address-family ipv4 unicast
# - capability orf prefix both
# - default-originate
# - multipath
# - vrf vrf2
# - neighbor 192.0.2.5
# - address-family ipv4 unicast
# - capability orf prefix both
# - default-originate
# - multipath
#
# Using parsed
#
# parsed.cfg
# ------------
# router bgp 65536
#  bgp router-id 192.0.1.1
#  address-family ipv4 unicast
#  address-family vpnv4 unicast
#  neighbor 192.0.2.2
#   remote-as 65537
#   address-family ipv4 unicast
#     multipath
#     weight 5
#     default-originate
#  neighbor 1.1.1.2
#   remote-as 65538
#   address-family ipv4 unicast
#     multipath
#     weight 5
#     default-originate
#  vrf vrf1
#   rd auto
#   neighbor 192.0.2.4
#    remote-as 65539
#    address-family ipv4 unicast
#     multipath
#     capability orf prefix both
#     default-originate
#  vrf vrf2
#   rd auto
#   neighbor 192.0.2.5
#    remote-as 65540
#    address-family ipv4 unicast
#     multipath
#     capability orf prefix both
#     default-originate

- name: Parse externally provided BGP neighbor AF config
  cisco.iosxr.iosxr_bgp_neighbor_address_family:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed
# Task output (redacted)
# -----------------------
# parsed:
#   as_number: 65536
#   neighbors:
#     - neighbor_address: 192.0.2.2
#       address_family:
#         - afi: "ipv4"
#           safi: "unicast"
#           multipath: true
#           default_originate:
#             set: true
#           weight: 5
#     - neighbor_address: 192.0.2.3
#       address_family:
#         - afi: "ipv4"
#           safi: "unicast"
#           multipath: true
#           default_originate:
#             set: true
#           weight: 4
#   vrfs:
#     - vrf: vrf1
#       neighbors:
#         - neighbor_address: 192.0.2.4
#           address_family:
#             - afi: "ipv4"
#               safi: "unicast"
#               multipath: true
#               default_originate:
#                 set: true
#               capability_orf_prefix: both
#     - vrf: vrf2
#       neighbors:
#         - neighbor_address: 192.0.2.5
#           address_family:
#             - afi: "ipv4"
#               safi: "unicast"
#               multipath: true
#               default_originate:
#                 set: true
#               capability_orf_prefix: both
#
#
# Using Gathered
# -----------------
# Before state state:
# -------------
# RP/0/0/CPU0:iosxr-02#show running-config router bgp
# Sat Feb 20 03:49:43.618 UTC
# router bgp 65536
#  bgp router-id 192.0.1.1
#  address-family ipv4 unicast
#  address-family vpnv4 unicast
#  neighbor 192.0.2.2
#   remote-as 65537
#   address-family ipv4 unicast
#     multipath
#     weight 5
#     default-originate
#  neighbor 1.1.1.2
#   remote-as 65538
#   address-family ipv4 unicast
#     multipath
#     weight 5
#     default-originate
#  vrf vrf1
#   rd auto
#   neighbor 192.0.2.4
#    remote-as 65539
#    address-family ipv4 unicast
#     multipath
#     capability orf prefix both
#     default-originate
#  vrf vrf2
#   rd auto
#   neighbor 192.0.2.5
#    remote-as 65540
#    address-family ipv4 unicast
#     multipath
#     capability orf prefix both
#     default-originate
#
#
#
- name: Gathered the provided configuration with the existing running configuration
  cisco.iosxr.iosxr_bgp_neighbor_address_family:
    config:
    state: gathered


# Task output
# -----------------------
# gathered:
#   as_number: 65536
#   neighbors:
#     - neighbor_address: 192.0.2.2
#       address_family:
#         - afi: "ipv4"
#           safi: "unicast"
#           multipath: true
#           default_originate:
#             set: true
#           weight: 5
#     - neighbor_address: 192.0.2.3
#       address_family:
#         - afi: "ipv4"
#           safi: "unicast"
#           multipath: true
#           default_originate:
#             set: true
#           weight: 4
#   vrfs:
#     - vrf: vrf1
#       neighbors:
#         - neighbor_address: 192.0.2.4
#           address_family:
#             - afi: "ipv4"
#               safi: "unicast"
#               multipath: true
#               default_originate:
#                 set: true
#               capability_orf_prefix: both
#     - vrf: vrf2
#       neighbors:
#         - neighbor_address: 192.0.2.5
#           address_family:
#             - afi: "ipv4"
#               safi: "unicast"
#               multipath: true
#               default_originate:
#                 set: true
#               capability_orf_prefix: both
#

作者

  • Ashwini Mhatre (@amhatre)