dellemc.enterprise_sonic.sonic_bgp_neighbors 模块 – 管理 BGP 邻居及其参数

注意

此模块是 dellemc.enterprise_sonic 集合 (版本 2.5.1) 的一部分。

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

要安装它,请使用: ansible-galaxy collection install dellemc.enterprise_sonic

要在剧本中使用它,请指定: dellemc.enterprise_sonic.sonic_bgp_neighbors

dellemc.enterprise_sonic 1.0.0 中的新增功能

概要

  • 此模块提供在运行 Enterprise SONiC 的设备上全局 BGP_NEIGHBORS 参数的配置管理。

  • 必须预先在设备上创建 bgp_as 和 vrf_name。

注意

此模块具有相应的 action 插件

参数

参数

注释

config

列表 / 元素=字典

指定与 BGP 邻居相关的配置。

bgp_as

字符串 / 必需

指定已在设备上配置的 BGP 自治系统 (AS) 号。

neighbors

列表 / 元素=字典

指定与 BGP 邻居相关的配置。

advertisement_interval

整数

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

范围是 0 到 600。

auth_pwd

字典

邻居组身份验证密码的配置。

encrypted

布尔值

指示密码是否是加密文本。

选项

  • false ← (默认)

  • true

pwd

字符串 / 必需

邻居组的身份验证密码。

bfd

字典

启用或禁用 BFD。

check_failure

布尔值

将链路数据平面状态与控制平面关联。

选项

  • false

  • true

enabled

布尔值

为 BGP 邻居启用 BFD 活动检查。

选项

  • false

  • true

profile

字符串

BFD 配置文件名称。

capability

字典

为此邻居指定能力属性。

dynamic

布尔值

为此邻居启用或禁用动态能力。

选项

  • false

  • true

extended_nexthop

布尔值

启用或禁用向对等体通告扩展的下一跳能力。

选项

  • false

  • true

disable_connected_check

布尔值

禁用 EBGP 连接路由检查。

选项

  • false

  • true

dont_negotiate_capability

布尔值

禁用能力协商。

选项

  • false

  • true

ebgp_multihop

字典

允许不在直接连接网络上的 EBGP 邻居。

enabled

布尔值

启用参考组或邻居的间接连接。

选项

  • false ← (默认)

  • true

multihop_ttl

整数

当启用 ebgp-multihop 时,发送到参考组或邻居的数据包所使用的生存时间值。

enforce_first_as

布尔值

强制执行 EBGP 路由的第一个 AS。

选项

  • false

  • true

enforce_multihop

布尔值

强制执行邻居的 EBGP 多跳性能。

选项

  • false

  • true

local_address

字符串

设置发送 BGP 更新消息时要使用的会话的本地 IP 地址。

local_as

字典

指定本地自治系统编号。

as

字符串 / 必需

本地自治系统编号。

no_prepend

布尔值

不要在 AS-Path 通告中预先添加本地 AS 号。

选项

  • false

  • true

replace_as

布尔值

在 AS-Path 通告中将配置的 AS 号替换为本地 AS 号。

选项

  • false

  • true

nbr_description

字符串

邻居的文本描述。

neighbor

字符串 / 必需

邻居路由器地址。

override_capability

布尔值

覆盖能力协商结果。

选项

  • false

  • true

passive

布尔值

不要向此邻居发送 open 消息。

添加新邻居时的默认值为 False

选项

  • false

  • true

peer_group

字符串

邻居所属的对等组的名称。

port

整数

邻居的 BGP 端口。

remote_as

字典

要配置的 BGP 邻居的远程 AS。

peer_as 和 peer_type 是互斥的。

peer_as

字符串

指定远程 AS 号。

范围是 1 到 4294967295。

peer_type

字符串

指定 BGP 对等体的类型。

选项

  • "internal"

  • "external"

shutdown_msg

字符串

添加关机消息。

solo

布尔值

指示对等体通告的路由不应反映回对等体。

选项

  • false

  • true

strict_capability_match

布尔值

启用严格的能力协商匹配。

选项

  • false

  • true

timers

字典

指定与 BGP 邻居计时器相关的配置。

connect_retry

整数

尝试与对等体建立会话之间的间隔(秒)。

范围是 1 到 65535。

holdtime

整数

未收到 keepalive 消息后,SONiC 声明对等体已失效的时间间隔(秒)。

范围是 0 到 65535。

keepalive

整数

设备向其对等体发送 keepalive 消息的频率(秒)。

范围是 0 到 65535。

ttl_security

整数

强制执行只有指定跳数的邻居才能成为邻居。

v6only

布尔值

仅使用 v6 链路本地启用 BGP。

选项

  • false

  • true

peer_group

列表 / 元素=字典

指定对等组的列表。

address_family

字典

包含与对等组关联的地址族列表。

afis

列表 / 元素=字典

具有 afi、safi、activate 和 allowas-in 参数的地址族列表。

afi 和 safi 必须一起使用。

activate

布尔值

启用或禁用激活。

选项

  • false

  • true

afi

字符串 / 必需

包含 afi 模式。

选项

  • "ipv4"

  • "ipv6"

  • "l2vpn"

allowas_in

字典

包含 AS 值。

origin 和 value 是互斥的。

origin

布尔值

将 AS 设置为源。

选项

  • false

  • true

value

整数

保存AS号,范围为1-10。

ip_afi

字典

IPv4和IPv6单播地址族的常用配置属性。

default_policy_name

字符串

指定路由策略定义。

send_default_route

布尔值

启用或禁用向对端发送默认路由。

选项

  • false ← (默认)

  • true

prefix_limit

字典

指定ipv4-unicast和ipv6-unicast的前缀限制属性。

max_prefixes

整数

将从对端接受的最大前缀数。

prevent_teardown

布尔值

超过最大前缀限制时,启用或禁用BGP会话的拆除。

选项

  • false ← (默认)

  • true

restart_timer

整数

BGP会话在被拆除后重新建立的时间间隔(秒)。

warning_threshold

整数

在生成警告消息之前,可以从对端接收到的前缀数量的阈值。

表示为max-prefixes的百分比。

prefix_list_in

字符串

对端的入站路由过滤策略。

prefix_list_out

字符串

对端的出站路由过滤策略。

safi

字符串

保存safi模式。

选项

  • "unicast"

  • "evpn"

advertisement_interval

整数

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

范围是 0 到 600。

auth_pwd

字典

对等组身份验证密码的配置。

encrypted

布尔值

指示密码是否是加密文本。

选项

  • false ← (默认)

  • true

pwd

字符串 / 必需

对等组的身份验证密码。

bfd

字典

启用或禁用 BFD。

check_failure

布尔值

将链路数据平面状态与控制平面关联。

选项

  • false

  • true

enabled

布尔值

启用BGP对端的BFD活动性检查。

选项

  • false

  • true

profile

字符串

BFD 配置文件名称。

capability

字典

向该对等组指定功能属性。

dynamic

布尔值

启用或禁用该对等组的动态功能。

选项

  • false

  • true

extended_nexthop

布尔值

启用或禁用向对等体通告扩展的下一跳能力。

选项

  • false

  • true

disable_connected_check

布尔值

禁用 EBGP 连接路由检查。

选项

  • false

  • true

dont_negotiate_capability

布尔值

禁用能力协商。

选项

  • false

  • true

ebgp_multihop

字典

允许不在直接连接网络上的EBGP对等体。

enabled

布尔值

启用引用的组或对等体间接连接。

选项

  • false ← (默认)

  • true

multihop_ttl

整数

当启用ebgp-multihop时,向引用的组或对等体发送数据包时使用的生存时间值。

enforce_first_as

布尔值

强制执行 EBGP 路由的第一个 AS。

选项

  • false

  • true

enforce_multihop

布尔值

对对等体强制执行EBGP多跳性能。

选项

  • false

  • true

local_address

字符串

设置发送 BGP 更新消息时要使用的会话的本地 IP 地址。

local_as

字典

指定本地自治系统编号。

as

字符串 / 必需

本地自治系统编号。

no_prepend

布尔值

不要在 AS-Path 通告中预先添加本地 AS 号。

选项

  • false

  • true

replace_as

布尔值

在 AS-Path 通告中将配置的 AS 号替换为本地 AS 号。

选项

  • false

  • true

name

字符串 / 必需

对等组的名称。

override_capability

布尔值

覆盖能力协商结果。

选项

  • false

  • true

passive

布尔值

不要向此对等体发送open消息。

添加新对等组时的默认值为False

选项

  • false

  • true

pg_description

字符串

对等组的文本描述。

remote_as

字典

要配置的BGP对等组的远程AS。

peer_as 和 peer_type 是互斥的。

peer_as

字符串

指定远程 AS 号。

范围是 1 到 4294967295。

peer_type

字符串

指定 BGP 对等体的类型。

选项

  • "internal"

  • "external"

shutdown_msg

字符串

添加关机消息。

solo

布尔值

指示对等体通告的路由不应反映回对等体。

选项

  • false

  • true

strict_capability_match

布尔值

启用严格的能力协商匹配。

选项

  • false

  • true

timers

字典

指定BGP对等组计时器相关的配置。

connect_retry

整数

尝试与对等体建立会话之间的间隔(秒)。

范围是 1 到 65535。

holdtime

整数

在未收到keepalive消息后,Enterprise SONiC声明对端失效的时间间隔(秒)。

范围是 0 到 65535。

keepalive

整数

设备向其对等体发送 keepalive 消息的频率(秒)。

范围是 0 到 65535。

ttl_security

整数

仅强制执行距离指定跳数的对等体才能成为对等体。

vrf_name

字符串

指定已在设备上配置的VRF名称。

默认值:"default"

state

字符串

指定要对设备上配置的BGP进程执行的操作。

如果是merged,则输入配置将与设备上现有的BGP配置合并。

如果是deleted,则从设备中删除现有的BGP配置。

如果是replaced,则设备上现有的BGP配置将被输入的BGP配置替换。

如果是overridden,则现有的BGP配置将被输入的BGP配置覆盖。

选项

  • "merged" ← (默认)

  • "deleted"

  • "replaced"

  • "overridden"

注释

注意

  • 在戴尔科技的Enterprise SONiC发行版上进行了测试。

  • 支持check_mode

示例

# Using deleted
#
# Before state:
# -------------
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# neighbor interface Eth1/3
#!
#router bgp 11
# network import-check
# timers 60 180
# !
# neighbor 192.168.1.4
# !
# peer-group SP1
#  timers connect 30
#  advertisement-interval 0
#  bfd
#  capability dynamic
# !
# peer-group SP2
#  timers connect 30
#  advertisement-interval 0
# !
#

- name: Deletes all BGP neighbors
  dellemc.enterprise_sonic.sonic_bgp_neighbors:
    config:
    state: deleted

#
# After state:
# -------------
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
#!
#router bgp 11
# network import-check
# timers 60 180
#!
#

# Using merged
#
# Before state:
# ------------
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
#!
#router bgp 11
# network import-check
# timers 60 180
# !

- name: "Adds sonic_bgp_neighbors"
  dellemc.enterprise_sonic.sonic_bgp_neighbors:
    config:
     - bgp_as: 51
       neighbors:
         - neighbor: Eth1/2
           auth_pwd:
             pwd: 'pw123'
             encrypted: false
           dont_negotiate_capability: true
           ebgp_multihop:
             enabled: true
             multihop_ttl: 1
           enforce_first_as: true
           enforce_multihop: true
           local_address: 'Ethernet4'
           local_as:
             as: 2
             no_prepend: true
             replace_as: true
           nbr_description: "description 1"
           override_capability: true
           passive: true
           port: 3
           shutdown_msg: 'msg1'
           solo: true
         - neighbor: 1.1.1.1
           disable_connected_check: true
           ttl_security: 5
     - bgp_as: 51
       vrf_name: VrfReg1
       peer_group:
         - name: SPINE
           bfd:
             check_failure: true
             enabled: true
             profile: 'profile 1'
           capability:
             dynamic: true
             extended_nexthop: true
           auth_pwd:
             pwd: 'U2FsdGVkX1/4sRsZ624wbAJfDmagPLq2LsGDOcW/47M='
             encrypted: true
           dont_negotiate_capability: true
           ebgp_multihop:
             enabled: true
             multihop_ttl: 1
           enforce_first_as: true
           enforce_multihop: true
           local_address: 'Ethernet4'
           local_as:
             as: 2
             no_prepend: true
             replace_as: true
           pg_description: 'description 1'
           override_capability: true
           passive: true
           solo: true
           remote_as:
             peer_as: 4
         - name: SPINE1
           disable_connected_check: true
           shutdown_msg: "msg1"
           strict_capability_match: true
           timers:
             keepalive: 30
             holdtime: 15
             connect_retry: 25
           ttl_security: 5
           address_family:
             afis:
               - afi: ipv4
                 safi: unicast
                 activate: true
                 allowas_in:
                   origin: true
               - afi: ipv6
                 safi: unicast
                 activate: true
                 allowas_in:
                   value: 5
       neighbors:
         - neighbor: Eth1/3
           remote_as:
             peer_as: 10
           peer_group: SPINE
           advertisement_interval: 15
           timers:
             keepalive: 30
             holdtime: 15
             connect_retry: 25
           bfd:
             check_failure: true
             enabled: true
             profile: 'profile 1'
           capability:
             dynamic: true
             extended_nexthop: true
           auth_pwd:
               pwd: 'U2FsdGVkX199MZ7YOPkOR9O6wEZmtGSgiDfnlcN9hBg='
               encrypted: true
           nbr_description: 'description 2'
           strict_capability_match: true
           v6only: true
         - neighbor: 192.168.1.4
    state: merged

#
# After state:
# ------------
#!
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE1
#  timers 15 30
#  timers connect 25
#  advertisement-interval 0
#  shutdown message msg1
#  disable-connected-check
#  strict-capability-match
#  ttl-security hops 5
# !
# peer-group SPINE
#  description "description 1"
#  ebgp-multihop 1
#  remote-as 4
#  timers connect 30
#  advertisement-interval 0
#  bfd check-control-plane-failure profile "profile 1"
#  update-source interface Ethernet4
#  capability dynamic
#  capability extended-nexthop
#  dont-capability-negotiate
#  enforce-first-as
#  enforce-multihop
#  local-as 2 no-prepend replace-as
#  override-capability
#  passive
#  password U2FsdGVkX1/4sRsZ624wbAJfDmagPLq2LsGDOcW/47M= encrypted
#  solo
#  address-family ipv4 unicast
#   activate
#   allowas-in origin
#   send-community both
# !
#  address-family ipv6 unicast
#   activate
#   allowas-in 5
#   send-community both
# !
# neighbor interface Eth1/3
#  description "description 2"
#  peer-group SPINE
#  remote-as 10
#  timers 15 30
#  timers connect 25
#  bfd check-control-plane-failure profile "profile 1"
#  advertisement-interval 15
#  capability extended-nexthop
#  capability dynamic
#  v6only
#  password U2FsdGVkX199MZ7YOPkOR9O6wEZmtGSgiDfnlcN9hBg= encrypted
#  strict-capability-match
# !
# neighbor 192.168.1.4
#!
#router bgp 51
# network import-check
# timers 60 180
# !
# neighbor interface Eth1/2
#  description "description 1"
#  shutdown message msg1
#  ebgp-multihop 1
#  remote-as external
#  update-source interface Ethernet4
#  dont-capability-negotiate
#  enforce-first-as
#  enforce-multihop
#  local-as 2 no-prepend replace-as
#  override-capability
#  passive
#  password U2FsdGVkX1+bxMf9TKOhaXRNNaHmywiEVDF2lJ2c000= encrypted
#  port 3
#  solo
# neighbor 1.1.1.1
#  disable-connected-check
#  ttl-security hops 5
#router bgp 11
# network import-check
# timers 60 180
#

# Using deleted
#
# Before state:
# ------------
#!
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE
#  bfd
#  remote-as 4
#  timers connect 30
#  advertisement-interval 0
# !
# neighbor interface Eth1/3
#  peer-group SPINE
#  remote-as 10
#  timers 15 30
#  advertisement-interval 15
#  bfd
#  capability extended-nexthop
#  capability dynamic
# !
# neighbor 192.168.1.4
#!
#router bgp 11
# network import-check
# timers 60 180
# !
# peer-group SP
#  timers connect 30
#  advertisement-interval 0
# !
# neighbor interface Eth1/3
#

- name: "Deletes sonic_bgp_neighbors and peer-groups specific to vrfname"
  dellemc.enterprise_sonic.sonic_bgp_neighbors:
    config:
     - bgp_as: 51
       vrf_name: VrfReg1
    state: deleted

# After state:
# ------------
#!
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
#router bgp 11
# network import-check
# timers 60 180
# !
# peer-group SP
#  timers connect 30
#  advertisement-interval 0
# !
# neighbor interface Eth1/3
#

# Using deleted
#
# Before state:
# -------------
#
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE
#  bfd
#  remote-as 4
#  timers connect 30
#  advertisement-interval 0
# !
# neighbor interface Eth1/3
#  peer-group SPINE
#  remote-as 10
#  timers 15 30
#  advertisement-interval 15
#  bfd
#  capability extended-nexthop
#  capability dynamic
# !
# neighbor 192.168.1.4
# !

- name: "Deletes specific sonic_bgp_neighbors"
  dellemc.enterprise_sonic.sonic_bgp_neighbors:
    config:
     - bgp_as: 51
       neighbors:
         - neighbor: Eth1/2
           auth_pwd:
             pwd: 'pw123'
             encrypted: false
           dont_negotiate_capability: true
           ebgp_multihop:
             enabled: true
             multihop_ttl: 1
           enforce_first_as: true
           enforce_multihop: true
           local_address: 'Ethernet4'
           local_as:
             as: 2
             no_prepend: true
             replace_as: true
           nbr_description: 'description 1'
           override_capability: true
           passive: true
           port: 3
           shutdown_msg: 'msg1'
           solo: true
         - neighbor: 1.1.1.1
           disable_connected_check: true
           ttl_security: 5
     - bgp_as: 51
       vrf_name: VrfReg1
       peer_group:
         - name: SPINE
           bfd:
             check_failure: true
             enabled: true
             profile: 'profile 1'
           capability:
             dynamic: true
             extended_nexthop: true
           auth_pwd:
             pwd: 'U2FsdGVkX1/4sRsZ624wbAJfDmagPLq2LsGDOcW/47M='
             encrypted: true
           dont_negotiate_capability: true
           ebgp_multihop:
             enabled: true
             multihop_ttl: 1
           enforce_first_as: true
           enforce_multihop: true
           local_address: 'Ethernet4'
           local_as:
             as: 2
             no_prepend: true
             replace_as: true
           pg_description: 'description 1'
           override_capability: true
           passive: true
           solo: true
           remote_as:
             peer_as: 4
         - name: SPINE1
           disable_connected_check: true
           shutdown_msg: "msg1"
           strict_capability_match: true
           timers:
             keepalive: 30
             holdtime: 15
             connect_retry: 25
           ttl_security: 5
       neighbors:
         - neighbor: Eth1/3
           remote_as:
             peer_as: 10
           peer_group: SPINE
           advertisement_interval: 15
           timers:
             keepalive: 30
             holdtime: 15
             connect_retry: 25
           bfd:
             check_failure: true
             enabled: true
             profile: 'profile 1'
           capability:
             dynamic: true
             extended_nexthop: true
           auth_pwd:
             pwd: 'U2FsdGVkX199MZ7YOPkOR9O6wEZmtGSgiDfnlcN9hBg='
             encrypted: true
           nbr_description: 'description 2'
           strict_capability_match: true
           v6only: true
         - neighbor: 192.168.1.4
    state: deleted

#
# After state:
# -------------
#
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE1
#  timers connect 30
#  advertisement-interval 0
# !
# peer-group SPINE
#  timers connect 30
#  advertisement-interval 0
# !
# neighbor interface Eth1/3
# !
# neighbor interface Eth1/2
# !
# neighbor 1.1.1.1
#

# Using merged
#
# Before state:
# -------------
#
# sonic# show running-configuration bgp peer-group vrf default
# (No bgp peer-group configuration present)

- name: "Configure BGP peer-group prefix-list attributes"
  dellemc.enterprise_sonic.sonic_bgp_neighbors:
    config:
     - bgp_as: 51
       peer_group:
         - name: SPINE
           address_family:
             afis:
               - afi: ipv4
                 safi: unicast
                 ip_afi:
                   default_policy_name: rmap_reg1
                   send_default_route: true
                 prefix_limit:
                   max_prefixes: 1
                   prevent_teardown: true
                   warning_threshold: 80
                 prefix_list_in: p1
                 prefix_list_out: p2
    state: merged

# After state:
# ------------
#
# sonic# show running-configuration bgp peer-group vrf default
# !
# peer-group SPINE
#  timers connect 30
#  advertisement-interval 0
#  !
#  address-family ipv4 unicast
#   default-originate route-map rmap_reg1
#   prefix-list p1 in
#   prefix-list p2 out
#   send-community both
#   maximum-prefix 1 80 warning-only
#

# Using deleted
#
# Before state:
# -------------
#
# sonic# show running-configuration bgp peer-group vrf default
# !
# peer-group SPINE
#  timers connect 30
#  advertisement-interval 0
#  !
#  address-family ipv6 unicast
#   default-originate route-map rmap_reg2
#   prefix-list p1 in
#   prefix-list p2 out
#   send-community both
#   maximum-prefix 5 90 restart 2

- name: "Delete BGP peer-group prefix-list attributes"
  dellemc.enterprise_sonic.sonic_bgp_neighbors:
    config:
     - bgp_as: 51
       peer_group:
         - name: SPINE
           address_family:
             afis:
               - afi: ipv6
                 safi: unicast
                 ip_afi:
                   default_policy_name: rmap_reg2
                   send_default_route: true
                 prefix_limit:
                   max_prefixes: 5
                   warning_threshold: 90
                   restart-timer: 2
                 prefix_list_in: p1
                 prefix_list_out: p2
    state: deleted

# After state:
# ------------
#
# sonic# show running-configuration bgp peer-group vrf default
# !
# peer-group SPINE
#  timers connect 30
#  advertisement-interval 0
#  !
#  address-family ipv6 unicast
#    send-community both
#  !

#
# Using replaced
#
# Before state:
# ------------
#!
#router bgp 51 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE3
#  bfd
#  remote-as 4
#  timers connect 30
#  advertisement-interval 0
# !
# neighbor interface Eth1/3
#  remote-as 10
#  timers 15 30
#  advertisement-interval 15
#  bfd
#  capability extended-nexthop
#  capability dynamic
# !
# neighbor 192.168.1.4
#!
#router bgp 51
# network import-check
# timers 60 18
# !
# peer-group SP
#  timers connect 30
#  advertisement-interval 0
# !
# neighbor interface Eth1/3
#

- name: "Replaces peer-groups specific to vrfname"
  dellemc.enterprise_sonic.sonic_bgp_neighbors:
    config:
    - bgp_as: 51
      vrf_name: VrfReg1
      peer_group:
        - name: SPINE3
          remote_as:
            peer_type: internal
        - name: SPINE4
          address_family:
            afis:
              - afi: ipv4
                safi: unicast
                allowas_in:
                  origin: true
    state: replaced

# After state:
# ------------
#!
#router bgp 51 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE3
#  remote-as internal
#  timers connect 30
#  advertisement-interval 0
# !
# peer-group SPINE4
#  timers connect 30
#  advertisement-interval 0
#  !
#  address-family ipv4 unicast
#   allowas-in origin
#   send-community both
#!
# neighbor interface Eth1/3
#  remote-as 10
#  timers 15 30
#  advertisement-interval 15
#  bfd
#  capability extended-nexthop
#  capability dynamic
# !
# neighbor 192.168.1.4
#!
#router bgp 51
# network import-check
# timers 60 18
# !
# peer-group SP
#  timers connect 30
#  advertisement-interval 0
# !
# neighbor interface Eth1/3
#
#

# Using replaced
#
# Before state:
# ------------
#!
#router bgp 51 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE
#  bfd
#  remote-as 4
#  timers connect 30
#  advertisement-interval 0
# !
# neighbor 192.168.1.1
#  peer-group SPINE
#  remote-as 10
#  timers 15 30
#  advertisement-interval 15
#  bfd
#  capability extended-nexthop
#  capability dynamic
# !
# neighbor 192.168.1.4
#!
#router bgp 51
# network import-check
# timers 60 18
# !
# peer-group SP
#  timers connect 30
#  advertisement-interval 0
# !
# neighbor interface Eth1/3
#

- name: "Replaces sonic_bgp_neighbors specific to vrfname"
  dellemc.enterprise_sonic.sonic_bgp_neighbors:
    config:
    - bgp_as: 51
      vrf_name: VrfReg1
      neighbors:
        - neighbor: 192.168.1.1
          bfd:
            enabled: true
          capability:
            extended_nexthop: true
            dynamic: true
    state: replaced

# After state:
# ------------
#!
#router bgp 51 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE
#  bfd
#  remote-as 4
#  timers connect 30
#  advertisement-interval 0
# !
# neighbor 192.168.1.1
#  bfd
#  capability extended-nexthop
#  capability dynamic
# !
# neighbor 192.168.1.4
#!
#router bgp 51
# network import-check
# timers 60 18
# !
# peer-group SP
#  timers connect 30
#  advertisement-interval 0
# !
# neighbor interface Eth1/3
#

# Using overridden
#
# Before state:
# ------------
#!
#router bgp 51 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE
#  bfd
#  remote-as 4
#  timers connect 30
#  advertisement-interval 0
# !
# neighbor interface Eth1/3
#  peer-group SPINE
#  remote-as 10
#  timers 15 30
#  advertisement-interval 15
#  bfd
#  capability extended-nexthop
#  capability dynamic
# !
# neighbor 192.168.1.4
#!
#router bgp 51
# network import-check
# timers 60 18
# !
# peer-group SP
#  timers connect 30
#  advertisement-interval 0
# !
# neighbor interface Eth1/3
#

- name: "Override sonic_bgp_neighbors and peer-groups specific to vrfname"
  dellemc.enterprise_sonic.sonic_bgp_neighbors:
    config:
    - bgp_as: 51
      vrf_name: VrfReg1
      peer_group:
        - name: SPINE3
          remote_as:
            peer_type: internal
        - name: SPINE4
          address_family:
            afis:
              - afi: ipv4
                safi: unicast
                allowas_in:
                  origin: true
    state: overridden

# After state:
# ------------
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE3
#  remote-as internal
#  timers connect 30
#  advertisement-interval 0
# !
# peer-group SPINE4
#  timers connect 30
#  advertisement-interval 0
#  !
#  address-family ipv4 unicast
#   allowas-in origin
#   send-community both
#!
#

返回值

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

描述

after

列表 / 元素=字符串

生成的配置模块调用。

返回:发生更改时

示例:["返回的配置始终与上面的参数格式相同。\n"]

after(generated)

列表 / 元素=字符串

生成的配置模块调用。

返回:check_mode

示例:["返回的配置始终与上面的参数格式相同。\n"]

before

列表 / 元素=字符串

模块调用之前的配置。

返回:始终

示例:["返回的配置始终与上面的参数格式相同。\n"]

commands

列表 / 元素=字符串

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

返回:始终

示例:["命令 1", "命令 2", "命令 3"]

作者

  • Abirami N (@abirami-n)