dellemc.enterprise_sonic.sonic_ospfv2_interfaces 模块 – 在 SONiC 上配置 OSPFv2 接口模式协议设置。

注意

此模块是 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_ospfv2_interfaces

dellemc.enterprise_sonic 2.5.0 中的新增功能

概要

  • 此模块提供对运行 SONiC 的设备上 OSPFv2 接口模式参数的配置管理。

  • 在 VRF 中配置 OSPF 之前,请先配置 VRF 实例。

  • 在接口中配置 OSPF 之前,请先配置 OSPF 实例。

参数

参数

注释

config

列表 / 元素=字典

指定 OSPFv2 接口配置。

bfd

字典

配置 OSPFv2 接口 BFD。

bfd_profile

字符串

配置 BFD 配置文件。

enable

布尔值 / 必需

启用 OSPFv2 的 BFD 支持。

选项

  • false

  • true

name

字符串 / 必需

接口的全名,例如 Ethernet1。

network

字符串

配置 OSPFv2 接口网络类型

选项

  • "broadcast"

  • "point_to_point"

ospf_attributes

列表 / 元素=字典

指定接口的 OSPFv2 配置。

如果未指定 *address*,则认为是接口的 IPv4 地址。

*dead_interval* 和 *hello_multiplier* 是互斥的。

address

字符串

指定接口的 IPv4 地址。

area_id

字符串

网络的 OSPFv2 区域 ID(A.B.C.D 或 0 到 4294967295)。

authentication

字典

配置 OSPFv2 纯文本身份验证类型密码。

身份验证密钥长度最大为 8 个字符。

encrypted

布尔值

指示密码是否为加密格式。

选项

  • false

  • true

password

字符串 / 必需

指定身份验证密码。

纯文本密码(即 *encrypted=false* 的密码)将以加密格式存储在运行配置中,因此不会保持幂等性,因此任务输出始终为 *changed=true*。

authentication_type

字符串

启用 OSPFv2 身份验证及其类型。

MD5HMAC - 启用消息摘要身份验证类型。

NONE - 启用空身份验证。

TEXT - 启用纯文本身份验证。

选项

  • "MD5HMAC"

  • "NONE"

  • "TEXT"

cost

整数

配置 OSPFv2 接口成本 (1 到 65535)。

dead_interval

整数

配置 OSPFv2 邻接失效间隔 (1 到 65535)。

hello_interval

整数

配置 OSPFv2 邻居 hello 间隔 (1 到 65535)。

hello_multiplier

整数

最小 1 秒失效间隔,具有快速亚秒级 hello。

每秒发送的 Hello 数 (1 到 10)。

md_authentication

列表 / 元素=字典

配置 OSPFv2 消息摘要密钥和密码。

使用 MD5 算法。

encrypted

布尔值

指示密码是否为加密格式。

选项

  • false

  • true

key_id

整数 / 必需

指定 OSPFv2 消息摘要密钥 ID (1 到 255)。

md5key

字符串

指定 OSPFv2 消息摘要密码。

纯文本密码(即 *encrypted=false* 的密码)将以加密格式存储在运行配置中,因此不会保持幂等性,因此任务输出始终为 *changed=true*。

mtu_ignore

布尔值

禁用 OSPFv2 MTU 不匹配检测。

选项

  • false

  • true

priority

整数

配置 OSPFv2 邻接路由器优先级 (0 到 255)。

retransmit_interval

整数

配置 OSPFv2 重传间隔 (2 到 65535)。

transmit_delay

整数

配置 OSPFv2 传输延迟 (1 到 65535)。

state

字符串

指定要对设备上配置的 OSPFv2 接口执行的操作。

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

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

如果为 overridden,则将删除所有现有的 OSPFv2 接口配置,并安装指定的输入配置。

如果为 replaced,则设备上现有的 OSPFv2 接口配置将被 playbook 中每个接口组的配置替换。

选项

  • "merged" ← (默认)

  • "deleted"

  • "replaced"

  • "overridden"

备注

注意

  • 支持 check_mode

示例

# Using deleted

# Before state:
# -------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# ip ospf area 2.2.2.2
# ip ospf bfd
# ip ospf bfd profile profile2
# ip ospf cost 30
# ip ospf dead-interval 40
# ip ospf hello-interval 10
# ip ospf mtu-ignore
# ip ospf network point-to-point
# ip ospf priority 20
# ip ospf authentication null 10.10.120.1
# ip ospf authentication-key U2FsdGVkX1/Ml24vwe6RSjUUqI+54BdDyDL0eKUezJw= encrypted 10.10.120.1
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1
# ip ospf authentication null 10.19.119.1
# ip ospf message-digest-key 10 md5 U2FsdGVkX1/Bq/+x8a3fsBo9ZrAX56ynmPKnRM87kfQ= encrypted 10.19.119.1
#!
#interface Eth1/2
# ip ospf bfd
# ip ospf network point-to-point
#!
#interface Eth1/3
# ip ospf bfd
# ip ospf network point-to-point
# ip ospf area 3.3.3.3 10.19.120.2
# ip ospf authentication message-digest 10.19.120.2
# ip ospf authentication-key U2FsdGVkX19HqGCcf2pzGur9MDnb0VzLNRvoFij3Os0= encrypted 10.19.120.2
# ip ospf dead-interval minimal hello-multiplier 5 10.19.120.2
#!
#sonic#

  - name: Delete the OSPFv2_interface configurations
    sonic_ospfv2_interfaces:
      config:
        - name: 'Eth1/1'
          ospf_attributes:
            - area_id: '2.2.2.2'
              cost: 30
              priority: 20
              hello_interval: 10
              dead_interval: 40
              mtu_ignore: True
            - address: '10.10.120.1'
              authentication_type: 'NONE'
              authentication:
                password: 'pass2'
            - address: '10.19.119.1'
          bfd:
            enable: True
            bfd_profile: 'profile2'
          network: point_to_point
        - name: 'Eth1/2'
          bfd:
            enable: True
        - name: 'Eth1/3'
      state: deleted

# After state:
# ------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1
#!
#interface Eth1/2
# ip ospf network point-to-point
#!
#interface Eth1/3
#!
#sonic#


# Using deleted

# Before state:
# -------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# ip ospf area 2.2.2.2
# ip ospf bfd
# ip ospf bfd profile profile2
# ip ospf cost 30
# ip ospf dead-interval 40
# ip ospf hello-interval 10
# ip ospf mtu-ignore
# ip ospf network point-to-point
# ip ospf priority 20
# ip ospf authentication null 10.10.120.1
# ip ospf authentication-key U2FsdGVkX1/Ml24vwe6RSjUUqI+54BdDyDL0eKUezJw= encrypted 10.10.120.1
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1
# ip ospf authentication null 10.19.119.1
# ip ospf message-digest-key 10 md5 U2FsdGVkX1/Bq/+x8a3fsBo9ZrAX56ynmPKnRM87kfQ= encrypted 10.19.119.1
#!
#interface Eth1/2
# ip ospf bfd
# ip ospf network point-to-point
#!
#interface Eth1/3
# ip ospf bfd
# ip ospf network point-to-point
# ip ospf area 3.3.3.3 10.19.120.2
# ip ospf authentication message-digest 10.19.120.2
# ip ospf authentication-key U2FsdGVkX19HqGCcf2pzGur9MDnb0VzLNRvoFij3Os0= encrypted 10.19.120.2
# ip ospf dead-interval minimal hello-multiplier 5 10.19.120.2
#!
#sonic#

  - name: Delete the OSPFv2_interface configurations
    sonic_ospfv2_interfaces:
      config:
        - name: 'Eth1/1'
        - name: 'Eth1/2'
          bfd:
            enable: True
        - name: 'Eth1/3'
      state: deleted

# After state:
# ------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
#!
#interface Eth1/2
# ip ospf network point-to-point
#!
#interface Eth1/3
#!
#sonic#


# Using merged

# Before state:
# -------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
#!
#interface Eth1/2
#!
#interface Eth1/3
#!
#sonic#

  - name: Add the OSPFv2_interface configurations
    sonic_ospfv2_interfaces:
      config:
        - name: 'Eth1/1'
          ospf_attributes:
            - area_id: '2.2.2.2'
              cost: 20
              priority: 20
              hello_interval: 10
              dead_interval: 40
              mtu_ignore: True
            - address: '10.10.120.1'
              authentication_type: 'MD5HMAC'
              authentication:
                password: 'password'
              hello_multiplier: 5
          bfd:
            enable: True
            bfd_profile: 'profile1'
          network: broadcast
        - name: 'Eth1/3'
          ospf_attributes:
            - area_id: '3.3.3.3'
              address: '10.19.120.2'
              authentication_type: 'MD5HMAC'
              authentication:
                password: 'password'
              hello_multiplier: 5
          bfd:
            enable: True
          network: point_to_point
      state: merged

# After state:
# ------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# ip ospf area 2.2.2.2
# ip ospf bfd
# ip ospf bfd profile profile1
# ip ospf cost 20
# ip ospf dead-interval 40
# ip ospf hello-interval 10
# ip ospf mtu-ignore
# ip ospf network broadcast
# ip ospf priority 20
# ip ospf authentication message-digest 10.10.120.1
# ip ospf authentication-key U2FsdGVkX1+ozJSEI69XJb2KR9Pu1Sa3Ou6ujTRalbQ= encrypted 10.10.120.1
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1
#!
#interface Eth1/2
#!
#interface Eth1/3
# ip ospf bfd
# ip ospf network point-to-point
# ip ospf area 3.3.3.3 10.19.120.2
# ip ospf authentication message-digest 10.19.120.2
# ip ospf authentication-key U2FsdGVkX19HqGCcf2pzGur9MDnb0VzLNRvoFij3Os0= encrypted 10.19.120.2
# ip ospf dead-interval minimal hello-multiplier 5 10.19.120.2
#!
#sonic#


# Using merged

# Before state:
# -------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# ip ospf area 2.2.2.2
# ip ospf bfd
# ip ospf bfd profile profile1
# ip ospf cost 20
# ip ospf dead-interval 40
# ip ospf hello-interval 10
# ip ospf mtu-ignore
# ip ospf network broadcast
# ip ospf priority 20
# ip ospf authentication message-digest 10.10.120.1
# ip ospf authentication-key U2FsdGVkX1+ozJSEI69XJb2KR9Pu1Sa3Ou6ujTRalbQ= encrypted 10.10.120.1
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1
#!
#interface Eth1/2
#!
#interface Eth1/3
# ip ospf bfd
# ip ospf network point-to-point
# ip ospf area 3.3.3.3 10.19.120.2
# ip ospf authentication message-digest 10.19.120.2
# ip ospf authentication-key U2FsdGVkX19HqGCcf2pzGur9MDnb0VzLNRvoFij3Os0= encrypted 10.19.120.2
# ip ospf dead-interval minimal hello-multiplier 5 10.19.120.2
#!
#sonic#

  - name: Add the OSPFv2_interface configurations
    sonic_ospfv2_interfaces:
      config:
        - name: 'Eth1/1'
          ospf_attributes:
            - area_id: '2.2.2.2'
              cost: 30
              priority: 20
              hello_interval: 10
              dead_interval: 40
              mtu_ignore: True
            - address: '10.10.120.1'
              authentication_type: 'NONE'
              authentication:
                password: 'pass2'
            - address: '10.19.119.1'
              authentication_type: 'NONE'
              md_authentication:
                - key_id: 10
                  md5key: 'U2FsdGVkX1/Bq/+x8a3fsBo9ZrAX56ynmPKnRM87kfQ='
                  encrypted: True
          bfd:
            enable: True
            bfd_profile: 'profile2'
          network: point_to_point
        - name: 'Eth1/2'
          bfd:
            enable: True
          network: point_to_point
      state: merged

# After state:
# ------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# ip ospf area 2.2.2.2
# ip ospf bfd
# ip ospf bfd profile profile2
# ip ospf cost 30
# ip ospf dead-interval 40
# ip ospf hello-interval 10
# ip ospf mtu-ignore
# ip ospf network point-to-point
# ip ospf priority 20
# ip ospf authentication null 10.10.120.1
# ip ospf authentication-key U2FsdGVkX1/Ml24vwe6RSjUUqI+54BdDyDL0eKUezJw= encrypted 10.10.120.1
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1
# ip ospf authentication null 10.19.119.1
# ip ospf message-digest-key 10 md5 U2FsdGVkX1/Bq/+x8a3fsBo9ZrAX56ynmPKnRM87kfQ= encrypted 10.19.119.1
#!
#interface Eth1/2
# ip ospf bfd
# ip ospf network point-to-point
#!
#interface Eth1/3
# ip ospf bfd
# ip ospf network point-to-point
# ip ospf area 3.3.3.3 10.19.120.2
# ip ospf authentication message-digest 10.19.120.2
# ip ospf authentication-key U2FsdGVkX19HqGCcf2pzGur9MDnb0VzLNRvoFij3Os0= encrypted 10.19.120.2
# ip ospf dead-interval minimal hello-multiplier 5 10.19.120.2
#!
#sonic#


# Using replaced

# Before state:
# -------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# ip ospf area 2.2.2.2
# ip ospf bfd
# ip ospf bfd profile profile1
# ip ospf cost 20
# ip ospf dead-interval 40
# ip ospf hello-interval 10
# ip ospf mtu-ignore
# ip ospf network broadcast
# ip ospf priority 20
# ip ospf authentication message-digest 10.10.120.1
# ip ospf authentication-key U2FsdGVkX1+ozJSEI69XJb2KR9Pu1Sa3Ou6ujTRalbQ= encrypted 10.10.120.1
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1
#!
#interface Eth1/2
#!
#interface Eth1/3
# ip ospf bfd
# ip ospf network point-to-point
# ip ospf area 3.3.3.3 10.19.120.2
# ip ospf authentication message-digest 10.19.120.2
# ip ospf authentication-key U2FsdGVkX19HqGCcf2pzGur9MDnb0VzLNRvoFij3Os0= encrypted 10.19.120.2
# ip ospf dead-interval minimal hello-multiplier 5 10.19.120.2
#!
#sonic#

  - name: Replace the OSPFv2_interface configurations
    sonic_ospfv2_interfaces:
      config:
        - name: 'Eth1/3'
          ospf_attributes:
            - area_id: '2.2.2.2'
              cost: 30
              priority: 20
              hello_interval: 10
              dead_interval: 40
              mtu_ignore: True
            - address: '10.10.120.1'
              authentication_type: 'NONE'
              authentication:
                password: 'pass2'
            - address: '10.19.119.1'
              authentication_type: 'NONE'
              md_authentication:
                - key_id: 10
                  md5key: 'U2FsdGVkX1/Bq/+x8a3fsBo9ZrAX56ynmPKnRM87kfQ='
                  encrypted: True
          bfd:
            enable: True
            bfd_profile: 'profile2'
          network: broadcast
      state: replaced

# After state:
# ------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# ip ospf area 2.2.2.2
# ip ospf bfd
# ip ospf bfd profile profile1
# ip ospf cost 20
# ip ospf dead-interval 40
# ip ospf hello-interval 10
# ip ospf mtu-ignore
# ip ospf network broadcast
# ip ospf priority 20
# ip ospf authentication message-digest 10.10.120.1
# ip ospf authentication-key U2FsdGVkX1+ozJSEI69XJb2KR9Pu1Sa3Ou6ujTRalbQ= encrypted 10.10.120.1
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1
#!
#interface Eth1/2
#!
#interface Eth1/3
# ip ospf area 2.2.2.2
# ip ospf bfd
# ip ospf bfd profile profile2
# ip ospf cost 30
# ip ospf dead-interval 40
# ip ospf hello-interval 10
# ip ospf mtu-ignore
# ip ospf network broadcast
# ip ospf priority 20
# ip ospf authentication null 10.10.120.1
# ip ospf authentication-key U2FsdGVkX186k2R2hUXaDloW8hfkApn5Zx5hCQy9usc= encrypted 10.10.120.1
# ip ospf authentication null 10.19.119.1
# ip ospf message-digest-key 10 md5 U2FsdGVkX1/Bq/+x8a3fsBo9ZrAX56ynmPKnRM87kfQ= encrypted 10.19.119.1
#!
#sonic#


# Using overridden

# Before state:
# -------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# ip ospf area 2.2.2.2
# ip ospf bfd
# ip ospf bfd profile profile1
# ip ospf cost 20
# ip ospf dead-interval 40
# ip ospf hello-interval 10
# ip ospf mtu-ignore
# ip ospf network broadcast
# ip ospf priority 20
# ip ospf authentication message-digest 10.10.120.1
# ip ospf authentication-key U2FsdGVkX1+ozJSEI69XJb2KR9Pu1Sa3Ou6ujTRalbQ= encrypted 10.10.120.1
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1
#!
#interface Eth1/2
#!
#interface Eth1/3
# ip ospf bfd
# ip ospf network point-to-point
# ip ospf area 3.3.3.3 10.19.120.2
# ip ospf authentication message-digest 10.19.120.2
# ip ospf authentication-key U2FsdGVkX19HqGCcf2pzGur9MDnb0VzLNRvoFij3Os0= encrypted 10.19.120.2
# ip ospf dead-interval minimal hello-multiplier 5 10.19.120.2
#!
#sonic#

  - name: Override the OSPFv2_interface configurations
    sonic_ospfv2_interfaces:
      config:
        - name: 'Eth1/3'
          ospf_attributes:
            - area_id: '2.2.2.2'
              cost: 30
              priority: 20
              hello_interval: 10
              dead_interval: 40
              mtu_ignore: True
            - address: '10.10.120.1'
              authentication_type: 'NONE'
              authentication:
                password: 'pass2'
            - address: '10.19.119.1'
              authentication_type: 'NONE'
              md_authentication:
                - key_id: 10
                  md5key: 'U2FsdGVkX1/Bq/+x8a3fsBo9ZrAX56ynmPKnRM87kfQ='
                  encrypted: True
          bfd:
            enable: True
            bfd_profile: 'profile2'
          network: broadcast
      state: overridden

# After state:
# ------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
#!
#interface Eth1/2
#!
#interface Eth1/3
# ip ospf area 2.2.2.2
# ip ospf bfd
# ip ospf bfd profile profile2
# ip ospf cost 30
# ip ospf dead-interval 40
# ip ospf hello-interval 10
# ip ospf mtu-ignore
# ip ospf network broadcast
# ip ospf priority 20
# ip ospf authentication null 10.10.120.1
# ip ospf authentication-key U2FsdGVkX186k2R2hUXaDloW8hfkApn5Zx5hCQy9usc= encrypted 10.10.120.1
# ip ospf authentication null 10.19.119.1
# ip ospf message-digest-key 10 md5 U2FsdGVkX1/Bq/+x8a3fsBo9ZrAX56ynmPKnRM87kfQ= encrypted 10.19.119.1
#!
#sonic#

返回值

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

描述

after

列表 / 元素=字符串

生成的配置模型调用。

返回:发生更改时

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

after(generated)

列表 / 元素=字符串

生成的配置模型调用。

返回:当使用 check_mode

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

before

列表 / 元素=字符串

模型调用之前的配置。

返回:始终返回

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

commands

列表 / 元素=字符串

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

返回:始终返回

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

作者

  • Santhosh kumar T (@santhosh-kt)