junipernetworks.junos.junos_ospfv3 – OSPFv3 resource module
Note
This plugin is part of the junipernetworks.junos collection (version 2.8.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 junipernetworks.junos
.
To use it in a playbook, specify: junipernetworks.junos.junos_ospfv3
.
New in version 1.2.0: of junipernetworks.junos
Synopsis
This module manages global OSPFv3 configuration on devices running Juniper JUNOS.
Note
This module has a corresponding action plugin.
Requirements
The below requirements are needed on the host that executes this module.
ncclient (>=v0.6.4)
xmltodict (>=0.12.0)
Parameters
Parameter |
Comments |
---|---|
A list of OSPFv3 process configuration. |
|
A list of OSPFv3 areas’ configuration. |
|
The Area ID as an integer or IP Address. |
|
Configure an address range for the area. |
|
List of interfaces in this area. |
|
Specify authentication type |
|
Type of authentication to use. |
|
Specify list of bandwidth based metrics |
|
BW to apply metric to. Choices:
|
|
Specify metric |
|
Enable flood reduction. Choices:
|
|
Metric applied to the interface. |
|
Name of the interface. |
|
Specify passive Choices:
|
|
Priority for the interface. |
|
Specify timers |
|
Dead interval (seconds). |
|
Hello interval (seconds). |
|
Poll interval (seconds). |
|
Retransmit interval (seconds). |
|
Transit delay (seconds). |
|
Settings for configuring the area as a stub. |
|
Metric for the default route in this area. |
|
Configure the area as a stub. Choices:
|
|
Preference of external routes. |
|
Specify time for overload mode reset |
|
Time after which overload mode is reset (seconds). |
|
Preference of internal routes. |
|
Maximum number of external prefixes that can be exported. |
|
Bandwidth for calculating metric defaults. Choices:
|
|
Set RFC1583 compatibility Choices:
|
|
The OSPFv3 router id. |
|
Configure options for SPF. |
|
Time to wait before running an SPF (seconds). |
|
Time to hold down before running an SPF (seconds). |
|
Number of maximum rapid SPF runs before holddown (seconds). |
|
This option is used only with state parsed. The value of this option should be the output received from the Junos device by executing the command B(show protocols ospf. The state parsed reads the configuration from |
|
The state the configuration should be left in. Choices:
|
Notes
Note
This module requires the netconf system service be enabled on the device being managed.
This module works with connection
netconf
. See the Junos OS Platform Options.Tested against JunOS v18.4R1
Examples
# Using merged
#
# Before state
# ------------
#
# admin# show protocols ospf3
- name: Merge Junos OSPFv3 config
junipernetworks.junos.junos_ospfv3:
config:
- areas:
- area_id: 0.0.0.100
stub:
default_metric: 200
set: true
interfaces:
- name: so-0/0/0.0
priority: 3
metric: 5
state: merged
# After state
# -----------
#
# adimn# show protocols ospf3
# area 0.0.0.100 {
# stub default-metric 200;
# interface so-0/0/0.0 {
# metric 5;
# priority 3;
# }
# }
# Using replaced
#
# Before state
# ------------
#
# adimn# show protocols ospf3
# area 0.0.0.100 {
# stub default-metric 200;
# interface so-0/0/0.0 {
# metric 5;
# priority 3;
# }
# }
- name: Replace Junos OSPFv3 config
junipernetworks.junos.junos_ospfv3:
config:
- areas:
- area_id: 0.0.0.100
interfaces:
- name: so-0/0/0.0
state: replaced
# After state
# -----------
#
# admin# show protocols ospf3
# area 0.0.0.100 {
# interface so-0/0/0.0;
# }
# Using overridden
#
# Before state
# ------------
#
# admin# show protocols ospf3
# area 0.0.0.100 {
# interface so-0/0/0.0;
# }
- name: Override Junos OSPFv3 config
junipernetworks.junos.junos_ospfv3:
config:
- areas:
- area_id: 0.0.0.100
stub:
default_metric: 200
set: true
interfaces:
- name: so-0/0/0.0
priority: 3
metric: 5
flood_reduction: true
passive: true
- area_id: 0.0.0.200
interfaces:
- name: ge-1/1/0.0
- name: ge-2/2/0.0
state: overridden
# After state
# -----------
#
# admin# show protocols ospf3
# area 0.0.0.100 {
# stub default-metric 200;
# interface so-0/0/0.0 {
# passive;
# metric 5;
# priority 3;
# flood-reduction;
# }
# }
# area 0.0.0.200 {
# interface ge-1/1/0.0;
# interface ge-2/2/0.0;
# }
#
# Using deleted
#
# Before state
# ------------
#
# adimn# show protocols ospf3
# area 0.0.0.100 {
# stub default-metric 200;
# interface so-0/0/0.0 {
# metric 5;
# priority 3;
# }
# }
- name: Delete Junos OSPFv3 config
junipernetworks.junos.junos_ospfv3:
config:
- areas:
- area_id: 0.0.0.100
interfaces:
- name: so-0/0/0.0
state: deleted
# After state
# -----------
#
# admin# show protocols ospf3
# Using gathered
#
# Before state
# ------------
#
# adimn# show protocols ospf3
# area 0.0.0.100 {
# stub default-metric 200;
# interface so-0/0/0.0 {
# passive;
# metric 5;
# priority 3;
# flood-reduction;
# }
# }
# area 0.0.0.200 {
# interface ge-1/1/0.0;
# interface ge-2/2/0.0;
# }
- name: Gather Junos OSPFv3 config
junipernetworks.junos.junos_ospfv3:
config:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": {
# "areas": [
# {
# "area_id": "0.0.0.100",
# "interfaces": [
# {
# "flood_reduction": true,
# "metric": 5,
# "name": "so-0/0/0.0",
# "passive": true,
# "priority": 3
# }
# ],
# "stub": {
# "default_metric": 200,
# "set": true
# }
# },
# {
# "area_id": "0.0.0.200",
# "interfaces": [
# {
# "name": "ge-1/1/0.0"
# },
# {
# "name": "ge-2/2/0.0"
# }
# ]
# }
# ],
# }
#
# Using rendered
#
#
- name: Render the commands for provided configuration
junipernetworks.junos.junos_ospfv3:
config:
- areas:
- area_id: 0.0.0.100
stub:
default_metric: 200
set: true
interfaces:
- name: so-0/0/0.0
priority: 3
metric: 5
flood_reduction: true
passive: true
- area_id: 0.0.0.200
interfaces:
- name: ge-1/1/0.0
- name: ge-2/2/0.0
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": "
# <nc:protocols
# xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
# <nc:ospf3>
# <nc:area>
# <nc:name>0.0.0.100</nc:name>
# <nc:interface>
# <nc:name>so-0/0/0.0</nc:name>
# <nc:priority>3</nc:priority>
# <nc:flood-reduction/>
# <nc:metric>5</nc:metric>
# <nc:passive/>
# </nc:interface>
# <nc:stub>
# <nc:default-metric>200</nc:default-metric>
# </nc:stub>
# </nc:area>
# <nc:area>
# <nc:name>0.0.0.200</nc:name>
# <nc:interface>
# <nc:name>ge-1/1/0.0</nc:name>
# </nc:interface>
# <nc:interface>
# <nc:name>ge-2/2/0.0</nc:name>
# </nc:interface>
# </nc:area>
# </nc:ospf3>
# </nc:protocols>"
#
# Using parsed
# parsed.cfg
# ------------
# <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/18.4R1/junos">
# <data>
# <configuration xmlns="http://xml.juniper.net/xnm/1.1/xnm"
# junos:commit-seconds="1601355317" junos:commit-localtime="2020-09-29 04:55:17 UTC" junos:commit-user="rohit">
# <version>18.4R1-S2.4</version>
# <interfaces>
# <interface>
# <name>ge-0/0/0</name>
# <description>Configured by Ansi-Team</description>
# </interface>
# <interface>
# <name>gr-0/0/0</name>
# <description>Configured Manually</description>
# </interface>
# <interface>
# <name>fxp0</name>
# <unit>
# <name>0</name>
# <family>
# <inet>
# <dhcp>
# </dhcp>
# </inet>
# </family>
# </unit>
# </interface>
# </interfaces>
# <protocols>
# <ospf3>
# <area>
# <name>0.0.0.100</name>
# <stub>
# <default-metric>200</default-metric>
# </stub>
# <interface>
# <name>so-0/0/0.0</name>
# <passive>
# </passive>
# <metric>5</metric>
# <priority>3</priority>
# <flood-reduction/>
# </interface>
# </area>
# <area>
# <name>0.0.0.200</name>
# <interface>
# <name>ge-1/1/0.0</name>
# </interface>
# <interface>
# <name>ge-2/2/0.0</name>
# </interface>
# </area>
# </ospf3>
# </protocols>
# <routing-options>
# <router-id>10.200.16.75</router-id>
# </routing-options>
# </configuration>
# <database-status-information>
# <database-status>
# <user>rohit</user>
# <terminal>pts/0</terminal>
# <pid>38210</pid>
# <start-time junos:seconds="1601354977">2020-09-29 04:49:37 UTC</start-time>
# <idle-time junos:seconds="546">00:09:06</idle-time>
# <edit-path>[edit]</edit-path>
# </database-status>
# </database-status-information>
# </data>
# </rpc-reply>
- name: Parsed the device configuration to get output commands
junipernetworks.junos.junos_ospfv3:
running_config: "{{ lookup('file', './parsed.cfg') }}"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": [
# {
# "areas": [
# {
# "area_id": "0.0.0.100",
# "interfaces": [
# {
# "flood_reduction": true,
# "metric": 5,
# "name": "so-0/0/0.0",
# "passive": true,
# "priority": 3
# }
# ],
# "stub": {
# "default_metric": 200,
# "set": true
# }
# },
# {
# "area_id": "0.0.0.200",
# "interfaces": [
# {
# "name": "ge-1/1/0.0"
# },
# {
# "name": "ge-2/2/0.0"
# }
# ]
# }
# ],
# }
# ]
#
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The resulting configuration model invocation. Returned: when changed Sample: “The configuration returned will always be in the same format\n of the parameters above.\n” |
|
The configuration prior to the model invocation. Returned: always Sample: “The configuration returned will always be in the same format\n of the parameters above.\n” |
|
The set of commands pushed to the remote device. Returned: always Sample: [“\u003cnc:protocols xmlns:nc=\”urn:ietf:params:xml:ns:netconf:base:1.0\”\u003e \u003cnc:ospf3 delete=\”delete\”/\u003e \u003cnc:ospf3\u003e \u003cnc:area\u003e \u003cnc:name\u003e0.0.0.100\u003c/nc:name\u003e \u003cnc:interface\u003e \u003cnc:name\u003eso-0/0/0.0\u003c/nc:name\u003e \u003cnc:priority\u003e3\u003c/nc:priority\u003e \u003cnc:flood-reduction/\u003e \u003cnc:metric\u003e5\u003c/nc:metric\u003e \u003cnc:passive/\u003e \u003c/nc:interface\u003e \u003cnc:stub\u003e \u003cnc:default-metric\u003e200\u003c/nc:default-metric\u003e \u003c/nc:stub\u003e \u003c/nc:area\u003e \u003cnc:area\u003e \u003cnc:name\u003e0.0.0.200\u003c/nc:name\u003e \u003cnc:interface\u003e \u003cnc:name\u003ege-1/1/0.0\u003c/nc:name\u003e \u003c/nc:interface\u003e \u003cnc:interface\u003e \u003cnc:name\u003ege-2/2/0.0\u003c/nc:name\u003e \u003c/nc:interface\u003e \u003c/nc:area\u003e \u003c/nc:ospf3\u003e \u003c/nc:protocols\u003e\”, \” \u003cnc:routing-options xmlns:nc=\”urn:ietf:params:xml:ns:netconf:base:1.0\”\u003e \u003cnc:router-id delete=\”delete\”/\u003e \u003cnc:router-id\u003e10.200.16.75\u003c/nc:router-id\u003e \u003c/nc:routing-options\u003e”, “xml 2”, “xml 3”] |
Authors
Rohit Thakur (@rohitthakur2590)