dellemc.enterprise_sonic.sonic_ospfv2_interfaces module – Configure OSPFv2 interface mode protocol settings on SONiC.

Note

This module is part of the dellemc.enterprise_sonic collection (version 2.5.1).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install dellemc.enterprise_sonic.

To use it in a playbook, specify: dellemc.enterprise_sonic.sonic_ospfv2_interfaces.

New in dellemc.enterprise_sonic 2.5.0

Synopsis

  • This module provides configuration management of OSPFv2 interface mode parameters on devices running SONiC.

  • Configure VRF instance before configuring OSPF in a VRF.

  • Configure OSPF instance before configuring OSPF in interfaces.

Parameters

Parameter

Comments

config

list / elements=dictionary

Specifies the OSPFv2 interface configurations.

bfd

dictionary

Configure OSPFv2 interface BFD.

bfd_profile

string

Configure BFD profile.

enable

boolean / required

Enable BFD support for OSPFv2.

Choices:

  • false

  • true

name

string / required

Full name of the interface, i.e. Ethernet1.

network

string

Configure OSPFv2 interface network type

Choices:

  • "broadcast"

  • "point_to_point"

ospf_attributes

list / elements=dictionary

Specifies OSPFv2 configurations for the interface.

If address is not specified, the IPv4 address of the interface is considered.

dead_interval and hello_multiplier are mutually exclusive.

address

string

Specifies the interface IPv4 address.

area_id

string

OSPFv2 Area ID of the network (A.B.C.D or 0 to 4294967295).

authentication

dictionary

Configure OSPFv2 plain text authentication type password.

Authentication key shall be max 8 charater long.

encrypted

boolean

Indicates whether the password is in encrypted format.

Choices:

  • false

  • true

password

string / required

Specifies the authentication password.

Plain text password i.e. password with encrypted=false will be stored in encrypted format in running-config, so idempotency will not be maintained and hence the task output will always be changed=true.

authentication_type

string

Enable OSPFv2 authentication and its type.

MD5HMAC - Enable Message digest authentication type.

NONE - Enable null authentication.

TEXT - Enable plain text authentication.

Choices:

  • "MD5HMAC"

  • "NONE"

  • "TEXT"

cost

integer

Configure OSPFv2 interface cost (1 to 65535).

dead_interval

integer

Configure OSPFv2 adjacency dead interval (1 to 65535).

hello_interval

integer

Configure OSPFv2 neighbour hello interval (1 to 65535).

hello_multiplier

integer

Minimal 1s dead-interval with fast sub-second hellos.

Number of Hellos to send each second (1 to 10).

md_authentication

list / elements=dictionary

Configure OSPFv2 message digest keys and password.

Uses MD5 algorithm.

encrypted

boolean

Indicates whether the password is in encrypted format.

Choices:

  • false

  • true

key_id

integer / required

Specifies the OSPFv2 message digest key ID (1 to 255).

md5key

string

Specifies the OSPFv2 message digest password.

Plain text password i.e. password with encrypted=false will be stored in encrypted format in running-config, so idempotency will not be maintained and hence the task output will always be changed=true.

mtu_ignore

boolean

Disable OSPFv2 MTU mismatch detection.

Choices:

  • false

  • true

priority

integer

Configure OSPFv2 adjacency router priority (0 to 255).

retransmit_interval

integer

Configure OSPFv2 retransmit interval (2 to 65535).

transmit_delay

integer

Configure OSPFv2 transmit delay (1 to 65535).

state

string

Specifies the operation to be performed on the OSPFv2 interfaces configured on the device.

In case of merged, the input configuration will be merged with the existing OSPFv2 interfaces configuration on the device.

In case of deleted, the existing OSPFv2 interfaces configuration will be removed from the device.

In case of overridden, all the existing OSPFv2 interfaces configuration will be deleted and the specified input configuration will be installed.

In case of replaced, the existing OSPFv2 interface configuration on the device will be replaced by the configuration in the playbook for each interface group configured by the playbook.

Choices:

  • "merged" ← (default)

  • "deleted"

  • "replaced"

  • "overridden"

Notes

Note

  • Supports check_mode.

Examples

# 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#

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

after

list / elements=string

The resulting configuration model invocation.

Returned: when changed

Sample: ["The configuration returned will always be in the same format\n of the parameters above.\n"]

after(generated)

list / elements=string

The generated configuration model invocation.

Returned: when check_mode

Sample: ["The configuration returned will always be in the same format\n of the parameters above.\n"]

before

list / elements=string

The configuration prior to the model invocation.

Returned: always

Sample: ["The configuration returned will always be in the same format\n of the parameters above.\n"]

commands

list / elements=string

The set of commands pushed to the remote device.

Returned: always

Sample: ["command 1", "command 2", "command 3"]

Authors

  • Santhosh kumar T (@santhosh-kt)