amnesh.soodar.soodar_ospfv2 module – Resource module to configure OSPFv2.
Note
This module is part of the amnesh.soodar collection (version 2.0.0).
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 https://soodar.ir/ansible/amnesh.soodar.tar.gz.
To use it in a playbook, specify: amnesh.soodar.soodar_ospfv2.
Synopsis
This module configures and manages the Open Shortest Path First (OSPF) version 2 on Soodar platforms.
Note
This module has a corresponding action plugin.
Parameters
Parameter |
Comments |
|---|---|
A dictionary of OSPF options. |
|
List of OSPF instance configurations. |
|
OSPF area parameters |
|
OSPF area ID as a decimal value. Please refer vendor documentation of Valid values. OSPF area ID in IP address format(e.g. A.B.C.D) |
|
Area authentication |
|
Enable area authentication Choices:
|
|
Use IPsec authentication Choices:
|
|
Set the summary default-cost of a NSSA/stub area Stub’s advertised external route metric Note, please refer vendor documentation for respective valid values |
|
Filter networks between OSPF areas |
|
The direction to apply on the filter networks sent to and from this area. Choices:
|
|
Name of an IP prefix-list |
|
Specify a NSSA area |
|
Originate Type 7 default into NSSA area |
|
OSPF default metric |
|
OSPF metric type for default routes OSPF Link State type Choices:
|
|
Do not send summary LSA into NSSA Choices:
|
|
Enable a NSSA area Choices:
|
|
Suppress forwarding address in Type 7 LSAs Choices:
|
|
Translate LSA Always translate LSAs on this ABR Never translate LSAs on this ABR Choices:
|
|
Summarize routes matching prefix (border routers only) |
|
Advertise this range (default) Since, advertise when enabled is not shown in running-config idempotency won’t be maintained for the play in the second or next run of the play. Choices:
|
|
User specified metric for this range |
|
DoNotAdvertise this range Choices:
|
|
IP prefix to match |
|
Specify a stub area Backbone can not be configured as stub area |
|
Do not send summary LSA into stub area Choices:
|
|
Enable a stub area Choices:
|
|
Calculate OSPF interface cost according to bandwidth |
|
Use reference bandwidth method to assign OSPF cost Note, refer vendor documentation for respective valid values |
|
Enable OSPF auto-cost Choices:
|
|
Enable specific OSPF feature |
|
Opaque LSA Choices:
|
|
OSPF router compatibility list |
|
compatible with RFC 1583 Choices:
|
|
Control distribution of default information |
|
Always advertise default route Choices:
|
|
OSPF default metric Note, refer vendor documentation for respective valid values |
|
OSPF metric type for default routes Note, please refer vendor documentation for respective valid range |
|
Route-map reference name |
|
Set metric of redistributed routes |
|
Define an administrative distance |
|
OSPF Administrative distance |
|
Administrative distance |
|
OSPF distance |
|
External type 5 and type 7 routes |
|
Inter-area routes |
|
Intra-area routes |
|
Filter networks in routing updates |
|
IP access list |
|
Filter incoming and outgoing routing updates. Choices:
|
|
IP access list name/number |
|
Protocol config (bgp 1). Valid with outgoing traffic |
|
Log changes in adjacency state |
|
Log all state changes Choices:
|
|
Log changes in adjacency state Choices:
|
|
Set maximum metric |
|
Set maximum metric temporarily after reboot |
|
Time, in seconds, router-LSAs are originated with max-metric Note, please refer vendor documentation for respective valid range |
|
Maximum metric in self-originated router-LSAs Choices:
|
|
Forward packets over multiple paths Number of paths |
|
Configure MPLS routing protocol parameters |
|
routing protocol commands for MPLS LDP |
|
Configure LDP-IGP Synchronization Choices:
|
|
Specify a neighbor router |
|
Neighbor address (A.B.C.D) |
|
OSPF dead-router polling interval of non-broadcast neighbor in Seconds |
|
OSPF priority of non-broadcast neighbor priority |
|
Enable routing on an IP network |
|
Set the OSPF area ID |
|
Network prefix |
|
Suppress routing updates on an interface |
|
Suppress routing updates on all interfaces Choices:
|
|
OSPF topology priority Note, refer vendor documentation for respective valid values |
|
Process ID Default: |
|
Router-id address for this OSPF process OSPF router-id in IP address format (A.B.C.D) |
|
Configure IP address summaries |
|
Do not advertise or translate Choices:
|
|
IP summary prefix |
|
Set tag |
|
Adjust routing timers |
|
OSPF LSA timers, arrival timer The minimum interval in milliseconds between accepting the same LSA |
|
OSPF throttle timers |
|
OSPF LSA throttle timers |
|
Delay between sending LSAs |
|
OSPF SPF throttle timers - Delay between receiving a change to SPF calculation in milliseconds - Note, refer vendor documentation for respective valid values |
|
Delay between first and second SPF calculation in milliseconds Note, refer vendor documentation for respective valid values |
|
Maximum wait time in milliseconds for SPF calculations Note, refer vendor documentation for respective valid values |
|
Delay between receiving a change to SPF calculation in milliseconds Note, refer vendor documentation for respective valid values |
|
Specify parameters for a VPN Routing/Forwarding instance |
|
This option is used only with state parsed. The value of this option should be the output received from the IOS device by executing the command sh running-config | section ^router ospf. The state parsed reads the configuration from |
|
The state the configuration should be left in The states rendered, gathered and parsed does not perform any change on the device. The state rendered will transform the configuration in The state gathered will fetch the running configuration from device and transform it into structured data in the format as per the resource module argspec and the value is returned in the gathered key within the result. The state parsed reads the configuration from Choices:
|
Notes
Note
Tested against Soodar Version 23.11
This module works with connection
amnesh.soodar.network_cli.
Examples
# Using Deleted
#
# Before state
# -------------
# soodar# sh running-config | section '^router ospf'
# router ospf 200 vrf blue
# max-metric router-lsa on-startup 100
# auto-cost reference-bandwidth 4
# area 0 range 192.168.19.0/24 not-advertise
# area 0 range 192.168.19.0/24 cost 10
# distribute-list 10 out
# router ospf 1
# max-metric router-lsa on-startup 110
# area 0 authentication
# area 1 authentication message-digest
# area 1 nssa translate-never
# area 1 default-cost 10
# area 1 filter-list prefix test_prefix_in in
# area 1 filter-list prefix test_prefix_out out
# network 198.51.100.0/24 area 0
# default-information originate
- name: Delete provided OSPF processes
amnesh.soodar.soodar_ospfv2:
config:
processes:
- id: 1
- id: 200
vrf: blue
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
# "commands": [
# "no router ospf 200 vrf blue",
# "no router ospf 1"
# ]
# After state
# ------------
# soodar# sh running-config | section '^router ospf'
# soodar#
# Using Merged
#
# Before state
# -------------
# soodar# sh running-config | section '^router ospf'
# soodar#
- name: Merge provided configuration
amnesh.soodar.soodar_ospfv2:
config:
processes:
- process_id: 1
max_metric:
router_lsa: true
on_startup:
time: 110
areas:
- area_id: "5"
authentication:
enable: true
- area_id: "10"
authentication:
message_digest: true
nssa:
translate: never-translate
default_cost: 10
filter_list:
- name: test_prefix_in
direction: in
- name: test_prefix_out
direction: out
network:
address: 198.51.100.0/24
area: 5
default_information:
originate: true
- process_id: 200
vrf: blue
max_metric:
router_lsa: true
on_startup:
time: 100
auto_cost:
reference_bandwidth: 4
areas:
- area_id: "10"
ranges:
- address: 192.168.19.0/24
not_advertise: true
cost: 10
distribute_list:
acls:
- name: 10
direction: out
state: merged
# ------------------------
# Module Execution Results
# ------------------------
#
# "commands": [
# "router ospf 200 vrf blue",
# "auto-cost reference-bandwidth 4",
# "distribute-list 10 out",
# "max-metric router-lsa on-startup 100",
# "area 10 range 192.168.19.0/24 cost 10",
# "area 10 range 192.168.19.0/24 not-advertise",
# "router ospf 1",
# "default-information originate",
# "max-metric router-lsa on-startup 110",
# "network 198.51.100.0/24 area 5",
# "area 10 authentication message-digest",
# "area 10 default-cost 10",
# "area 10 nssa translate translate-never",
# "area 10 filter-list prefix test_prefix_out out",
# "area 10 filter-list prefix test_prefix_in in",
# "area 5 authentication",
# ]
# After state
# ------------
# soodar# sh running-config | section '^router ospf'
# router ospf 200 vrf blue
# max-metric router-lsa on-startup 100
# auto-cost reference-bandwidth 4
# area 10 range 192.168.19.0/24 cost 10
# area 10 range 192.168.19.0/24 not-advertise
# distribute-list 10 out
# router ospf 1
# max-metric router-lsa on-startup 110
# area 5 authentication
# area 10 authentication message-digest
# area 10 nssa translate translate-never
# area 10 default-cost 10
# area 10 filter-list prefix test_prefix_in in
# area 10 filter-list prefix test_prefix_out out
# network 198.51.100.0/24 area 5
# default-information originate
# Using replaced
# Before state:
# -------------
#
# soodar# sh running-config | section '^router ospf'
# router ospf 200 vrf blue
# max-metric router-lsa on-startup 100
# auto-cost reference-bandwidth 4
# distribute-list 10 out
# router ospf 1
# max-metric router-lsa on-startup 110
# area 10 authentication message-digest
# area 10 nssa translate translate-never
# area 10 default-cost 10
# area 10 filter-list prefix test_prefix_out out
# network 198.51.100.0/24 area 5
# default-information originate
- name: Replaced provided OSPF V2 configuration
amnesh.soodar.soodar_ospfv2:
config:
processes:
- process_id: 200
vrf: blue
max_metric:
router_lsa: true
on_startup:
time: 200
areas:
- area_id: '10'
default_cost: 10
authentication:
message_digest: true
- process_id: 100
vrf: ospf_vrf
auto_cost:
reference_bandwidth: 5
areas:
- area_id: '5'
authentication:
message_digest: true
nssa:
translate: translate-never
state: replaced
# Commands Fired:
# ---------------
# "commands": [
# "router ospf 100 vrf ospf_vrf",
# "auto-cost reference-bandwidth 5",
# "area 5 authentication message-digest",
# "area 5 nssa translate translate-never",
# "router ospf 200 vrf blue",
# "no auto-cost reference-bandwidth 4",
# "no distribute-list 10 out",
# "max-metric router-lsa on-startup 200",
# "area 10 authentication message-digest",
# "area 10 default-cost 10"
# ]
# After state:
# -------------
# soodar# sh running-config | section '^router ospf'
# router ospf 200 vrf blue
# area 10 authentication message-digest
# area 10 default-cost 10
# router ospf 100 vrf ospf_vrf
# auto-cost reference-bandwidth 5
# area 5 authentication message-digest
# area 5 nssa translate translate-never
# router ospf 1
# max-metric router-lsa on-startup 110
# area 5 authentication
# area 10 authentication message-digest
# area 10 nssa translate translate-never
# area 10 default-cost 10
# area 10 filter-list prefix test_prefix_in in
# area 10 filter-list prefix test_prefix_out out
# network 198.51.100.0/24 area 5
# default-information originate
# Before state:
# -------------
#
# soodar# sh running-config | section '^router ospf'
# router ospf 200 vrf blue
# max-metric router-lsa on-startup 100
# auto-cost reference-bandwidth 4
# distribute-list 10 out
# router ospf 1
# max-metric router-lsa on-startup 110
# area 10 authentication message-digest
# area 10 nssa translate translate-never
# area 10 default-cost 10
# area 10 filter-list prefix test_prefix_out out
# network 198.51.100.0/24 area 5
# default-information originate
- name: Override provided OSPF V2 configuration
amnesh.soodar.soodar_ospfv2:
config:
processes:
- process_id: 200
vrf: blue
max_metric:
router_lsa: true
on_startup:
time: 200
areas:
- area_id: '10'
default_cost: 10
authentication:
message_digest: true
- process_id: 100
vrf: ospf_vrf
auto_cost:
reference_bandwidth: 5
areas:
- area_id: '5'
authentication:
message_digest: true
nssa:
translate: translate-never
state: overridden
# Commands Fired:
# ---------------
#
# "commands": [
# "no router ospf 1",
# "router ospf 100 vrf ospf_vrf",
# "auto-cost reference-bandwidth 5",
# "area 5 authentication message-digest",
# "area 5 nssa translate translate-never",
# "router ospf 200 vrf blue",
# "no auto-cost reference-bandwidth 4",
# "no distribute-list 10 out",
# "max-metric router-lsa on-startup 200",
# "area 10 authentication message-digest",
# "area 10 default-cost 10"
# ]
# After state:
# -------------
#
# soodar# sh running-config | section '^router ospf'
# router ospf 200 vrf blue
# max-metric router-lsa on-startup 200
# area 10 authentication message-digest
# area 10 default-cost 10
# router ospf 100 vrf ospf_vrf
# auto-cost reference-bandwidth 5
# area 5 authentication message-digest
# area 5 nssa translate translate-never
# Using Gathered
#
# Before state
# -------------
# soodar# sh running-config | section '^router ospf'
# router ospf 200 vrf blue
# max-metric router-lsa on-startup 100
# auto-cost reference-bandwidth 4
# distribute-list 10 out
# router ospf 1
# max-metric router-lsa on-startup 110
# area 0 authentication
# area 1 authentication message-digest
# area 1 nssa translate-never
# area 1 default-cost 10
# area 1 filter-list prefix test_prefix_out out
# network 198.51.100.0/24 area 0
# default-information originate
- name: Gather OSPF V2 provided configuration
amnesh.soodar.soodar_ospfv2:
config:
state: gathered
# Module Execution Result:
# ------------------------
#
# "gathered": {
# "processes": [
# {
# "areas": [
# {
# "area_id": "5",
# "authentication": {
# "enable": true
# },
# },
# {
# "area_id": "10",
# "authentication": {
# "message_digest": true
# },
# "default_cost": 10,
# "filter_list": [
# {
# "direction": "in",
# "name": "test_prefix_in"
# },
# {
# "direction": "out",
# "name": "test_prefix_out"
# }
# ],
# "nssa": {
# "translate": "translate-never"
# }
# }
# ],
# "default_information": {
# "originate": true
# },
# "max_metric": {
# "on_startup": {
# "time": 110
# },
# "router_lsa": true
# },
# "network": {
# "address": "198.51.100.0/24",
# "area": "5",
# },
# "process_id": 1
# },
# {
# "areas": [
# {
# "area_id": "10",
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 4
# },
# "distribute_list": {
# "acls": [
# {
# "direction": "out",
# "name": "10"
# },
# ]
# },
# "max_metric": {
# "on_startup": {
# "time": 100
# },
# "router_lsa": true
# },
# "process_id": 200,
# "vrf": "blue"
# }
# ]
# }
# After state:
# ------------
#
# soodar# sh running-config | section '^router ospf'
# router ospf 200 vrf blue
# max-metric router-lsa on-startup 100
# auto-cost reference-bandwidth 4
# distribute-list 10 out
# router ospf 1
# max-metric router-lsa on-startup 110
# area 0 authentication
# area 1 authentication message-digest
# area 1 nssa translate-never
# area 1 default-cost 10
# area 1 filter-list prefix test_prefix_out out
# network 198.51.100.0/24 area 0
# default-information originate
# Using Rendered
- name: Render the commands for provided configuration
amnesh.soodar.soodar_ospfv2:
config:
processes:
- process_id: 1
max_metric:
router_lsa: true
on_startup:
time: 110
areas:
- area_id: '5'
authentication:
enable: true
- area_id: '10'
authentication:
message_digest: true
nssa:
translate: translate-never
default_cost: 10
filter_list:
- name: test_prefix_in
direction: in
- name: test_prefix_out
direction: out
network:
address: 198.51.100.0/24
area: 5
default_information:
originate: true
- process_id: 200
vrf: blue
max_metric:
router_lsa: true
on_startup:
time: 100
auto_cost:
reference_bandwidth: 4
areas:
- area_id: '10'
distribute_list:
acls:
- name: 10
direction: out
state: rendered
# Module Execution Result:
# ------------------------
#
# "rendered": [
# "router ospf 200 vrf blue",
# "auto-cost reference-bandwidth 4",
# "distribute-list 10 out",
# "max-metric router-lsa on-startup 100",
# "router ospf 1",
# "default-information originate",
# "max-metric router-lsa on-startup 110",
# "network 198.51.100.0/24 area 5",
# "area 10 authentication message-digest",
# "area 10 default-cost 10",
# "area 10 nssa translate translate-never",
# "area 10 filter-list prefix test_prefix_out out",
# "area 10 filter-list prefix test_prefix_in in",
# "area 5 authentication",
# ]
# Using Parsed
# File: parsed.cfg
# ----------------
#
# router ospf 100
# auto-cost reference-bandwidth 5
# area 5 authentication message-digest
# area 5 nssa translate translate-never
- name: Parse the provided configuration with the existing running configuration
amnesh.soodar.soodar_ospfv2:
running_config: "{{ lookup('file', 'parsed.cfg') }}"
state: parsed
# Module Execution Result:
# ------------------------
#
# "parsed": {
# "processes": [
# {
# "areas": [
# {
# "area_id": "5",
# "authentication": {
# "message_digest": true
# },
# "nssa": {
# "translate": "translate-never"
# }
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 5
# },
# "process_id": 100
# }
# ]
# }
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The resulting configuration after module execution. Returned: when changed Sample: |
|
The configuration prior to the module execution. Returned: when state is Sample: |
|
The set of commands pushed to the remote device. Returned: when state is Sample: |
|
Facts about the network resource gathered from the remote device as structured data. Returned: when state is Sample: |
|
The device native config provided in running_config option parsed into structured data as per module argspec. Returned: when state is Sample: |
|
The provided configuration in the task rendered in device-native format (offline). Returned: when state is Sample: |