dellemc.enterprise_sonic.sonic_ospfv3_area module – Configure OSPFv3 area settings on SONiC.

Note

This module is part of the dellemc.enterprise_sonic collection (version 3.2.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_ospfv3_area.

New in dellemc.enterprise_sonic 3.1.0

Synopsis

  • This module provides configuration for the area settings of OSPFv3 running on SONiC switches.

  • Configure global/VRF OSPFv3 instance before configuring OSPFv3 areas.

  • Configure OSPFv3 instance before configuring OSPFv3 areas.

Parameters

Parameter

Comments

config

list / elements=dictionary

Specifies configuration for OSPFv3 areas.

stub and nssa are mutually exclusive.

If area_id=0 or 0.0.0.0, stub/nssa should not be specified.

area_id

string / required

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

filter_list_in

string

Inter-area prefix filter list.

Filter incoming prefixes into the area.

Expects name of a prefix list.

filter_list_out

string

Inter-area prefix filter list.

Filter outgoing prefixes from the area.

Expects name of a prefix list.

nssa

dictionary

Configuration for NSSA type area.

default_originate and no_summary are mutually exclusive.

default_originate

dictionary

Advertise default route for the NSSA area.

enabled

boolean / required

Enable to advertise the default route for the NSSA area.

Choices:

  • false

  • true

metric

integer

Configure metric for the redistributed route (0 to 16777214).

metric_type

integer

Configure metric type for the redistributed route.

Choices:

  • 1

  • 2

enabled

boolean / required

Configure area as NSSA type area.

Choices:

  • false

  • true

no_summary

boolean

Disable inter-area route injection into the NSSA.

Choices:

  • false

  • true

ranges

list / elements=dictionary

Configure address range summarization on border routers.

advertise

boolean

Enable address range advertising.

Default value while creating a new range is True.

If the cost is specified, advertise is unconditionally set to True during playbook execution.

Choices:

  • false

  • true

cost

integer

Configure cost of address range (0 to 16777215).

prefix

string / required

Configure address range prefix.

ranges

list / elements=dictionary

Configure address range summarization on border routers.

advertise

boolean

Enable address range advertising.

Default value while creating a new range is True.

If the cost is specified, advertise is unconditionally set to True during playbook execution.

Choices:

  • false

  • true

cost

integer

Configure cost of address range (0 to 16777215).

prefix

string / required

Configure address range prefix.

stub

dictionary

Configuration for STUB type area.

enabled

boolean / required

Configure area as STUB type area.

Choices:

  • false

  • true

no_summary

boolean

Disable inter-area route injection into the STUB.

Choices:

  • false

  • true

vrf_name

string / required

Name of the VRF this area belongs to.

state

string

Specifies the type of configuration update to be performed on the device.

Choices:

  • "merged" ← (default)

  • "replaced"

  • "overridden"

  • "deleted"

Notes

Note

  • Supports check_mode.

  • Tested against Enterprise SONiC Distribution by Dell Technologies.

Examples

# Using "deleted" state
#
# Before state:
# -------------
# sonic(config-router-ospfv3)# show configuration
# !
# router ospfv3 vrf Vrf1
#  area 0.0.0.1 stub no-summary
#  area 0.0.0.1 filter-list prefix pf1 in
#  area 0.0.0.1 filter-list prefix pf2 out
#  area 0.0.0.2 stub no-summary
#  area 0.0.0.1 range 1::1/64 not-advertise
#  area 0.0.0.1 range 1::2/64
#  area 0.0.0.2 range 1::1/64
#  area 0.0.0.3 range 1::3/24 cost 14
# sonic(config-router-ospfv3)#

- name: "test delete all settings for areas"
  dellemc.enterprise_sonic.sonic_ospfv3_area:
    state: deleted
    config:
      - area_id: 0.0.0.1
        vrf_name: Vrf1
      - area_id: 0.0.0.2
        vrf_name: Vrf1
        ranges:
          - prefix: 1::1/64
            advertise: true
        stub:
          enabled: true
          no_summary: true

# After state
# -------------
# sonic(config-router-ospfv3)# show configuration
# !
# router ospfv3 vrf Vrf1
#  area 0.0.0.3 range 1::3/24 cost 14
# sonic(config-router-ospfv3)#


# Using "deleted" state
# Before state:
# -------------
# sonic(config-router-ospfv3)# show configuration
# !
# router ospfv3 vrf Vrf1
#  area 0.0.0.1 nssa no-summary
#  area 0.0.0.3 filter-list prefix pf1 in
#  area 0.0.0.1 nssa
#  area 0.0.0.4 stub no-summary
#  area 0.0.0.1 nssa range 1::1/64
#  area 0.0.0.1 nssa range 1::2/64 cost 20
#  area 0.0.0.2 range 1::1/64 not-advertise
#  area 0.0.0.2 range 1::2/64 advertise cost 4
#  area 0.0.0.2 range 1::3/24 not-advertise
# sonic(config-router-ospfv3)#

- name: "test clear subsections"
  dellemc.enterprise_sonic.sonic_ospfv3_area:
    state: deleted
    config:
      - area_id: 0.0.0.1
        vrf_name: Vrf1
        nssa:
          enabled: true
          ranges: []
      - area_id: 0.0.0.2
        vrf_name: Vrf1
        ranges: []
      - area_id: 4
        vrf_name: Vrf1

# After state
# -------------
# sonic(config-router-ospfv3)# show configuration
# !
# router ospfv3 vrf Vrf1
#  area 0.0.0.1 nssa no-summary
#  area 0.0.0.3 filter-list prefix pf1 in
#  area 0.0.0.1 nssa
# sonic(config-router-ospfv3)#


# Using "deleted" state
# Before state:
# -------------
# sonic# show running-configuration ospfv3
# !
# router ospfv3 vrf Vrf1
#  area 0.0.0.1 nssa no-summary
#  area 0.0.0.1 filter-list prefix pf1 in
#  area 0.0.0.1 filter-list prefix pf2 out
#  area 0.0.0.3 filter-list prefix pf1 in
#  area 0.0.0.1 nssa
#  area 0.0.0.4 stub no-summary
#  area 0.0.0.1 nssa range 1::1/64
#  area 0.0.0.1 nssa range 1::2/64 cost 20
#  area 0.0.0.2 range 1::1/64 not-advertise
#  area 0.0.0.2 range 1::2/64 advertise cost 4
#  area 0.0.0.2 range 1::3/24 not-advertise
# router ospfv3
#  area 0.0.0.1 nssa no-summary
#  area 0.0.0.1 filter-list prefix pf1 in
#  area 0.0.0.1 filter-list prefix pf2 out
#  area 0.0.0.3 filter-list prefix pf1 in
#  area 0.0.0.1 nssa
#  area 0.0.0.4 stub no-summary
#  area 0.0.0.1 nssa range 1::1/64
#  area 0.0.0.1 nssa range 1::2/64 cost 20
#  area 0.0.0.2 range 1::1/64 not-advertise
#  area 0.0.0.2 range 1::2/64 advertise cost 4
#  area 0.0.0.2 range 1::3/24 not-advertise
# sonic#

- name: "test clear subsections"
  dellemc.enterprise_sonic.sonic_ospfv3_area:
    state: deleted
    config:
      - area_id: 0.0.0.1
        vrf_name: Vrf1
        filter_list_in: pf1
        filter_list_out: pf2
        nssa:
          enabled: true
          range:
            - prefix: 1::2/64
              advertise: true
              cost: 20
      - area_id: 0.0.0.2
        vrf_name: Vrf1
        range:
          - prefix: 1::2/64
      - area_id: 3
        vrf_name: default
      - area_id: 4
        vrf_name: default
        stub:
          enabled: true
          no_summary: true

# After state
# -------------
# sonic# show running-configuration ospfv3
# !
# router ospfv3 vrf Vrf1
#  area 0.0.0.1 nssa no-summary
#  area 0.0.0.3 filter-list prefix pf1 in
#  area 0.0.0.1 nssa
#  area 0.0.0.4 stub no-summary
#  area 0.0.0.1 nssa range 1::1/64
#  area 0.0.0.2 range 1::1/64 not-advertise
#  area 0.0.0.2 range 1::3/24 not-advertise
# router ospfv3
#  area 0.0.0.1 nssa no-summary
#  area 0.0.0.1 filter-list prefix pf1 in
#  area 0.0.0.1 filter-list prefix pf2 out
#  area 0.0.0.1 nssa
#  area 0.0.0.4
#  area 0.0.0.1 nssa range 1::1/64
#  area 0.0.0.1 nssa range 1::2/64 cost 20
#  area 0.0.0.2 range 1::1/64 not-advertise
#  area 0.0.0.2 range 1::2/64 advertise cost 4
#  area 0.0.0.2 range 1::3/24 not-advertise
# sonic#


# Using "merged" state
# Before state:
# -------------
# sonic# show running-configuration ospfv3
# !
# router ospfv3 vrf Vrf2
# !
# router ospfv3 vrf Vrf1
# sonic#

- name: merge examples of all settings
  dellemc.enterprise_sonic.sonic_ospfv3_area:
    state: merged
    config:
      - area_id: 1
        vrf_name: Vrf1
      - area_id: 2
        vrf_name: Vrf1
        stub:
          enabled: true
          no_summary: true
      - area_id: 3
        vrf_name: Vrf1
        filter_list_in: pf1
        filter_list_out: pf2
        ranges:
          - prefix: 1::1/64
          - prefix: 1::2/64
            advertise: true
            cost: 4
          - prefix: 1::3/24
            advertise: false
          - prefix: 1::4/24
            advertise: true
            cost: 10
      - area_id: 4
        vrf_name: Vrf1
      - area_id: 5
        vrf_name: Vrf2

# After state
# -------------
# sonic# show running-configuration ospfv3
#
# outer ospfv3 vrf Vrf1
# area 0.0.0.1
# area 0.0.0.2 stub no-summary
# area 0.0.0.3 filter-list prefix pf1 in
# area 0.0.0.3 filter-list prefix pf2 out
# area 0.0.0.4
# area 0.0.0.3 range 1::1/64
# area 0.0.0.3 range 1::2/64 advertise cost 4
# area 0.0.0.3 range 1::3/24 not-advertise
# area 0.0.0.3 range 1::4/24 advertise cost 10
# !
# router ospfv3 vrf Vrf2
#  area 0.0.0.5
# sonic#


# Using "merged" state
# Before state:
# -------------
# sonic(config-router-ospfv3)# show configuration
# !
# router ospfv3 vrf Vrf2
# sonic(config-router-ospfv3)# show configuration
# !
# router ospfv3 vrf Vrf1
# sonic(config-router-ospfv3)#

- name: merge smallest group of settings
  dellemc.enterprise_sonic.sonic_ospfv3_area:
    state: merged
    config:
      - area_id: 0.0.0.1
        vrf_name: Vrf1
      - area_id: 0.0.0.2
        vrf_name: Vrf1
        nssa:
          enabled: true
          no_summary: true
      - area_id: 0.0.0.3
        vrf_name: Vrf1
        ranges:
          - prefix: 1::1/64
        nssa:
          enabled: true
          default_originate:
            enabled: true
      - area_id: 0.0.0.4
        vrf_name: Vrf2
        stub:
          enabled: true
      - area_id: 0.0.0.5
        vrf_name: Vrf2
        filter_list_in: pf1
        filter_list_out: pf2

# After state
# -------------
# sonic(config-router-ospfv3)# show configuration
# !
# router ospfv3 vrf Vrf1
#  area 0.0.0.1
#  area 0.0.0.2 nssa no-summary
#  area 0.0.0.3 range 1::1/64
#  area 0.0.0.3 nssa default-information-originate
# sonic(config-router-ospfv3)# router ospfv3 vrf Vrf2
# sonic(config-router-ospfv3)# show configuration
# !
# router ospfv3 vrf Vrf2
#  area 0.0.0.4 stub
#  area 0.0.0.5 filter-list prefix pf1 in
#  area 0.0.0.5 filter-list prefix pf2 out
# sonic(config-router-ospfv3)#


# Using "merged" state
# Before state:
# -------------
# sonic(config-router-ospfv3)# show configuration
# !
# router ospfv3 vrf Vrf1
#  area 0.0.0.1 stub no-summary
#  area 0.0.0.1 filter-list prefix pf1 in
#  area 0.0.0.1 filter-list prefix pf2 out
#  area 0.0.0.1 range 1::1/64 not-advertise
#  area 0.0.0.1 range 1::2/64 advertise
# sonic(config-router-ospfv3)#

- name: "test merge all settings"
  dellemc.enterprise_sonic.sonic_ospfv3_area:
    state: merged
    config:
      - area_id: 0.0.0.1
        vrf_name: Vrf1
        filter_list_in: pf2
        filter_list_out: pf1
        ranges:
          - prefix: 1::1/64
            advertise: true
            cost: 12
          - prefix: 1::2/64
            advertise: false
        stub:
          enabled: true
          no_summary: false

# After state
# -------------
# sonic(config-router-ospfv3)# show configuration
# !
# router ospfv3 vrf Vrf1
#  area 0.0.0.1 stub
#  area 0.0.0.1 filter-list prefix pf2 in
#  area 0.0.0.1 filter-list prefix pf1 out
#  area 0.0.0.1 range 1::1/64 advertise cost 12
#  area 0.0.0.1 range 1::2/64 not-advertise
# sonic(config-router-ospfv3)#


# Using "replaced" state
# Before state:
# -------------
# sonic# show running-configuration ospfv3
# !
# router ospfv3 vrf Vrf1
#  area 0.0.0.1 nssa no-summary
#  area 0.0.0.1 filter-list prefix pf1 in
#  area 0.0.0.1 filter-list prefix pf2 out
#  area 0.0.0.3 filter-list prefix pf1 in
#  area 0.0.0.1 nssa
#  area 0.0.0.4 stub no-summary
#  area 0.0.0.1 nssa range 1::1/64
#  area 0.0.0.1 nssa range 1::2/64 cost 20
#  area 0.0.0.2 range 1::1/64 not-advertise
#  area 0.0.0.2 range 1::2/64 advertise cost 4
#  area 0.0.0.2 range 1::3/24 not-advertise
# router ospfv3
#  area 0.0.0.1 nssa no-summary
#  area 0.0.0.1 filter-list prefix pf1 in
#  area 0.0.0.1 filter-list prefix pf2 out
#  area 0.0.0.3 filter-list prefix pf1 in
#  area 0.0.0.1 nssa
#  area 0.0.0.4 stub no-summary
#  area 0.0.0.1 nssa range 1::1/64
#  area 0.0.0.1 nssa range 1::2/64 cost 20
#  area 0.0.0.2 range 1::1/64 not-advertise
#  area 0.0.0.2 range 1::2/64 advertise cost 4
#  area 0.0.0.2 range 1::3/24 not-advertise
# sonic#

- name: "replace areas"
  dellemc.enterprise_sonic.sonic_ospfv3_area:
    state: replaced
    config:
      - area_id: 0.0.0.1
        vrf_name: Vrf1
      - area_id: 0.0.0.5
        vrf_name: Vrf1
        nssa:
          enabled: true
          default_originate:
            enabled: true
            metric: 10
            metric_type: 1
          ranges:
            - prefix: "1::1/64"
              cost: 15
      - area_id: 0.0.0.4
        vrf_name: Vrf1
        stub:
          no_summary: true
          enabled: true

# After state
# -------------
# sonic# show running-configuration ospfv3
# !
# router ospfv3 vrf Vrf1
#  area 0.0.0.1
#  area 0.0.0.4 stub no-summary
#  area 0.0.0.5 nssa nssa default-information-originate metric 10 metric-type 1
#  area 0.0.0.5 nssa range 1::1/64 cost 15
# router ospfv3
#  area 0.0.0.1 nssa no-summary
#  area 0.0.0.1 filter-list prefix pf1 in
#  area 0.0.0.1 filter-list prefix pf2 out
#  area 0.0.0.3 filter-list prefix pf1 in
#  area 0.0.0.1 nssa
#  area 0.0.0.4 stub no-summary
#  area 0.0.0.1 nssa range 1::1/64
#  area 0.0.0.1 nssa range 1::2/64 cost 20
#  area 0.0.0.2 range 1::1/64 not-advertise
#  area 0.0.0.2 range 1::2/64 advertise cost 4
#  area 0.0.0.2 range 1::3/24 not-advertise
# sonic#


# Using "overridden" state
# Before state:
# -------------
# sonic# show running-configuration ospfv3
# !
# router ospfv3 vrf Vrf1
#  area 0.0.0.1 nssa no-summary
#  area 0.0.0.1 filter-list prefix pf1 in
#  area 0.0.0.1 filter-list prefix pf2 out
#  area 0.0.0.3 filter-list prefix pf1 in
#  area 0.0.0.1 nssa
#  area 0.0.0.4 stub no-summary
#  area 0.0.0.1 nssa range 1::1/64
#  area 0.0.0.1 nssa range 1::2/64 cost 20
#  area 0.0.0.2 range 1::1/64 not-advertise
#  area 0.0.0.2 range 1::2/64 advertise cost 4
#  area 0.0.0.2 range 1::3/24 not-advertise
# router ospfv3
#  area 0.0.0.1 nssa no-summary
#  area 0.0.0.1 filter-list prefix pf1 in
#  area 0.0.0.1 filter-list prefix pf2 out
#  area 0.0.0.3 filter-list prefix pf1 in
#  area 0.0.0.1 nssa
#  area 0.0.0.4 stub no-summary
#  area 0.0.0.1 nssa range 1::1/64
#  area 0.0.0.1 nssa range 1::2/64 cost 20
#  area 0.0.0.2 range 1::1/64 not-advertise
#  area 0.0.0.2 range 1::2/64 advertise cost 4
#  area 0.0.0.2 range 1::3/24 not-advertise
# sonic#

- name: "override areas"
  dellemc.enterprise_sonic.sonic_ospfv3_area:
    state: overridden
    config:
      - area_id: 0.0.0.1
        vrf_name: Vrf1
      - area_id: 0.0.0.5
        vrf_name: Vrf1
        nssa:
          enabled: true
          default_originate:
            enabled: true
            metric: 10
            metric_type: 1
          ranges:
            - prefix: "1::1/64"
              cost: 15
      - area_id: 0.0.0.4
        vrf_name: Vrf1
        stub:
          no_summary: true
          enabled: true

# After state
# -------------
# sonic# show running-configuration ospfv3
# !
# router ospfv3 vrf Vrf1
#  area 0.0.0.1
#  area 0.0.0.4 stub no-summary
#  area 0.0.0.5 nssa nssa default-information-originate metric 10 metric-type 1
#  area 0.0.0.5 nssa range 1::1/64 cost 15
# router ospfv3
# 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 configuration resulting from 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 (calculated) configuration that would be applied by module 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 module 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: [{"config": "...", "state": "..."}, {"config": "...", "state": "..."}]

Authors

  • Santhosh kumar T (@santhosh-kt)