dellemc.enterprise_sonic.sonic_ospf_area module – configure OSPF area settings on SONiC

Note

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

New in dellemc.enterprise_sonic 2.5.0

Synopsis

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

Parameters

Parameter

Comments

config

list / elements=dictionary

Specifies configuration for OSPFv2 areas

area_id

string / required

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

authentication_type

string

authentication type for area

Choices:

  • "message_digest"

  • "text"

default_cost

integer

Configure NSSA or stub area summary default cost

range is 0 to 16777215 inclusive

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.

networks

list / elements=string

Configure networks in an area

is a masked ip address

ranges

list / elements=dictionary

Configure address range summarization on border routers

advertise

boolean

enable address range advertising

Choices:

  • false

  • true

cost

integer

configure cost of address range

range is 0 to 16777215 inclusive

prefix

string / required

address range prefix

is a masked ip address

substitute

string

Configure substitute prefix for the address range

is a masked ip address

shortcut

string

Configure area’s shortcut mode

Choices:

  • "default"

  • "disable"

  • "enable"

stub

dictionary

configuration for stub type area

enabled

boolean

configure area as stub type area

Choices:

  • false

  • true

no_summary

boolean

disable inter-area route injection into the stub

Choices:

  • false

  • true

list / elements=dictionary

configuration for virtual links

dictionary

configure authentication settings for virtual link

string

authentication type for virtual link

Choices:

  • "message_digest"

  • "text"

  • "none"

string

text authentication password for virtual link

boolean

password is in encrypted format

Choices:

  • false

  • true

integer

configure adjacency dead interval

value is in seconds

range is 1 to 65535 inclusive

boolean

enable virtual link

Choices:

  • false

  • true

integer

configure neighbor hello interval

value is in seconds

range is 1 to 65535 inclusive

list / elements=dictionary

configure message-digest authentication keys

For deletion, only the key_id is used.

string

authentication password (ignored for deletion)

boolean

password is in encrypted format (ignored for deletion)

Choices:

  • false

  • true

integer / required

message-digest authentication key id

range is 1 to 255 inclusive

integer

configure LSA retransmit interval

value is in seconds

range is 1 to 65535 inclusive

string / required

router id of the remote ABR

ip address format

integer

configure LSA transmit delay

value is in seconds

range is 1 to 65535 inclusive

vrf_name

string

name of the vrf this area belongs to

Default: "default"

state

string

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

Choices:

  • "merged" ← (default)

  • "replaced"

  • "overridden"

  • "deleted"

Examples

# NOTE: Configuration of an OSPF network instance (VRF) is required before an OSPF "area" can
# be configured in association with that network instance (VRF).

# using merged to add or change ospf_area settings
    # merging all settings for an area
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: merge examples of all settings
        sonic_ospf_area:
          state: merged
          config:
          - area_id: 2
            vrf_name: Vrf1
            authentication_type: message_digest
            default_cost: 3
            stub:
              enabled: True
              no_summary: True
            shortcut: default
          - area_id: 3
            vrf_name: Vrf1
            filter_list_in: pf1
            filter_list_out: pf2
            ranges:
            - prefix: 1.1.1.1/24
            - prefix: 1.1.1.2/24
              advertise: True
              cost: 4
            - prefix: 1.1.1.3/24
              advertise: False
              substitute: 2.2.2.2/24
            - prefix: 1.1.1.4/24
              advertise: True
              cost: 10
              substitute: 3.3.3.3/24
          - area_id: 4
            vrf_name: Vrf1
            networks:
            - 1.1.1.1/24
            - 3.5.1.5/23
            - 23.235.75.1/23
          - area_id: 5
            vrf_name: Vrf1
            virtual_links:
            - router_id: 34.7.35.1
            - router_id: 34.7.35.2
              enabled: True
              dead_interval: 10
              hello_interval: 30
              retransmit_interval: 40
              transmit_delay: 50
              authentication:
                auth_type: text
                key: "U2FsdGVkX197YJtZ/3Ac6n5kRIG/ZqeU1/wC0cVFyfU="
                key_encrypted: True
              message_digest_list:
              - key_id: 1
                key: "U2FsdGVkX1/wbqjMB7Lr+Mm3wY8+lCdaqUmG2rr9Adw="
                key_encrypted: True
              - key_id: 2
                key: "U2FsdGVkX18Czj9r8skDrg/wtpwTKKCQ8FXUehpCmHc="
                key_encrypted: True

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.2 authentication message-digest
    #  area 0.0.0.2 stub no-summary
    #  area 0.0.0.2 default-cost 3
    #  area 0.0.0.2 shortcut default
    #  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.5
    #  area 0.0.0.5 virtual-link 34.7.35.1
    #  area 0.0.0.5 virtual-link 34.7.35.2
    #  area 0.0.0.5 virtual-link 34.7.35.2 authentication
    #  area 0.0.0.5 virtual-link 34.7.35.2 authentication-key U2FsdGVkX197YJtZ/3Ac6n5kRIG/ZqeU1/wC0cVFyfU= encrypted
    #  area 0.0.0.5 virtual-link 34.7.35.2 dead-interval 10
    #  area 0.0.0.5 virtual-link 34.7.35.2 hello-interval 30
    #  area 0.0.0.5 virtual-link 34.7.35.2 retransmit-interval 40
    #  area 0.0.0.5 virtual-link 34.7.35.2 transmit-delay 50
    #  area 0.0.0.5 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX1/wbqjMB7Lr+Mm3wY8+lCdaqUmG2rr9Adw= encrypted
    #  area 0.0.0.5 virtual-link 34.7.35.2 message-digest-key 2 md5 U2FsdGVkX18Czj9r8skDrg/wtpwTKKCQ8FXUehpCmHc= encrypted
    #  area 0.0.0.3 range 1.1.1.1/24
    #  area 0.0.0.3 range 1.1.1.2/24 advertise cost 4
    #  area 0.0.0.3 range 1.1.1.3/24 not-advertise
    #  area 0.0.0.3 range 1.1.1.4/24 advertise cost 10
    #  area 0.0.0.3 range 1.1.1.4/24 substitute 3.3.3.3/24
    #  network 1.1.1.1/24 area 0.0.0.4
    #  network 23.235.75.1/23 area 0.0.0.4
    #  network 3.5.1.5/23 area 0.0.0.4
    # !
    # router ospf vrf Vrf2
    # !
    # -----

    # minimum data for config subsections
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: merge smallest group of settings
        sonic_ospf_area:
          state: merged
          config:
          - area_id: 0.0.0.2
            vrf_name: Vrf1
            networks:
            - 1.1.1.1/24
          - area_id: 0.0.0.3
            vrf_name: Vrf1
            ranges:
            - prefix: 1.1.1.1/24
          - area_id: 0.0.0.4
            vrf_name: Vrf1
            virtual_links:
            - router_id: 34.7.35.1
          - area_id: 0.0.0.5
            vrf_name: Vrf1
            virtual_links:
            - router_id: 34.7.35.1
              message_digest_list:
              - key_id: 1
                key: grighr
  # NOTE: The existence of an 'area' is only displayed by this Ansible module if configuration options are
  # currently configured for that area. (An "area" that currently has no configured sub-options is not displayed.)

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.2
    #  area 0.0.0.3
    #  area 0.0.0.4
    #  area 0.0.0.5
    #  area 0.0.0.4 virtual-link 34.7.35.1
    #  area 0.0.0.5 virtual-link 34.7.35.1
    #  area 0.0.0.5 virtual-link 34.7.35.1 message-digest-key 1 md5 U2FsdGVkX19oCaX2HsxLR2nWtyK15AfE7ajHVjzgoaY= encrypted
    #  area 0.0.0.3 range 1.1.1.1/24
    #  network 1.1.1.1/24 area 0.0.0.2
    # !
    # router ospf vrf Vrf2
    # !
    # -----

    # merging and making changes to attributes
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 authentication message-digest
    #  area 0.0.0.1 stub no-summary
    #  area 0.0.0.1 default-cost 6
    #  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 shortcut disable
    #  area 0.0.0.1 virtual-link 1.1.1.1
    #  area 0.0.0.1 virtual-link 1.1.1.1 authentication
    #  area 0.0.0.1 virtual-link 1.1.1.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.1 virtual-link 1.1.1.1 dead-interval 10
    #  area 0.0.0.1 virtual-link 1.1.1.1 hello-interval 10
    #  area 0.0.0.1 virtual-link 1.1.1.1 retransmit-interval 10
    #  area 0.0.0.1 virtual-link 1.1.1.1 transmit-delay 10
    #  area 0.0.0.1 virtual-link 1.1.1.2
    #  area 0.0.0.1 virtual-link 1.1.1.2 dead-interval 34
    #  area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 1 md5 U2FsdGVkX1//fyBCsQYQI4q743L8Rf1Q1qUOEc75lNM= encrypted
    #  area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 2 md5 U2FsdGVkX18tvS+HyOt1zIbx9P8I9NMguQ17NZGd9ZY= encrypted
    #  area 0.0.0.1 range 1.1.1.1/24 not-advertise
    #  area 0.0.0.1 range 1.1.1.2/24 advertise
    #  network 1.1.1.1/24 area 0.0.0.1
    #  network 1.1.1.2/24 area 0.0.0.1
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: "test merge all settings"
        sonic_ospf_area:
          state: merged
          config:
          - area_id: 0.0.0.1
            vrf_name: Vrf1
            authentication_type: text
            default_cost: 5
            filter_list_in: pf2
            filter_list_out: pf1
            networks:
            - 1.1.1.5/24
            ranges:
            - prefix: 1.1.1.1/24
              advertise: True
              cost: 12
              substitute: 11.11.1.1/24
            - prefix: 1.1.1.2/24
              advertise: False
            shortcut: enable
            stub:
              enabled: True
              no_summary: False
            virtual_links:
            - router_id: 1.1.1.1
              enabled: True
              dead_interval: 45
              hello_interval: 21
              retransmit_interval: 15
              transmit_delay: 23
              authentication:
                auth_type: text
                key: "U2FsdGVkX1/lz7KE/onDUAhQU2nftsm/nddLb2ZvYSQ="
                key_encrypted: True
              message_digest_list:
              - key_id: 1
                key: "somepass"
            - router_id: 1.1.1.2
              dead_interval: 16

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 authentication
    #  area 0.0.0.1 stub
    #  area 0.0.0.1 default-cost 5
    #  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 shortcut enable
    #  area 0.0.0.1 virtual-link 1.1.1.1
    #  area 0.0.0.1 virtual-link 1.1.1.1 authentication
    #  area 0.0.0.1 virtual-link 1.1.1.1 authentication-key U2FsdGVkX1/lz7KE/onDUAhQU2nftsm/nddLb2ZvYSQ= encrypted
    #  area 0.0.0.1 virtual-link 1.1.1.1 dead-interval 45
    #  area 0.0.0.1 virtual-link 1.1.1.1 hello-interval 21
    #  area 0.0.0.1 virtual-link 1.1.1.1 retransmit-interval 15
    #  area 0.0.0.1 virtual-link 1.1.1.1 transmit-delay 23
    #  area 0.0.0.1 virtual-link 1.1.1.2
    #  area 0.0.0.1 virtual-link 1.1.1.2 dead-interval 16
    #  area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 1 md5 U2FsdGVkX18D0swlrl3pVzMGxRZYzY58X06jPq2CrNU= encrypted
    #  area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 2 md5 U2FsdGVkX18tvS+HyOt1zIbx9P8I9NMguQ17NZGd9ZY= encrypted
    #  area 0.0.0.1 range 1.1.1.1/24 advertise cost 12
    #  area 0.0.0.1 range 1.1.1.1/24 substitute 11.11.1.1/24
    #  area 0.0.0.1 range 1.1.1.2/24 not-advertise
    #  network 1.1.1.1/24 area 0.0.0.1
    #  network 1.1.1.2/24 area 0.0.0.1
    #  network 1.1.1.5/24 area 0.0.0.1
    # !
    # router ospf vrf Vrf2
    # !
    # -----

    # merging different keys
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: "test merge different keys"
        sonic_ospf_area:
          state: merged
          config:
          - area_id: 0.0.0.1
            vrf_name: Vrf1
            virtual_links:
            - router_id: 1.1.1.1
              authentication:
                key: qwerty
                key_encrypted: False
            - router_id: 1.1.1.3
              authentication:
                key: "U2FsdGVkX1/lz7KE/onDUAhQU2nftsm/nddLb2ZvYSQ="
                key_encrypted: True
            - router_id: 1.1.1.4
              authentication:
                key: somepass

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1
    #  area 0.0.0.1 virtual-link 1.1.1.1
    #  area 0.0.0.1 virtual-link 1.1.1.1 authentication-key U2FsdGVkX180JKbs3Rf5IyLot8UW0/srcXdGaQXEHiw= encrypted
    #  area 0.0.0.1 virtual-link 1.1.1.3
    #  area 0.0.0.1 virtual-link 1.1.1.3 authentication-key U2FsdGVkX1/lz7KE/onDUAhQU2nftsm/nddLb2ZvYSQ= encrypted
    #  area 0.0.0.1 virtual-link 1.1.1.4
    #  area 0.0.0.1 virtual-link 1.1.1.4 authentication-key U2FsdGVkX1+2i/anKXKpEfwZIAkb1Hzkx1nH2IBnlMA= encrypted
    # !
    # router ospf vrf Vrf2
    # !
    # Note: the device automatically converts keys to encrypted format
# ----------


# using deleted to remove ospf settings
    # deleting all settings for areas
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 authentication message-digest
    #  area 0.0.0.1 stub no-summary
    #  area 0.0.0.1 default-cost 6
    #  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 shortcut disable
    #  area 0.0.0.2 stub no-summary
    #  area 0.0.0.2 shortcut disable
    #  area 0.0.0.3 shortcut default
    #  area 0.0.0.1 virtual-link 1.1.1.1
    #  area 0.0.0.1 virtual-link 1.1.1.1 authentication
    #  area 0.0.0.1 virtual-link 1.1.1.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.1 virtual-link 1.1.1.1 dead-interval 10
    #  area 0.0.0.1 virtual-link 1.1.1.1 hello-interval 10
    #  area 0.0.0.1 virtual-link 1.1.1.1 retransmit-interval 10
    #  area 0.0.0.1 virtual-link 1.1.1.1 transmit-delay 10
    #  area 0.0.0.1 virtual-link 1.1.1.2
    #  area 0.0.0.1 virtual-link 1.1.1.2 dead-interval 34
    #  area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 1 md5 U2FsdGVkX1//fyBCsQYQI4q743L8Rf1Q1qUOEc75lNM= encrypted
    #  area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 2 md5 U2FsdGVkX18tvS+HyOt1zIbx9P8I9NMguQ17NZGd9ZY= encrypted
    #  area 0.0.0.1 range 1.1.1.1/24 not-advertise
    #  area 0.0.0.1 range 1.1.1.2/24 advertise
    #  area 0.0.0.2 range 1.1.1.1/24 advertise
    #  area 0.0.0.3 range 1.1.4.6/24 cost 14
    #  network 1.1.1.1/24 area 0.0.0.1
    #  network 1.1.1.2/24 area 0.0.0.1
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: "test delete all settings for areas"
        sonic_ospf_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.1.1/24
              advertise: True
            shortcut: disable
            stub:
              enabled: True
              no_summary: True

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.3 shortcut default
    #  area 0.0.0.3 range 1.1.4.6/24 cost 14
    # !
    # router ospf vrf Vrf2
    # !
    # -----


    # clearing subsections of config
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 shortcut default
    #  area 0.0.0.2 authentication message-digest
    #  area 0.0.0.3 filter-list prefix pf1 in
    #  area 0.0.0.4
    #  area 0.0.0.3 virtual-link 34.7.35.1
    #  area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30
    #  area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50
    #  area 0.0.0.3 virtual-link 34.7.35.2
    #  area 0.0.0.3 virtual-link 34.7.35.2 dead-interval 10
    #  area 0.0.0.3 virtual-link 34.7.35.2 retransmit-interval 40
    #  area 0.0.0.4 virtual-link 34.7.35.1
    #  area 0.0.0.4 virtual-link 34.7.35.1 authentication
    #  area 0.0.0.4 virtual-link 34.7.35.1 authentication-key U2FsdGVkX1/lz7KE/onDUAhQU2nftsm/nddLb2ZvYSQ= encrypted
    #  area 0.0.0.4 virtual-link 34.7.35.1 dead-interval 10
    #  area 0.0.0.4 virtual-link 34.7.35.2
    #  area 0.0.0.4 virtual-link 34.7.35.2 dead-interval 10
    #  area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted
    #  area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted
    #  area 0.0.0.1 range 1.1.1.2/24 advertise cost 4
    #  area 0.0.0.1 range 1.1.1.3/24 not-advertise
    #  network 1.1.1.1/24 area 0.0.0.2
    #  network 23.235.75.1/23 area 0.0.0.2
    #  network 3.5.1.5/23 area 0.0.0.2
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: "test clear subsections"
        sonic_ospf_area:
          state: deleted
          config:
          - area_id: 0.0.0.1
            vrf_name: Vrf1
            ranges: []
          - area_id: 0.0.0.2
            vrf_name: Vrf1
            networks: []
          - area_id: 0.0.0.3
            vrf_name: Vrf1
            virtual_links: []
          - area_id: 4
            vrf_name: Vrf1
            virtual_links:
            - router_id: 34.7.35.1
              authentication: {}
            - router_id: 34.7.35.2
              message_digest_list: []

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 shortcut default
    #  area 0.0.0.2 authentication message-digest
    #  area 0.0.0.3 filter-list prefix pf1 in
    #  area 0.0.0.4
    #  area 0.0.0.4 virtual-link 34.7.35.1
    #  area 0.0.0.4 virtual-link 34.7.35.1 dead-interval 10
    #  area 0.0.0.4 virtual-link 34.7.35.2
    #  area 0.0.0.4 virtual-link 34.7.35.2 dead-interval 10
    # !
    # router ospf vrf Vrf2
    # !
    # -----

    # deleting individual attributes
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  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 authentication message-digest
    #  area 0.0.0.3
    #  area 0.0.0.4 stub no-summary
    #  area 0.0.0.4 default-cost 3
    #  area 0.0.0.4 shortcut default
    #  area 0.0.0.5 stub
    #  area 0.0.0.5 default-cost 5
    #  area 0.0.0.3 virtual-link 34.7.35.1
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30
    #  area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50
    #  area 0.0.0.3 virtual-link 34.7.35.2
    #  area 0.0.0.3 virtual-link 34.7.35.2 authentication message-digest
    #  area 0.0.0.3 virtual-link 34.7.35.2 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.2 dead-interval 10
    #  area 0.0.0.3 virtual-link 34.7.35.2 retransmit-interval 40
    #  area 0.0.0.3 virtual-link 34.7.35.2 transmit-delay 50
    #  area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted
    #  area 0.0.0.1 range 1.1.1.1/24 advertise cost 13
    #  area 0.0.0.1 range 1.1.1.1/24 substitute 11.2.5.1/24
    #  area 0.0.0.1 range 1.1.1.2/24 advertise cost 4
    #  area 0.0.0.1 range 1.1.1.3/24 advertise
    #  area 0.0.0.1 range 1.1.1.3/24 substitute 2.2.2.2/24
    #  area 0.0.0.1 range 1.1.1.4/24 advertise cost 34
    #  area 0.0.0.1 range 1.1.1.4/24 substitute 3.3.3.3/24
    #  network 1.1.1.1/24 area 0.0.0.2
    #  network 23.235.75.1/23 area 0.0.0.2
    #  network 3.5.1.5/23 area 0.0.0.2
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: "test clear subsections"
        sonic_ospf_area:
          state: deleted
          config:
          - area_id: 0.0.0.1
            vrf_name: Vrf1
            filter_list_in: pf1
            filter_list_out: pf2
            ranges:
            - prefix: 1.1.1.1/24
            - prefix: 1.1.1.2/24
              cost: 4
            - prefix: 1.1.1.3/24
              substitute: 2.2.2.2/24
            - prefix: 1.1.1.4/24
              advertise: True
          - area_id: 0.0.0.2
            vrf_name: Vrf1
            authentication_type: message_digest
            networks:
            - 1.1.1.1/24
            - 3.5.1.5/23
          - area_id: 3
            vrf_name: Vrf1
            virtual_links:
            - router_id: 34.7.35.1
              transmit_delay: 50
              hello_interval: 30
              authentication:
                auth_type: text
            - router_id: 34.7.35.2
              enabled: True
              dead_interval: 10
              retransmit_interval: 40
              message_digest_list:
              - key_id: 1
              authentication:
                key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ="
                key_encrypted: True
          - area_id: 4
            vrf_name: Vrf1
            shortcut: default
            stub:
              enabled: True
              no_summary: True
          - area_id: 5
            vrf_name: Vrf1
            default_cost: 5
            stub:
              enabled: True

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1
    #  area 0.0.0.2
    #  area 0.0.0.3
    #  area 0.0.0.4 default-cost 3
    #  area 0.0.0.5
    #  area 0.0.0.3 virtual-link 34.7.35.1
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.2
    #  area 0.0.0.3 virtual-link 34.7.35.2 authentication message-digest
    #  area 0.0.0.3 virtual-link 34.7.35.2 transmit-delay 50
    #  area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted
    #  area 0.0.0.1 range 1.1.1.2/24 advertise
    #  area 0.0.0.1 range 1.1.1.3/24 advertise
    #  area 0.0.0.1 range 1.1.1.4/24 cost 34
    #  area 0.0.0.1 range 1.1.1.4/24 substitute 3.3.3.3/24
    #  network 23.235.75.1/23 area 0.0.0.2
    # !
    # router ospf vrf Vrf2
    # !
    # -----
# ----------


# using replaced
    # replace listed areas
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  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 authentication message-digest
    #  area 0.0.0.3
    #  area 0.0.0.4 stub no-summary
    #  area 0.0.0.4 default-cost 3
    #  area 0.0.0.4 shortcut default
    #  area 0.0.0.5 stub
    #  area 0.0.0.5 default-cost 5
    #  area 0.0.0.3 virtual-link 34.7.35.1
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30
    #  area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50
    #  area 0.0.0.3 virtual-link 34.7.35.2
    #  area 0.0.0.3 virtual-link 34.7.35.2 authentication message-digest
    #  area 0.0.0.3 virtual-link 34.7.35.2 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.2 dead-interval 10
    #  area 0.0.0.3 virtual-link 34.7.35.2 retransmit-interval 40
    #  area 0.0.0.3 virtual-link 34.7.35.2 transmit-delay 50
    #  area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted
    #  area 0.0.0.1 range 1.1.1.1/24 advertise cost 13
    #  area 0.0.0.1 range 1.1.1.1/24 substitute 11.2.5.1/24
    #  area 0.0.0.1 range 1.1.1.2/24 advertise cost 4
    #  area 0.0.0.1 range 1.1.1.3/24 advertise
    #  area 0.0.0.1 range 1.1.1.3/24 substitute 2.2.2.2/24
    #  area 0.0.0.1 range 1.1.1.4/24 advertise cost 34
    #  area 0.0.0.1 range 1.1.1.4/24 substitute 3.3.3.3/24
    #  network 1.1.1.1/24 area 0.0.0.2
    #  network 23.235.75.1/23 area 0.0.0.2
    #  network 3.5.1.5/23 area 0.0.0.2
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: "replace areas"
        sonic_ospf_area:
          state: replaced
          config:
          - area_id: 0.0.0.1
            vrf_name: Vrf1
            authentication_type: message_digest
            networks:
            - 1.1.1.1/24
            - 3.5.1.5/23
            - 23.235.75.1/23
            default_cost: 5
            stub:
              enabled: True
              no_summary: False
          - area_id: 0.0.0.2
            vrf_name: Vrf1
            filter_list_in: pf1
            filter_list_out: pf2
            shortcut: default
            default_cost: 3
            stub:
              enabled: True
              no_summary: True
            authentication_type: message_digest
            networks:
            - 1.1.1.1/24
            - 3.5.1.5/23
            - 23.235.75.1/23
          - area_id: 3
            vrf_name: Vrf1
            virtual_links:
            - router_id: 34.7.35.1
              enabled: True
              transmit_delay: 50
              hello_interval: 30
              authentication:
                auth_type: text
                key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ="
                key_encrypted: True
            ranges:
            - prefix: 1.1.1.1/24
              advertise: True
              substitute: 11.2.5.1/24
            - prefix: 1.1.1.2/24
              advertise: True
              cost: 4
            - prefix: 1.1.1.3/24
              advertise: True
              substitute: 2.5.3.78/24
          - area_id: 4
            vrf_name: Vrf1
            shortcut: default
            virtual_links:
            - router_id: 34.7.35.1
              enabled: True
              transmit_delay: 50
              hello_interval: 30
              authentication:
                auth_type: text
                key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ="
                key_encrypted: True
            - router_id: 34.7.35.2
              transmit_delay: 50
              enabled: True
              dead_interval: 10
              retransmit_interval: 40
              message_digest_list:
              - key_id: 1
                key: "U2FsdGVkX18mUZjlJL/Q/7vYtx2AUyDc+NcLKc/BOJUA="
                key_encrypted: True
              - key_id: 3
                key: "U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo="
                key_encrypted: True
              authentication:
                auth_type: message_digest
                key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ="
                key_encrypted: True

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 authentication message-digest
    #  area 0.0.0.1 stub
    #  area 0.0.0.1 default-cost 5
    #  area 0.0.0.2 authentication message-digest
    #  area 0.0.0.2 stub no-summary
    #  area 0.0.0.2 default-cost 3
    #  area 0.0.0.2 filter-list prefix pf1 in
    #  area 0.0.0.2 filter-list prefix pf2 out
    #  area 0.0.0.2 shortcut default
    #  area 0.0.0.3
    #  area 0.0.0.4 shortcut default
    #  area 0.0.0.5 stub
    #  area 0.0.0.5 default-cost 5
    #  area 0.0.0.3 virtual-link 34.7.35.1
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30
    #  area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50
    #  area 0.0.0.4 virtual-link 34.7.35.1
    #  area 0.0.0.4 virtual-link 34.7.35.1 authentication
    #  area 0.0.0.4 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.4 virtual-link 34.7.35.1 hello-interval 30
    #  area 0.0.0.4 virtual-link 34.7.35.1 transmit-delay 50
    #  area 0.0.0.4 virtual-link 34.7.35.2
    #  area 0.0.0.4 virtual-link 34.7.35.2 authentication message-digest
    #  area 0.0.0.4 virtual-link 34.7.35.2 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.4 virtual-link 34.7.35.2 dead-interval 10
    #  area 0.0.0.4 virtual-link 34.7.35.2 retransmit-interval 40
    #  area 0.0.0.4 virtual-link 34.7.35.2 transmit-delay 50
    #  area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted
    #  area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted
    #  area 0.0.0.3 range 1.1.1.1/24 advertise
    #  area 0.0.0.3 range 1.1.1.1/24 substitute 11.2.5.1/24
    #  area 0.0.0.3 range 1.1.1.2/24 advertise cost 4
    #  area 0.0.0.3 range 1.1.1.3/24 advertise
    #  area 0.0.0.3 range 1.1.1.3/24 substitute 2.5.3.78/24
    #  network 1.1.1.1/24 area 0.0.0.1
    #  network 23.235.75.1/23 area 0.0.0.1
    #  network 3.5.1.5/23 area 0.0.0.1
    #  network 1.1.1.1/24 area 0.0.0.2
    #  network 23.235.75.1/23 area 0.0.0.2
    #  network 3.5.1.5/23 area 0.0.0.2
    # !
    # router ospf vrf Vrf2
    # !
# ----------


# using overridden
    # override listed areas
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  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 authentication message-digest
    #  area 0.0.0.3
    #  area 0.0.0.4 stub no-summary
    #  area 0.0.0.4 default-cost 3
    #  area 0.0.0.4 shortcut default
    #  area 0.0.0.5 stub
    #  area 0.0.0.5 default-cost 5
    #  area 0.0.0.3 virtual-link 34.7.35.1
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30
    #  area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50
    #  area 0.0.0.3 virtual-link 34.7.35.2
    #  area 0.0.0.3 virtual-link 34.7.35.2 authentication message-digest
    #  area 0.0.0.3 virtual-link 34.7.35.2 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.2 dead-interval 10
    #  area 0.0.0.3 virtual-link 34.7.35.2 retransmit-interval 40
    #  area 0.0.0.3 virtual-link 34.7.35.2 transmit-delay 50
    #  area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted
    #  area 0.0.0.1 range 1.1.1.1/24 advertise cost 13
    #  area 0.0.0.1 range 1.1.1.1/24 substitute 11.2.5.1/24
    #  area 0.0.0.1 range 1.1.1.2/24 advertise cost 4
    #  area 0.0.0.1 range 1.1.1.3/24 advertise
    #  area 0.0.0.1 range 1.1.1.3/24 substitute 2.2.2.2/24
    #  area 0.0.0.1 range 1.1.1.4/24 advertise cost 34
    #  area 0.0.0.1 range 1.1.1.4/24 substitute 3.3.3.3/24
    #  network 1.1.1.1/24 area 0.0.0.2
    #  network 23.235.75.1/23 area 0.0.0.2
    #  network 3.5.1.5/23 area 0.0.0.2
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: "override areas"
        sonic_ospf_area:
          state: overridden
          config:
          - area_id: 0.0.0.1
            vrf_name: Vrf1
            authentication_type: message_digest
            networks:
            - 1.1.1.1/24
            - 3.5.1.5/23
            - 23.235.75.1/23
            default_cost: 5
            stub:
              enabled: True
              no_summary: False
          - area_id: 0.0.0.2
            vrf_name: Vrf1
            filter_list_in: pf1
            filter_list_out: pf2
            shortcut: default
            default_cost: 3
            stub:
              enabled: True
              no_summary: True
            authentication_type: message_digest
            networks:
            - 1.1.1.1/24
            - 3.5.1.5/23
            - 23.235.75.1/23
          - area_id: 3
            vrf_name: Vrf1
            virtual_links:
            - router_id: 34.7.35.1
              enabled: True
              transmit_delay: 50
              hello_interval: 30
              authentication:
                auth_type: text
                key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ="
                key_encrypted: True
            ranges:
            - prefix: 1.1.1.1/24
              advertise: True
              substitute: 11.2.5.1/24
            - prefix: 1.1.1.2/24
              advertise: True
              cost: 4
            - prefix: 1.1.1.3/24
              advertise: True
              substitute: 2.5.3.78/24
          - area_id: 4
            vrf_name: Vrf1
            shortcut: default
            virtual_links:
            - router_id: 34.7.35.1
              enabled: True
              transmit_delay: 50
              hello_interval: 30
              authentication:
                auth_type: text
                key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ="
                key_encrypted: True
            - router_id: 34.7.35.2
              transmit_delay: 50
              enabled: True
              dead_interval: 10
              retransmit_interval: 40
              message_digest_list:
              - key_id: 1
                key: "U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA="
                key_encrypted: True
              - key_id: 3
                key: "U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo="
                key_encrypted: True
              authentication:
                auth_type: message_digest
                key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ="
                key_encrypted: True

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 authentication message-digest
    #  area 0.0.0.1 stub
    #  area 0.0.0.1 default-cost 5
    #  area 0.0.0.2 authentication message-digest
    #  area 0.0.0.2 stub no-summary
    #  area 0.0.0.2 default-cost 3
    #  area 0.0.0.2 filter-list prefix pf1 in
    #  area 0.0.0.2 filter-list prefix pf2 out
    #  area 0.0.0.2 shortcut default
    #  area 0.0.0.3
    #  area 0.0.0.4 shortcut default
    #  area 0.0.0.3 virtual-link 34.7.35.1
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30
    #  area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50
    #  area 0.0.0.4 virtual-link 34.7.35.1
    #  area 0.0.0.4 virtual-link 34.7.35.1 authentication
    #  area 0.0.0.4 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.4 virtual-link 34.7.35.1 hello-interval 30
    #  area 0.0.0.4 virtual-link 34.7.35.1 transmit-delay 50
    #  area 0.0.0.4 virtual-link 34.7.35.2
    #  area 0.0.0.4 virtual-link 34.7.35.2 authentication message-digest
    #  area 0.0.0.4 virtual-link 34.7.35.2 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.4 virtual-link 34.7.35.2 dead-interval 10
    #  area 0.0.0.4 virtual-link 34.7.35.2 retransmit-interval 40
    #  area 0.0.0.4 virtual-link 34.7.35.2 transmit-delay 50
    #  area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted
    #  area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted
    #  area 0.0.0.3 range 1.1.1.1/24 advertise
    #  area 0.0.0.3 range 1.1.1.1/24 substitute 11.2.5.1/24
    #  area 0.0.0.3 range 1.1.1.2/24 advertise cost 4
    #  area 0.0.0.3 range 1.1.1.3/24 advertise
    #  area 0.0.0.3 range 1.1.1.3/24 substitute 2.5.3.78/24
    #  network 1.1.1.1/24 area 0.0.0.1
    #  network 23.235.75.1/23 area 0.0.0.1
    #  network 3.5.1.5/23 area 0.0.0.1
    #  network 1.1.1.1/24 area 0.0.0.2
    #  network 23.235.75.1/23 area 0.0.0.2
    #  network 3.5.1.5/23 area 0.0.0.2
    # !
    # router ospf vrf Vrf2
    # !
# ----------

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

  • Xiao Han (@Xiao_Han2)