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 中的新增功能

概要

  • 此模块提供对运行戴尔科技公司 Enterprise SONiC 发行版的设备上的全局 BGP 参数的配置管理。

注意

此模块具有相应的 action 插件

参数

参数

注释

config

列表 / 元素=字典

指定 BGP 相关的配置。

as_notation

字符串

指定 AS 号码表示法格式

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

选项

  • "asdot"

  • "asdot+"

bestpath

字典

配置 BGP 最佳路径。

as_path

字典

配置 as-path 值。

confed

布尔值

配置 as-path 的 confed 值。

选项

  • false

  • true

ignore

布尔值

配置 as-path 的 ignore 值。

选项

  • false

  • true

multipath_relax

布尔值

配置 as-path 的 multipath_relax 值。

选项

  • false

  • true

multipath_relax_as_set

布尔值

配置 as-path 的 multipath_relax_as_set 值。

选项

  • false

  • true

compare_routerid

布尔值

配置 compare_routerid。

选项

  • false

  • true

med

字典

配置 med 值。

always_compare_med

布尔值

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

选项

  • false

  • true

confed

布尔值

配置 med 的 confed 值。

选项

  • false

  • true

missing_as_worst

布尔值

配置 as-path 的 missing_as_worst 值。

选项

  • false

  • true

bgp_as

字符串 / 必需

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

log_neighbor_changes

布尔值

启用/禁用记录邻居上下线和重置原因。

选项

  • false

  • true

max_med

字典

配置 max med 及其参数

on_startup

字典

启动时间和 max-med 值

med_val

整数

启动时 med 值

timer

整数

配置启动时间

router_id

字符串

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

rt_delay

整数

处理路由映射更改之前等待的时间(秒)。

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

timers

字典

调整路由计时器

holdtime

整数

配置 hold-time

keepalive_interval

整数

配置 keepalive-interval

vrf_name

字符串

指定 VRF 名称。

默认值: "default"

state

字符串

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

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

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

如果为 replaced,则指定 BGP AS 的现有配置将被提供的配置替换。

如果为 overridden,则现有的 BGP 配置将被提供的配置覆盖。

选项

  • "merged" ← (默认)

  • "deleted"

  • "replaced"

  • "overridden"

注释

注意

  • 针对戴尔科技公司的 Enterprise SONiC 发行版进行了测试。

  • 支持 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

列表 / 元素=字符串

模块调用的结果配置。

返回:发生更改时

示例: ["The configuration returned is always in the same format as the parameters above.\n"]

before

列表 / 元素=字符串

模块调用之前的配置。

返回:始终返回

示例: ["The configuration returned is always in the same format as the parameters above.\n"]

commands

列表 / 元素=字符串

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

返回:始终返回

示例: ["command 1", "command 2", "command 3"]

作者

  • Dhivya P (@dhivayp)