dellemc.enterprise_sonic.sonic_bgp 模块 – 管理全局 BGP 及其参数

注意

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

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

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

要在 playbook 中使用它,请指定:dellemc.enterprise_sonic.sonic_bgp

dellemc.enterprise_sonic 1.0.0 中的新增功能

概要

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

注意

此模块具有相应的 操作插件

参数

参数

注释

config

list / elements=dictionary

指定与 BGP 相关的配置。

as_notation

string

指定 AS 编号表示法格式

Enterprise-Sonic 4.4.0 及更高版本支持的选项。

选择

  • "asdot"

  • "asdot+"

bestpath

dictionary

配置 BGP 最佳路径。

as_path

dictionary

配置 as-path 值。

confed

boolean

配置 as-path 的 confed 值。

选择

  • false

  • true

ignore

boolean

配置 as-path 的 ignore 值。

选择

  • false

  • true

multipath_relax

boolean

配置 as-path 的 multipath_relax 值。

选择

  • false

  • true

multipath_relax_as_set

boolean

配置 as-path 的 multipath_relax_as_set 值。

选择

  • false

  • true

compare_routerid

boolean

配置 compare_routerid。

选择

  • false

  • true

med

dictionary

配置 med 值。

always_compare_med

boolean

如果设置为 true,则允许比较来自不同邻居的 med

选择

  • false

  • true

confed

boolean

配置 med 的 confed 值。

选择

  • false

  • true

missing_as_worst

boolean

配置 as-path 的 missing_as_worst 值。

选择

  • false

  • true

bgp_as

string / required

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

log_neighbor_changes

boolean

启用/禁用记录邻居启动/关闭和重置原因。

选择

  • false

  • true

max_med

dictionary

配置最大 med 及其参数

on_startup

dictionary

启动时间和最大 med 值

med_val

integer

启动时的 med 值

timer

integer

配置启动时间

router_id

string

配置 BGP 路由进程 router-id 值。

rt_delay

integer

在处理路由映射更改之前等待的时间(以秒为单位)。

范围是 0-600。0 会禁用计时器,并且不会更新路由映射的更改。

timers

dictionary

调整路由计时器

holdtime

integer

配置保持时间

keepalive_interval

integer

配置 keepalive 间隔

vrf_name

string

指定 VRF 名称。

默认值: "default"

state

string

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

在合并的情况下,输入配置将与设备上现有的 BGP 配置合并。

在删除的情况下,现有的 BGP 配置将从设备中删除。

在替换的情况下,指定 BGP AS 的现有配置将被提供的配置替换。

在覆盖的情况下,现有的 BGP 配置将被提供的配置覆盖。

选择

  • "merged" ←(默认)

  • "deleted"

  • "replaced"

  • "overridden"

注意

注意

  • 已针对 Dell Technologies 的 Enterprise SONiC Distribution 进行测试。

  • 支持 check_mode

示例

# Using deleted
#
# Before state:
# -------------
#
# !
# router bgp 10 vrf VrfCheck1
#  router-id 10.2.2.32
#  route-map delay-timer 20
#  log-neighbor-changes
# !
# router bgp 11 vrf VrfCheck2
#  log-neighbor-changes
#  bestpath as-path ignore
#  bestpath med missing-as-worst confed
#  bestpath compare-routerid
# !
# router bgp 4
#  router-id 10.2.2.4
#  route-map delay-timer 10
#  bestpath as-path ignore
#  bestpath as-path confed
#  bestpath med missing-as-worst confed
#  bestpath compare-routerid
# !
#
- name: Delete BGP Global attributes
  dellemc.enterprise_sonic.sonic_bgp:
    config:
       - bgp_as: 4
         router_id: 10.2.2.4
         rt_delay: 10
         log_neighbor_changes: False
         bestpath:
           as_path:
             confed: True
             ignore: True
             multipath_relax: False
             multipath_relax_as_set: True
           compare_routerid: True
           med:
             confed: True
             missing_as_worst: True
       - bgp_as: 10
         router_id: 10.2.2.32
         rt_delay: 20
         log_neighbor_changes: True
         vrf_name: 'VrfCheck1'
       - bgp_as: 11
         log_neighbor_changes: True
         vrf_name: 'VrfCheck2'
         bestpath:
           as_path:
             confed: False
             ignore: True
             multipath_relax_as_set: True
           compare_routerid: True
           med:
             confed: True
             missing_as_worst: True
    state: deleted


# After state:
# ------------
#
# !
# router bgp 10 vrf VrfCheck1
#  log-neighbor-changes
# !
# router bgp 11 vrf VrfCheck2
#  log-neighbor-changes
#  bestpath compare-routerid
# !
# router bgp 4
#  log-neighbor-changes
#  bestpath compare-routerid
# !


# Using deleted
#
# Before state:
# -------------
#
# !
# router bgp 10 vrf VrfCheck1
#  router-id 10.2.2.32
#  route-map delay-timer 20
#  log-neighbor-changes
# !
# router bgp 11 vrf VrfCheck2
#  log-neighbor-changes
#  bestpath as-path ignore
#  bestpath med missing-as-worst confed
#  bestpath compare-routerid
# !
# router bgp 4
#  router-id 10.2.2.4
#  route-map delay-timer 10
#  bestpath as-path ignore
#  bestpath as-path confed
#  bestpath med missing-as-worst confed
#  bestpath compare-routerid
# !

- name: Deletes all the bgp global configurations
  dellemc.enterprise_sonic.sonic_bgp:
     config:
     state: deleted

# After state:
# ------------
#
# !
# !


# Using merged
#
# Before state:
# -------------
#
# !
# router bgp 4
#  router-id 10.1.1.4
# !
#
- name: Merges provided configuration with device configuration
  dellemc.enterprise_sonic.sonic_bgp:
     config:
       - bgp_as: 4
         router_id: 10.2.2.4
         rt_delay: 10
         log_neighbor_changes: False
         timers:
           holdtime: 20
           keepalive_interval: 30
         bestpath:
           as_path:
             confed: True
             ignore: True
             multipath_relax: False
             multipath_relax_as_set: True
           compare_routerid: True
           med:
             confed: True
             missing_as_worst: True
             always_compare_med: True
         max_med:
           on_startup:
             timer: 667
             med_val: 7878
       - bgp_as: 10
         router_id: 10.2.2.32
         rt_delay: 20
         log_neighbor_changes: True
         vrf_name: 'VrfCheck1'
       - bgp_as: 11
         log_neighbor_changes: True
         vrf_name: 'VrfCheck2'
         bestpath:
           as_path:
             confed: False
             ignore: True
             multipath_relax_as_set: True
           compare_routerid: True
           med:
             confed: True
             missing_as_worst: True
     state: merged
#
# After state:
# ------------
#
# !
# router bgp 10 vrf VrfCheck1
#  router-id 10.2.2.32
#  route-map delay-timer 20
#  log-neighbor-changes
# !
# router bgp 11 vrf VrfCheck2
#  log-neighbor-changes
#  bestpath as-path ignore
#  bestpath med missing-as-worst confed
#  bestpath compare-routerid
# !
# router bgp 4
#  router-id 10.2.2.4
#  route-map delay-timer 10
#  bestpath as-path ignore
#  bestpath as-path confed
#  bestpath med missing-as-worst confed
#  bestpath compare-routerid
#  always-compare-med
#  max-med on-startup 667 7878
#  timers 20 30
#
# !


# Using replaced
#
# Before state:
# -------------
#
#!
#router bgp 10 vrf VrfCheck1
# router-id 10.2.2.32
# log-neighbor-changes
# timers 60 180
#!
#router bgp 4
# router-id 10.2.2.4
# max-med on-startup 667 7878
# bestpath as-path ignore
# bestpath as-path confed
# bestpath med missing-as-worst confed
# bestpath compare-routerid
# timers 20 30
#!
#

- name: Replace device configuration of specified BGP AS with provided
  dellemc.enterprise_sonic.sonic_bgp:
    config:
      - bgp_as: 4
        router_id: 10.2.2.44
        log_neighbor_changes: True
        bestpath:
          as_path:
            confed: True
          compare_routerid: True
      - bgp_as: 11
        vrf_name: 'VrfCheck2'
        router_id: 10.2.2.33
        log_neighbor_changes: True
        bestpath:
          as_path:
            confed: True
            ignore: True
          compare_routerid: True
          med:
            confed: True
            missing_as_worst: True
    state: replaced

#
# After state:
# ------------
#
#!
#router bgp 10 vrf VrfCheck1
# router-id 10.2.2.32
# log-neighbor-changes
# timers 60 180
#!
#router bgp 11 vrf VrfCheck2
# router-id 10.2.2.33
# log-neighbor-changes
# bestpath as-path ignore
# bestpath as-path confed
# bestpath med missing-as-worst confed
# bestpath compare-routerid
# timers 60 180
#!
#router bgp 4
# router-id 10.2.2.44
# log-neighbor-changes
# bestpath as-path confed
# bestpath compare-routerid
# timers 60 180
#!


# Using overridden
#
# Before state:
# -------------
#
#!
#router bgp 10 vrf VrfCheck1
# router-id 10.2.2.32
# log-neighbor-changes
# timers 60 180
#!
#router bgp 4
# router-id 10.2.2.4
# max-med on-startup 667 7878
# bestpath as-path ignore
# bestpath as-path confed
# bestpath med missing-as-worst confed
# bestpath compare-routerid
# timers 20 30
#!
#

- name: Override device configuration of global BGP with provided configuration
  dellemc.enterprise_sonic.sonic_bgp:
    config:
      - bgp_as: 4
        router_id: 10.2.2.44
        log_neighbor_changes: True
        bestpath:
          as_path:
            confed: True
          compare_routerid: True
      - bgp_as: 11
        vrf_name: 'VrfCheck2'
        router_id: 10.2.2.33
        log_neighbor_changes: True
        bestpath:
          as_path:
            confed: True
            ignore: True
          compare_routerid: True
        timers:
          holdtime: 90
          keepalive_interval: 30
    state: overridden

#
# After state:
# ------------
#
#!
#router bgp 11 vrf VrfCheck2
# router-id 10.2.2.33
# log-neighbor-changes
# bestpath as-path ignore
# bestpath as-path confed
# bestpath compare-routerid
# timers 30 90
#!
#router bgp 4
# router-id 10.2.2.44
# log-neighbor-changes
# bestpath as-path confed
# bestpath compare-routerid
# timers 60 180
#!

返回值

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

描述

after

list / elements=string

生成的配置模块调用。

返回: 当更改时

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

before

list / elements=string

模块调用之前的配置。

返回: 始终

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

commands

list / elements=string

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

返回: 始终

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

作者

  • Dhivya P (@dhivayp)