dellemc.enterprise_sonic.sonic_ospfv2 module – Configure global OSPFv2 protocol settings on SONiC.

Note

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

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.

New in dellemc.enterprise_sonic 2.5.0

Synopsis

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

  • Configure VRF instance before configuring OSPF in a VRF.

Parameters

Parameter

Comments

config

list / elements=dictionary

Specifies the OSPFv2 related configuration.

non_passive_interfaces and passive_interfaces are mutually exclusive.

When default_passive=True, passive_interfaces cannot be configured.

When default_passive=False, non_passive_interfaces cannot be configured.

abr_type

string

Configure router ABR type.

cisco - Cisco implementation type ABR.

ibm - IBM implementation type ABR.

shortcut - Shortcut ABR.

standard - RFC2328 Standard implementation ABR.

Choices:

  • "cisco"

  • "ibm"

  • "shortcut"

  • "standard"

auto_cost_reference_bandwidth

integer

Configure interface auto cost reference bandwidth (1 to 4294967).

default_metric

integer

Configure metric for redistributed routes (0 to 16777214).

default_passive

boolean

Suppresses OSPFv2 routing updates on all interfaces.

Choices:

  • false

  • true

distance

dictionary

Configure route administrative distance.

all

integer

Distance value for all type of routes (1 to 255).

external

integer

Distance value for external routes (1 to 255).

inter_area

integer

Distance value for inter-area routes (1 to 255).

intra_area

integer

Distance value for intra-area routes (1 to 255).

graceful_restart

dictionary

OSPF non stop forwarding (NSF) also known as OSPF Graceful Restart.

enable

boolean

Enable graceful restart.

Choices:

  • false

  • true

grace_period

integer

Maximum length of the grace period in seconds (1 to 1800).

helper

dictionary

OSPF GR Helper.

advertise_router_id

list / elements=string

Advertising Router ID.

enable

boolean

Enable Helper support.

Choices:

  • false

  • true

planned_only

boolean

Supported only planned restart.

Choices:

  • false

  • true

strict_lsa_checking

boolean

Enable strict LSA check.

Choices:

  • false

  • true

supported_grace_time

integer

Supported grace interval in seconds (10 to 1800).

log_adjacency_changes

string

Enable OSPFv2 adjacency state logs.

Choices:

  • "brief"

  • "detail"

max_metric

dictionary

Enables infinite metric advertising in OSPFv2 LSAs.

administrative

boolean

Enables administrative type infinite metric advertising.

Choices:

  • false

  • true

external_lsa_all

integer

Configure external LSA all prefix max metric advertising.

Configure the maximum metric value (1 to 16777215).

external_lsa_connected

integer

Configure external LSA connected prefix max metric advertising.

Configure the maximum metric value (1 to 16777215).

on_startup

integer

Enables infinite metric advertising at OSPFv2 router startup (5 to 86400).

router_lsa_all

integer

Configure router LSA all link max metric advertising.

Configure the maximum metric value (1 to 16777215).

router_lsa_stub

integer

Configure router LSA stub link max metric advertising.

Configure the maximum metric value (1 to 16777215).

maximum_paths

integer

Configure maximum number of multiple paths for ECMP support (1 to 256).

non_passive_interfaces

list / elements=dictionary

Configure non passive interface types.

addresses

list / elements=string

Configure Interface IPv4 addresses.

interface

string / required

Full name of the Layer 3 interface, i.e. Eth1/1.

opaque_lsa_capability

boolean

Enables opaque LSA capability.

Choices:

  • false

  • true

passive_interfaces

list / elements=dictionary

Configure passive interface types.

addresses

list / elements=string

Configure Interface IPv4 addresses.

interface

string / required

Full name of the Layer 3 interface, i.e. Eth1/1.

redistribute

list / elements=dictionary

Configure route redistribution into OSPFv2 router.

always

boolean

Enable default route redistribution into OSPF always.

Only available for protocol=default_route.

Choices:

  • false

  • true

metric

integer

Metric value for redistributed routes (0 to 16777214).

metric_type

integer

Metric type for redistributed routes.

Choices:

  • 1

  • 2

protocol

string / required

Configure the type of protocol to redistribute into OSPF.

Deleting protocol alone will also delete all the other configuration under redistribute.

bgp - Border Gateway Protocol.

connected - Directly connected or attached subnets and hosts.

default_route - Default routes.

kernel - Kernel routes other than FRR installed routes.

static - Statically configured routes.

Choices:

  • "bgp"

  • "connected"

  • "default_route"

  • "kernel"

  • "static"

route_map

string

Route map to filter redistributed routes.

Configure route map before.

refresh_timer

integer

Configures LSA refresh interval in seconds (10 to 1800).

rfc1583_compatible

boolean

Enable OSPFv2 RFC compatibility.

Choices:

  • false

  • true

router_id

string

Configure OSPFv2 router identifier (A.B.C.D).

timers

dictionary

Configures router timers.

lsa_min_arrival

integer

LSA minimum arrival timer in milliseconds (0 to 600000).

throttle_lsa_all

integer

LSA delay between transmissions in milliseconds (0 to 5000).

throttle_spf

dictionary

OSPFv2 SPF timers.

delay_time, initial_hold_time and maximum_hold_time are required together.

delay_time

integer

SPF delay time in milliseconds (0 to 600000).

initial_hold_time

integer

SPF initial hold time in milliseconds (0 to 600000).

maximum_hold_time

integer

SPF maximum hold time in milliseconds (0 to 600000).

vrf_name

string

Specifies the vrf name.

Default: "default"

write_multiplier

integer

Specifies the maximum number of interfaces serviced per write (1 to 100)

state

string

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

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

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

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

In case of replaced, the existing OSPFv2 configuration on the device will be replaced by the configuration in the playbook for each VRF 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 ospf
#router ospf vrf Vrf_1
# default-metric 100
# max-metric router-lsa external-lsa all 2
# passive-interface default
# timers throttle spf 50 20 10
# timers throttle lsa all 300
# redistribute bgp metric 15 metric-type 2 route-map RMAP
# no passive-interface Eth1/1 2.2.2.2
# no passive-interface Eth1/2 2.2.2.2
#!
#router ospf
# ospf router-id 20.20.20.20
# distance 30
# distance ospf external 20
# refresh timer 300
# write-multiplier 20
# maximum-paths 200
# passive-interface Eth1/2 3.3.3.3
# passive-interface Eth1/3
#!
#sonic#
#sonic# show running-configuration vrf Vrf_1
#!
#ip vrf Vrf_1
#sonic# show running-configuration ip prefix-list
#!
#ip prefix-list PRF_LIST seq 1 permit 1.1.1.1/24
#ip prefix-list PRF_LIST2 seq 1 permit 1.1.1.1/24
#sonic# show running-configuration route-map
#!
#route-map RMAP permit 1
#sonic#

  - name: Delete the OSPFv2 configurations
    sonic_ospf:
      config:
        - vrf_name: 'default'
          router_id: "20.20.20.20"
          distance:
            external: 20
          default_passive: false
          maximum_paths: 200
          passive_interfaces:
            interfaces:
              - interface: 'Eth1/3'
          redistribute:
            - protocol: "bgp"
              metric: 15
              metric_type: 2
              route_map: "RMAP"
          refresh_timer: 300
        - vrf_name: "Vrf_1"
          timers:
            throttle_spf:
              delay_time: 50
              initial_hold_time: 20
              maximum_hold_time: 10
          default_metric: 100
          max_metric:
            external_lsa_all: 2
          non_passive_interfaces:
            interfaces:
              - interface: "Eth1/2"
                addresses:
                  - "2.2.2.2"
      state: deleted

# After state:
# ------------
#
#sonic# show running-configuration ospf
#router ospf vrf Vrf_1
# passive-interface default
# timers throttle lsa all 300
# no passive-interface Eth1/1 2.2.2.2
# no passive-interface Eth1/2 2.2.2.2
#!
#router ospf
# distance 30
# write-multiplier 20
# passive-interface Eth1/2 3.3.3.3
#!
#sonic#


# Using deleted

# Before state:
# -------------
#
#sonic# show running-configuration ospf
#router ospf vrf Vrf_1
# passive-interface default
# timers throttle lsa all 300
# no passive-interface Eth1/1 2.2.2.2
# no passive-interface Eth1/2 2.2.2.2
#!
#router ospf
# distance 30
# write-multiplier 20
# passive-interface Eth1/2 3.3.3.3
#!
#sonic#
#sonic# show running-configuration vrf Vrf_1
#!
#ip vrf Vrf_1
#sonic# show running-configuration ip prefix-list
#!
#ip prefix-list PRF_LIST seq 1 permit 1.1.1.1/24
#ip prefix-list PRF_LIST2 seq 1 permit 1.1.1.1/24
#sonic# show running-configuration route-map
#!
#route-map RMAP permit 1
#sonic#

  - name: Delete the OSPFv2 configurations
    sonic_ospf:
      config:
        - vrf_name: "Vrf_1"
      state: deleted

# After state:
# ------------
#
#sonic# show running-configuration ospf
#router ospf
# distance 30
# write-multiplier 20
# passive-interface Eth1/2 3.3.3.3
#!
#sonic#


# Using merged

# Before state:
# -------------
#
# sonic# show running-configuration ospf
# (No ospf configuration present)
#sonic# show running-configuration vrf Vrf_1
#!
#ip vrf Vrf_1
#sonic# show running-configuration ip prefix-list
#!
#ip prefix-list PRF_LIST seq 1 permit 1.1.1.1/24
#ip prefix-list PRF_LIST2 seq 1 permit 1.1.1.1/24
#sonic# show running-configuration route-map
#!
#route-map RMAP permit 1
#sonic#

  - name: Add the OSPFv2 configurations
    sonic_ospf:
      config:
        - vrf_name: 'default'
          router_id: "10.10.10.10"
          distance:
            external: 20
          auto_cost_reference_bandwidth: 100
        - vrf_name: "Vrf_1"
          timers:
            throttle_lsa_all: 300
            throttle_spf:
              delay_time: 10
              initial_hold_time: 20
              maximum_hold_time: 50
          redistribute:
            - protocol: "bgp"
              metric: 15
              metric_type: 2
              route_map: "RMAP"
          default_passive: true
          non_passive_interfaces:
            interfaces:
              - interface: "Eth1/1"
                addresses:
                  - "2.2.2.2"
      state: merged

# After state:
# ------------
#
#sonic# show running-configuration ospf
#router ospf vrf Vrf_1
# passive-interface default
# timers throttle spf 10 20 50
# timers throttle lsa all 300
# redistribute bgp metric 15 metric-type 2 route-map RMAP
# no passive-interface Eth1/1 2.2.2.2
#!
#router ospf
# auto-cost reference-bandwidth 100
# ospf router-id 10.10.10.10
# distance ospf external 20
#!
#sonic#


# Using merged

# Before state:
# -------------
#
#sonic# show running-configuration ospf
#router ospf vrf Vrf_1
# passive-interface default
# timers throttle spf 10 20 50
# timers throttle lsa all 300
# redistribute bgp metric 15 metric-type 2 route-map RMAP
# no passive-interface Eth1/1 2.2.2.2
#!
#router ospf
# ospf router-id 10.10.10.10
# distance ospf external 20
#!
#sonic#
#sonic# show running-configuration vrf Vrf_1
#!
#ip vrf Vrf_1
#sonic# show running-configuration ip prefix-list
#!
#ip prefix-list PRF_LIST seq 1 permit 1.1.1.1/24
#ip prefix-list PRF_LIST2 seq 1 permit 1.1.1.1/24
#sonic# show running-configuration route-map
#!
#route-map RMAP permit 1
#sonic#

  - name: Add the OSPFv2 configurations
    sonic_ospf:
      config:
        - vrf_name: 'default'
          write_multiplier: 20
          router_id: "20.20.20.20"
          distance:
            all: 30
          default_passive: false
          graceful_restart:
            enable: true
            grace_period: 100
            helper:
              enable: true
              planned_only: true
              advertise_router_id:
                - '1.1.1.1'
                - '2.2.2.2'
          passive_interfaces:
            interfaces:
              - interface: 'Eth1/2'
                addresses:
                  - '3.3.3.3'
              - interface: 'Eth1/3'
          log_adjacency_changes: 'detail'
        - vrf_name: "Vrf_1"
          timers:
            throttle_spf:
              delay_time: 50
              initial_hold_time: 20
              maximum_hold_time: 10
          max_metric:
            external_lsa_all: 30
          log_adjacency_changes: 'brief'
          default_passive: true
          non_passive_interfaces:
            interfaces:
              - interface: "Eth1/2"
                addresses:
                  - "2.2.2.2"
      state: merged

# After state:
# ------------
#
#sonic# show running-configuration ospf
#router ospf vrf Vrf_1
# log-adjacency-changes
# max-metric router-lsa external-lsa all 30
# passive-interface default
# timers throttle spf 50 20 10
# timers throttle lsa all 300
# redistribute bgp metric 15 metric-type 2 route-map RMAP
# no passive-interface Eth1/1 2.2.2.2
# no passive-interface Eth1/2 2.2.2.2
#!
#router ospf
# ospf router-id 20.20.20.20
# distance 30
# distance ospf external 20
# log-adjacency-changes detail
# graceful-restart grace-period 100
# graceful-restart helper enable
# graceful-restart helper planned-only
# graceful-restart helper enable 1.1.1.1
# graceful-restart helper enable 2.2.2.2
# write-multiplier 20
# passive-interface Eth1/2 3.3.3.3
# passive-interface Eth1/3
#!
#sonic#


# Using replaced

# Before state:
# -------------
#
#sonic# show running-configuration ospf
#router ospf vrf Vrf_1
# max-metric router-lsa external-lsa all 2
# passive-interface default
# timers throttle spf 50 20 10
# timers throttle lsa all 300
# redistribute bgp metric 15 metric-type 2 route-map RMAP
# no passive-interface Eth1/1 2.2.2.2
# no passive-interface Eth1/2 2.2.2.2
#!
#router ospf
# ospf router-id 20.20.20.20
# distance 30
# distance ospf external 20
# write-multiplier 20
# passive-interface Eth1/2 3.3.3.3
# passive-interface Eth1/3
#!
#sonic#
#sonic# show running-configuration vrf Vrf_1
#!
#ip vrf Vrf_1
#sonic# show running-configuration ip prefix-list
#!
#ip prefix-list PRF_LIST seq 1 permit 1.1.1.1/24
#ip prefix-list PRF_LIST2 seq 1 permit 1.1.1.1/24
#sonic# show running-configuration route-map
#!
#route-map RMAP permit 1
#route-map RMAP2 permit 2
#sonic#

  - name: Replace the OSPFv2 vrf default configurations
    sonic_ospf:
      config:
        - vrf_name: 'default'
          router_id: "20.20.20.20"
          redistribute:
            - protocol: "connected"
              metric: 15
              metric_type: 2
              route_map: "RMAP2"
            - protocol: "default_route"
              always: true
              route_map: "RMAP"
          distance:
            all: 20
          abr_type: cisco
          opaque_lsa_capability: true
      state: replaced

# After state:
# ------------
#
#sonic# show running-configuration ospf
#router ospf vrf Vrf_1
# max-metric router-lsa external-lsa all 2
# passive-interface default
# timers throttle spf 50 20 10
# timers throttle lsa all 300
# redistribute bgp metric 15 metric-type 2 route-map RMAP
# no passive-interface Eth1/1 2.2.2.2
# no passive-interface Eth1/2 2.2.2.2
#!
#router ospf
# capability opaque
# ospf router-id 20.20.20.20
# default-information originate always route-map RMAP
# distance 20
# ospf abr-type cisco
# redistribute connected metric 15 metric-type 2 route-map RMAP2
#!


# Using overridden

# Before state:
# -------------
#
#sonic# show running-configuration ospf
#router ospf vrf Vrf_1
# max-metric router-lsa external-lsa all 2
# passive-interface default
# timers throttle spf 50 20 10
# timers throttle lsa all 300
# redistribute bgp metric 15 metric-type 2 route-map RMAP
# no passive-interface Eth1/1 2.2.2.2
# no passive-interface Eth1/2 2.2.2.2
#!
#router ospf
# ospf router-id 20.20.20.20
# distance 30
# distance ospf external 20
# write-multiplier 20
# passive-interface Eth1/2 3.3.3.3
# passive-interface Eth1/3
#!
#sonic#
#sonic# show running-configuration vrf Vrf_1
#!
#ip vrf Vrf_1
#sonic# show running-configuration ip prefix-list
#!
#ip prefix-list PRF_LIST seq 1 permit 1.1.1.1/24
#ip prefix-list PRF_LIST2 seq 1 permit 1.1.1.1/24
#sonic# show running-configuration route-map
#!
#route-map RMAP permit 1
#route-map RMAP2 permit 2
#sonic#

  - name: Override the OSPFv2 configurations
    sonic_ospf:
      config:
        - vrf_name: 'default'
          router_id: "20.20.20.20"
          redistribute:
            - protocol: "connected"
              metric: 15
              metric_type: 2
              route_map: "RMAP2"
          distance:
            all: 20
          rfc1583_compatible: true
      state: overridden

# After state:
# ------------
#
#sonic# show running-configuration ospf
#router ospf
# compatible rfc1583
# ospf router-id 20.20.20.20
# distance 20
# redistribute connected metric 15 metric-type 2 route-map RMAP2
#!

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 module invocation.

Returned: when changed

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

after(generated)

list / elements=string

The generated configuration module invocation.

Returned: when check_mode

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

before

list / elements=string

The configuration prior to the module invocation.

Returned: always

Sample: ["The configuration returned will always be in the same format\n as 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)