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

list / elements=dictionary

指定 OSPFv2 接口配置。

bfd

dictionary

配置 OSPFv2 接口 BFD。

bfd_profile

string

配置 BFD 配置文件。

enable

boolean / required

为 OSPFv2 启用 BFD 支持。

选择

  • false

  • true

name

string / required

接口的全名,即 Ethernet1。

network

string

配置 OSPFv2 接口网络类型

选择

  • "broadcast"

  • "point_to_point"

ospf_attributes

list / elements=dictionary

指定接口的 OSPFv2 配置。

如果未指定 address,则考虑接口的 IPv4 地址。

dead_intervalhello_multiplier 是互斥的。

address

string

指定接口 IPv4 地址。

area_id

string

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

authentication

dictionary

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

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

encrypted

boolean

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

选择

  • false

  • true

password

string / required

指定身份验证密码。

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

authentication_type

string

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

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

NONE - 启用空身份验证。

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

选择

  • "MD5HMAC"

  • "NONE"

  • "TEXT"

cost

integer

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

dead_interval

integer

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

hello_interval

integer

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

hello_multiplier

integer

最小 1 秒死间隔,具有快速亚秒级 Hello。

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

md_authentication

list / elements=dictionary

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

使用 MD5 算法。

encrypted

boolean

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

选择

  • false

  • true

key_id

integer / required

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

md5key

string

指定 OSPFv2 消息摘要密码。

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

mtu_ignore

boolean

禁用 OSPFv2 MTU 不匹配检测。

选择

  • false

  • true

priority

integer

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

retransmit_interval

integer

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

transmit_delay

integer

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

state

string

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

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

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

在覆盖的情况下,所有现有的 OSPFv2 接口配置都将被删除,并且将安装指定的输入配置。

在替换的情况下,设备上现有的 OSPFv2 接口配置将由 playbook 中为 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

list / elements=string

生成的配置模型调用。

返回:当更改时

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

after(生成)

list / elements=string

生成的配置模型调用。

返回:check_mode

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

before

list / elements=string

模型调用之前的配置。

返回:始终

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

commands

list / elements=string

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

返回:始终

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

作者

  • Santhosh kumar T (@santhosh-kt)