dellemc.enterprise_sonic.sonic_bfd 模块 – 管理 SONiC 上的 BFD 配置

注意

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

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

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

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

dellemc.enterprise_sonic 2.1.0 中的新增功能

概要

  • 此模块为运行 SONiC 的设备提供 BFD 的配置管理

参数

参数

注释

config

字典

指定 BFD 配置

multi_hops

列表 / 元素=字典

多跳会话列表

detect_multiplier

整数

使 BFD 会话断开的丢失数据包数

默认值: 3

enabled

布尔值

设置为 true 时启用 BFD 会话

选项

  • false

  • true ← (默认)

local_address

字符串 / 必需

用于接口上 BFD 会话的源 IP 地址

min_ttl

整数

接收数据包的最小预期 TTL

默认值: 254

passive_mode

布尔值

设置为 true 时,指定 BFD 对等方为被动

选项

  • false ← (默认)

  • true

profile_name

字符串

BFD 配置文件名称

receive_interval

整数

指定对等方接收间隔

默认值: 300

remote_address

字符串 / 必需

远程系统用于 BFD 会话的 IP 地址

transmit_interval

整数

指定对等方传输间隔

默认值: 300

vrf

字符串 / 必需

设备上配置的 VRF 的名称

profiles

列表 / 元素=字典

预配置配置文件列表

detect_multiplier

整数

使 BFD 会话断开的丢失数据包数

默认值: 3

echo_interval

整数

指定回显间隔

默认值: 300

echo_mode

布尔值

设置为 true 时启用回显模式

选项

  • false ← (默认)

  • true

enabled

布尔值

设置为 true 时启用 BFD 会话

选项

  • false

  • true ← (默认)

min_ttl

整数

接收数据包的最小预期 TTL

默认值: 254

passive_mode

布尔值

设置为 true 时,指定 BFD 对等方为被动

选项

  • false ← (默认)

  • true

profile_name

字符串 / 必需

BFD 配置文件名称

receive_interval

整数

指定对等方接收间隔

默认值: 300

transmit_interval

整数

指定对等方传输间隔

默认值: 300

single_hops

列表 / 元素=字典

单跳会话列表

detect_multiplier

整数

使 BFD 会话断开的丢失数据包数

默认值: 3

echo_interval

整数

指定回显间隔

默认值: 300

echo_mode

布尔值

设置为 true 时启用回显模式

选项

  • false ← (默认)

  • true

enabled

布尔值

设置为 true 时启用 BFD 会话

选项

  • false

  • true ← (默认)

interface

字符串 / 必需

用于联系对等方的接口

local_address

字符串 / 必需

用于接口上 BFD 会话的源 IP 地址

passive_mode

布尔值

设置为 true 时,指定 BFD 对等方为被动

选项

  • false ← (默认)

  • true

profile_name

字符串

BFD 配置文件名称

receive_interval

整数

指定对等方接收间隔

默认值: 300

remote_address

字符串 / 必需

远程系统用于 BFD 会话的 IP 地址

transmit_interval

整数

指定对等方传输间隔

默认值: 300

vrf

字符串 / 必需

设备上配置的 VRF 的名称

state

字符串

模块完成后的配置状态。

选项

  • "merged" ← (默认)

  • "deleted"

  • "replaced"

  • "overridden"

注释

注意

  • 针对 Dell Technologies 的 Enterprise SONiC 发行版进行测试。

  • 支持 check_mode

示例

# Using Merged
#
# Before state:
# -------------
#
# sonic# show bfd profile
# (No "bfd profile" configuration present)
# sonic# show bfd peers
# (No "bfd peers" configuration present)

  - name: Merge BFD configuration
    dellemc.enterprise_sonic.sonic_bfd:
    config:
      profiles:
        - profile_name: 'p1'
          enabled: True
          transmit_interval: 120
          receive_interval: 200
          detect_multiplier: 2
          passive_mode: True
          min_ttl: 140
          echo_interval: 150
          echo_mode: True
      single_hops:
        - remote_address: '196.88.6.1'
          vrf: 'default'
          interface: 'Ethernet20'
          local_address: '1.1.1.1'
          enabled: True
          transmit_interval: 50
          receive_interval: 80
          detect_multiplier: 4
          passive_mode: True
          echo_interval: 110
          echo_mode: True
          profile_name: 'p1'
      multi_hops:
        - remote_address: '192.40.1.3'
          vrf: 'default'
          local_address: '3.3.3.3'
          enabled: True
          transmit_interval: 75
          receive_interval: 100
          detect_multiplier: 3
          passive_mode: True
          min_ttl: 125
          profile_name: 'p1'
    state: merged

# After state:
# ------------
#
# sonic# show bfd profile
# BFD Profile:
#     Profile-name: p1
#         Enabled: True
#         Echo-mode: Enabled
#         Passive-mode: Enabled
#         Minimum-Ttl: 140
#         Detect-multiplier: 2
#         Receive interval: 200ms
#         Transmission interval: 120ms
#         Echo transmission interval: 150ms
# sonic# show bfd peers
# BFD Peers:
#
#     peer 192.40.1.3 multihop local-address 3.3.3.3 vrf default
#         ID: 989720421
#         Remote ID: 0
#         Passive mode: Enabled
#         Profile: p1
#         Minimum TTL: 125
#         Status: down
#         Downtime: 0 day(s), 0 hour(s), 1 min(s), 46 sec(s)
#         Diagnostics: ok
#         Remote diagnostics: ok
#         Peer Type: configured
#         Local timers:
#             Detect-multiplier: 2
#             Receive interval: 100ms
#             Transmission interval: 75ms
#             Echo transmission interval: ms
#         Remote timers:
#             Detect-multiplier: 3
#             Receive interval: 1000ms
#             Transmission interval: 1000ms
#             Echo transmission interval: 0ms
#
#     peer 196.88.6.1 local-address 1.1.1.1 vrf default interface Ethernet20
#         ID: 1134635660
#         Remote ID: 0
#         Passive mode: Enabled
#         Profile: p1
#         Status: down
#         Downtime: 0 day(s), 1 hour(s), 50 min(s), 48 sec(s)
#         Diagnostics: ok
#         Remote diagnostics: ok
#         Peer Type: configured
#         Local timers:
#             Detect-multiplier: 4
#             Receive interval: 80ms
#             Transmission interval: 50ms
#             Echo transmission interval: 110ms
#         Remote timers:
#             Detect-multiplier: 3
#             Receive interval: 1000ms
#             Transmission interval: 1000ms
#             Echo transmission interval: 0ms
#
#
# Using replaced
#
# Before state:
# -------------
#
# sonic# show bfd profile
# BFD Profile:
#     Profile-name: p1
#         Enabled: True
#         Echo-mode: Enabled
#         Passive-mode: Enabled
#         Minimum-Ttl: 140
#         Detect-multiplier: 2
#         Receive interval: 200ms
#         Transmission interval: 120ms
#         Echo transmission interval: 150ms
#     Profile-name: p2
#         Enabled: True
#         Echo-mode: Disabled
#         Passive-mode: Disabled
#         Minimum-Ttl: 254
#         Detect-multiplier: 3
#         Receive interval: 300ms
#         Transmission interval: 300ms
#         Echo transmission interval: 300ms

  - name: Replace BFD configuration
    dellemc.enterprise_sonic.sonic_bfd:
    config:
      profiles:
        - profile_name: 'p1'
          transmit_interval: 144
        - profile_name: 'p2'
          enabled: False
          transmit_interval: 110
          receive_interval: 235
          detect_multiplier: 5
          passive_mode: True
          min_ttl: 155
          echo_interval: 163
          echo_mode: True
    state: replaced

# After state:
# ------------
#
# sonic# show bfd profile
# BFD Profile:
#     Profile-name: p1
#         Enabled: True
#         Echo-mode: Enabled
#         Passive-mode: Enabled
#         Minimum-Ttl: 140
#         Detect-multiplier: 2
#         Receive interval: 200ms
#         Transmission interval: 144ms
#         Echo transmission interval: 150ms
#     Profile-name: p2
#         Enabled: False
#         Echo-mode: Enabled
#         Passive-mode: Enabled
#         Minimum-Ttl: 155
#         Detect-multiplier: 5
#         Receive interval: 235ms
#         Transmission interval: 110ms
#         Echo transmission interval: 163ms
#
#
# Using overridden
#
# Before state:
# -------------
#
# sonic# show bfd peers
# BFD Peers:
#
#     peer 192.40.1.3 multihop local-address 3.3.3.3 vrf default
#         ID: 989720421
#         Remote ID: 0
#         Passive mode: Enabled
#         Profile: p1
#         Minimum TTL: 125
#         Status: down
#         Downtime: 0 day(s), 0 hour(s), 1 min(s), 46 sec(s)
#         Diagnostics: ok
#         Remote diagnostics: ok
#         Peer Type: configured
#         Local timers:
#             Detect-multiplier: 2
#             Receive interval: 100ms
#             Transmission interval: 75ms
#             Echo transmission interval: ms
#         Remote timers:
#             Detect-multiplier: 3
#             Receive interval: 1000ms
#             Transmission interval: 1000ms
#             Echo transmission interval: 0ms
#
#     peer 196.88.6.1 local-address 1.1.1.1 vrf default interface Ethernet20
#         ID: 1134635660
#         Remote ID: 0
#         Passive mode: Enabled
#         Profile: p1
#         Status: down
#         Downtime: 0 day(s), 1 hour(s), 50 min(s), 48 sec(s)
#         Diagnostics: ok
#         Remote diagnostics: ok
#         Peer Type: configured
#         Local timers:
#             Detect-multiplier: 4
#             Receive interval: 80ms
#             Transmission interval: 50ms
#             Echo transmission interval: 110ms
#         Remote timers:
#             Detect-multiplier: 3
#             Receive interval: 1000ms
#             Transmission interval: 1000ms
#             Echo transmission interval: 0ms

  - name: Override BFD configuration
    dellemc.enterprise_sonic.sonic_bfd:
    config:
      single_hops:
        - remote_address: '172.68.2.1'
          vrf: 'default'
          interface: 'Ethernet16'
          local_address: '2.2.2.2'
          enabled: True
          transmit_interval: 60
          receive_interval: 88
          detect_multiplier: 6
          passive_mode: True
          echo_interval: 112
          echo_mode: True
          profile_name: 'p3'
      multi_hops:
        - remote_address: '186.42.1.2'
          vrf: 'default'
          local_address: '1.1.1.1'
          enabled: False
          transmit_interval: 85
          receive_interval: 122
          detect_multiplier: 4
          passive_mode: False
          min_ttl: 120
          profile_name: 'p3'
    state: overridden

# After state:
# ------------
#
# sonic# show bfd peers
# BFD Peers:
#
#     peer 186.42.1.2 multihop local-address 1.1.1.1 vrf default
#         ID: 989720421
#         Remote ID: 0
#         Passive mode: Disabled
#         Profile: p3
#         Minimum TTL: 120
#         Status: down
#         Downtime: 0 day(s), 0 hour(s), 1 min(s), 46 sec(s)
#         Diagnostics: ok
#         Remote diagnostics: ok
#         Peer Type: configured
#         Local timers:
#             Detect-multiplier: 4
#             Receive interval: 122ms
#             Transmission interval: 85ms
#             Echo transmission interval: ms
#         Remote timers:
#             Detect-multiplier: 3
#             Receive interval: 1000ms
#             Transmission interval: 1000ms
#             Echo transmission interval: 0ms
#
#     peer 172.68.2.1 local-address 2.2.2.2 vrf default interface Ethernet16
#         ID: 1134635660
#         Remote ID: 0
#         Passive mode: Enabled
#         Profile: p3
#         Status: down
#         Downtime: 0 day(s), 1 hour(s), 50 min(s), 48 sec(s)
#         Diagnostics: ok
#         Remote diagnostics: ok
#         Peer Type: configured
#         Local timers:
#             Detect-multiplier: 6
#             Receive interval: 88ms
#             Transmission interval: 60ms
#             Echo transmission interval: 112ms
#         Remote timers:
#             Detect-multiplier: 3
#             Receive interval: 1000ms
#             Transmission interval: 1000ms
#             Echo transmission interval: 0ms
#
#
# Using deleted
#
# Before state:
# -------------
#
# sonic# show bfd profile
# BFD Profile:
#     Profile-name: p1
#         Enabled: True
#         Echo-mode: Enabled
#         Passive-mode: Enabled
#         Minimum-Ttl: 140
#         Detect-multiplier: 2
#         Receive interval: 200ms
#         Transmission interval: 120ms
#         Echo transmission interval: 150ms
# sonic# show bfd peers
# BFD Peers:
#
#     peer 192.40.1.3 multihop local-address 3.3.3.3 vrf default
#         ID: 989720421
#         Remote ID: 0
#         Passive mode: Enabled
#         Profile: p1
#         Minimum TTL: 125
#         Status: down
#         Downtime: 0 day(s), 0 hour(s), 1 min(s), 46 sec(s)
#         Diagnostics: ok
#         Remote diagnostics: ok
#         Peer Type: configured
#         Local timers:
#             Detect-multiplier: 2
#             Receive interval: 100ms
#             Transmission interval: 75ms
#             Echo transmission interval: ms
#         Remote timers:
#             Detect-multiplier: 3
#             Receive interval: 1000ms
#             Transmission interval: 1000ms
#             Echo transmission interval: 0ms
#
#     peer 196.88.6.1 local-address 1.1.1.1 vrf default interface Ethernet20
#         ID: 1134635660
#         Remote ID: 0
#         Passive mode: Enabled
#         Profile: p1
#         Status: down
#         Downtime: 0 day(s), 1 hour(s), 50 min(s), 48 sec(s)
#         Diagnostics: ok
#         Remote diagnostics: ok
#         Peer Type: configured
#         Local timers:
#             Detect-multiplier: 4
#             Receive interval: 80ms
#             Transmission interval: 50ms
#             Echo transmission interval: 110ms
#         Remote timers:
#             Detect-multiplier: 3
#             Receive interval: 1000ms
#             Transmission interval: 1000ms
#             Echo transmission interval: 0ms

  - name: Delete BFD configuration
    dellemc.enterprise_sonic.sonic_bfd:
    config:
      profiles:
        - profile_name: 'p1'
          enabled: True
          transmit_interval: 120
          receive_interval: 200
          detect_multiplier: 2
          passive_mode: True
          min_ttl: 140
          echo_interval: 150
          echo_mode: True
      single_hops:
        - remote_address: '196.88.6.1'
          vrf: 'default'
          interface: 'Ethernet20'
          local_address: '1.1.1.1'
      multi_hops:
        - remote_address: '192.40.1.3'
          vrf: 'default'
          local_address: '3.3.3.3'
    state: deleted

# After state
# -----------
#
# sonic# show bfd profile
# BFD Profile:
#     Profile-name: p1
#         Enabled: True
#         Echo-mode: Disabled
#         Passive-mode: Disabled
#         Minimum-Ttl: 254
#         Detect-multiplier: 3
#         Receive interval: 300ms
#         Transmission interval: 300ms
#         Echo transmission interval: 300ms
# sonic# show bfd peers
# (No "bfd peers" configuration present)

返回值

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

描述

after

列表 / 元素=字符串

生成的配置模块调用。

已返回: 当更改时

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

after(generated)

列表 / 元素=字符串

生成的配置模块调用。

已返回:check_mode

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

before

列表 / 元素=字符串

模块调用之前的配置。

已返回: 总是

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

commands

列表 / 元素=字符串

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

已返回: 总是

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

作者

  • Shade Talabi (@stalabi1)