Configuring OSPFv2
OSPFv2 is an IETF link-state protocolfor IPv4 networks. An OSPFv2 router sends a special message, called a hello packet, out each OSPF-enabled interface to discover other OSPFv2 neighbor routers. Once a neighbor is discovered, the two routers compare information in the Hello packet to determine if the routers have compatible configurations. The neighbor routers try to establish adjacency, which means that the routers synchronize their link-state databases to ensure that they have identical OSPFv2 routing information. Adjacent routers share link-state advertisements (LSAs) that include information about the operational state of each link, the cost of the link, and any other neighbor information. The routers then flood these received LSAs out every OSPF-enabled interface so that all OSPFv2 routers eventually have identical link-state databases. When all OSPFv2 routers have identical link-state databases, the network is converged. Each router then uses Dijkstra’s Shortest Path First (SPF) algorithm to build its route table.
For more information, see the Cisco Nexus 9000 Series NX-OS Unicast Configuration Guide:
This section contains payload examples to demonstrate how to use the NX-API REST API to configure OSPFv2 on the Cisco Nexus 3000 and 9000 Series switches.
Guidelines and Restrictions
OSPFv2 operational support is not available through NX-API in releases earlier than Cisco NX-OS 7.0(3)I5(1).
When configuring interface settings in a POST operation, you must always specify the desired area. If no area attribute is specified, the operation is applied to area 1.
If an interface is configured with area="0.0.0.0", the REST GET for the interface MO shows area="backbone".
Previous to Cisco NX-OS Release 9.3(5), operational information objects (status and statistics) are maintained only for a single OSPF instance. When multiple OSPF instances exist, operational information is not supported.
When configuring or querying an OSPFv2 interface, do not use the
ospfInternalIf
managed object. UseospfIf
instead.OSPF configuration has two parts:
#1. Under command "router ospf". Command "router ospf " spawns OSPF process on the device.
#2. Under interface
Without configuration #1, the configuration on #2 is incomplete/ineffective.
With this incomplete configuration on device Rest/DME configuration pull will not get configuration of #2. So, later when applied to same or different box, incomplete commands under interface in #2 vanishes.
This does not cause any functionality impact as command were ineffective without OSPF process.For more information, refer to the following DDTS:
https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwa90023
Enabling OSPFv2
Enabling OSPFv2
POST http://<mgmt0_IP>/api/mo/sys.json
{
"topSystem": {
"children": [
{
"fmEntity": {
"children": [
{
"fmOspf": {
"attributes": {
"adminSt": "enabled"
}
}
}
]
}
}
]
}
}
{
imdata:[]
}
<System>
<fm-items>
<adminSt>enabled</adminSt>
</fm-items>
</System>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.
feature ospf
Note: The property information for this example was added in Release 9.3(3).
Verifying a DME Configuration
The following table contains the distinguished name (DN) for each managed object (MO) in the DME payload. Issue a GET request using the DN to verify the configuration was posted or to get information about the configured properties of a particular object.
MO | DN |
---|---|
topSystem | sys |
fmEntity | sys/fm |
fmOspf | sys/fm/ospf |
fmOspf Properties
The following table contains information about the fmOspf properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.
Property Name | Data Type | Description | Values |
---|---|---|---|
adminSt | fm:AdminState (scalar:Enum8) | Admin status | SELECTION: 1 - enabled 2 - disabled DEFAULT: disabled |
Related Documentation
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload:
https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide:
Disabling OSPFv2
Disabling OSPFv2
POST http://<mgmt0_IP>/api/mo/sys.json
{
"topSystem": {
"children": [
{
"fmEntity": {
"children": [
{
"fmOspf": {
"attributes": {
"adminSt": "disabled"
}
}
}
]
}
}
]
}
}
{
imdata:[]
}
<System>
<fm-items>
<adminSt>disabled</adminSt>
</fm-items>
</System>
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.
no feature ospf
Note: The property information for this example was added in Release 9.3(3).
Verifying a DME Configuration
The following table contains the distinguished name (DN) for each managed object (MO) in the DME payload. Issue a GET request using the DN to verify the configuration was posted or to get information about the configured properties of a particular object.
MO | DN |
---|---|
topSystem | sys |
fmEntity | sys/fm |
fmOspf | sys/fm/ospf |
fmOspf Properties
The following table contains information about the fmOspf properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.
Property Name | Data Type | Description | Values |
---|---|---|---|
adminSt | fm:AdminState (scalar:Enum8) | Admin status | SELECTION: 1 - enabled 2 - disabled DEFAULT: disabled |
Related Documentation
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload:
https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide:
Configuring Optional Parameters on an OSPFv2 Instance
Configuring Optional Parameters on an OSPFv2 Instance
POST http://<IP_Address>/api/node/mo/sys/ospf/inst.json
{
"ospfInst": {
"attributes": {
"name": "my_ospf"
},
"children": [
{
"ospfDom": {
"attributes": {
"adjChangeLogLevel": "brief",
"ctrl": "default-passive,name-lookup",
"dist": "25",
"maxEcmp": "4",
"name": "default",
"rtrId": "192.0.20.1"
}}}]}}
{
imdata:[]
}
POST: http://<IP_Address>/restconf/data/Cisco-NX-OS-device:
<System>
<ospf-items>
<inst-items>
<Inst-list>
<name>my_ospf</name>
<dom-items>
<Dom-list>
<name>default</name>
<adjChangeLogLevel>brief</adjChangeLogLevel>
<ctrl>default-passive,name-lookup</ctrl>
<dist>25</dist>
<maxEcmp>4</maxEcmp>
<rtrId>192.0.20.1</rtrId>
</Dom-list>
</dom-items>
</Inst-list>
</inst-items>
</ospf-items>
</System>
You can configure optional parameters for OSPF.
CLI Commands
The CLI commands and options listed below are the equivalent to the payload example displayed in the pane on the right.
router ospf my_ospf
router-id 192.0.20.1
distance 25
log-adjacency-changes
maximum-paths 4
passive-interface default
name-lookup
Related Documentation
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html
Configuring a Virtual Link
Configuring a Virtual Link
POST http://<IP_Address>/api/node/mo/sys/ospf/inst.json
{
"ospfInst": {
"attributes": {
"name": "my_ospf"
},
"children": [
{
"ospfDom": {
"attributes": {
"name": "default"
},
"children": [
{
"ospfArea": {
"attributes": {
"id": "0.0.0.10"
},
"children": [
{
"ospfVLink": {
"attributes": {
"deadIntvl": "50",
"helloIntvl": "25",
"nbrRtrId": "10.1.2.3",
"rexmitIntvl": "60",
"xmitDelay": "2"
},
"children": [
{
"ospfAuthNewP": {
"attributes": {
"keyId": "3",
"md5key": "3 6260a55332988492d5666ab77a685d71",
"md5keySecureMode": "yes",
"type": "md5"
}}}]}}]}}}}}}
{
imdata:[]
}
POST: http://<IP_Address>/restconf/data/Cisco-NX-OS-device:
<System>
<ospf-items>
<inst-items>
<Inst-list>
<name>my_ospf</name>
<dom-items>
<Dom-list>
<name>default</name>
<area-items>
<Area-list>
<id>0.0.0.10</id>
<vlink-items>
<VLink-list>
<nbrRtrId>10.1.2.3</nbrRtrId>
<deadIntvl>50</deadIntvl>
<helloIntvl>25</helloIntvl>
<rexmitIntvl>60</rexmitIntvl>
<xmitDelay>2</xmitDelay>
<authnew-items>
<keyId>3</keyId>
<md5key>3 6260a55332988492d5666ab77a685d71</md5key>
<md5keySecureMode>true</md5keySecureMode>
<type>md5</type>
</authnew-items>
</VLink-list>
</vlink-items>
</Area-list>
</area-items>
</Dom-list>
</dom-items>
</Inst-list>
</inst-items>
</ospf-items>
</System>
A virtual link connects an isolated area to the backbone area through an intermediate area.
CLI Commands
The CLI commands and options listed below are the equivalent to the payload example displayed in the pane on the right.
router ospf my_ospf
area 0.0.0.10 virtual-link 10.1.2.3
dead-interval 50
hello-interval 25
retransmit-interval 60
transmit-delay 2
authentication message-digest
message-digest-key 3 md5 asdflkj1234
Note: The property information for this example was added in Release 9.3(3).
Verifying a DME Configuration
The following table contains the distinguished name (DN) for each managed object (MO) in the DME payload. Issue a GET request using the DN to verify the configuration was posted or to get information about the configured properties of a particular object.
MO | DN |
---|---|
ospfInst | sys/ospf/inst-{name} |
ospfDom | sys/ospf/inst-{name}/dom-{name} |
ospfArea | sys/ospf/inst-{name}/dom-{name}/area-{id} |
ospfVLink | sys/ospf/inst-{name}/dom-{name}/area-{id}/vlink-{nbrRtrId} |
ospfAuthNewP | sys/ospf/inst-{name}/dom-{name}/area-{id}/slink-s-{[srcAddr]}-d-{[dstAddr]}/authnew |
ospfInst Properties
The following table contains information about the ospfInst properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.
Property Name | Data Type | Description | Values |
---|---|---|---|
name | naming:Name256 (string:Basic) | The name of the object. | MAX SIZE: 128 |
ospfDom Properties
The following table contains information about the ospfDom properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.
Property Name | Data Type | Description | Values |
---|---|---|---|
name | naming:Name256 (string:Basic) | The name of the object. | MAX SIZE: 63 |
ospfArea Properties
The following table contains information about the ospfArea properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.
Property Name | Data Type | Description | Values |
---|---|---|---|
id | ospf:AreaId (address:IPv4) | Area identifier to which a network or interface belongs | RANGE: [0 , 4294967295] DEFAULT: 1 |
ospfVLink Properties
The following table contains information about the ospfVLink properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.
Property Name | Data Type | Description | Values |
---|---|---|---|
deadIntvl | ospf:DeadIntvl (scalar:Uint32) | Dead interval, interval after which router declares that neighbor as down | RANGE: [0 , 65535] DEFAULT: unspecified |
helloIntvl | ospf:HelloIntvl (scalar:Uint16) | Hello interval, interval between hello packets that OSPF sends on the interface | RANGE: [1 , 65535] DEFAULT: 10 |
nbrRtrId | ip:RtrId (address:IPv4) | Router id associated with virtual link neighbor | Value must match ipv4 format |
rexmitIntvl | ospf:RexmitIntvl (scalar:Uint16) | Retransmit interval, time between LSA retransmissions | RANGE: [1 , 65535] DEFAULT: 5 |
xmitDelay | ospf:XmitDelay (scalar:Uint16) | Transmit delay, estimated time needed to send an LSA update packet | RANGE: [1 , 450] DEFAULT: 1 |
ospfAuthNewP Properties
The following table contains information about the ospfAuthNewP properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.
Property Name | Data Type | Description | Values |
---|---|---|---|
keyId | ospf:AuthKeyId (scalar:UByte) | Key id used for authentication | RANGE: [0 , 255] DEFAULT: unspecified |
md5key | ospf:AuthKey (string:Password) | Authentication md5 key | |
md5keySecureMode | scalar:Bool | Encrypted authentication md5 key or plain text key | SELECTION: true or false DEFAULT: false |
type | ospf:AuthT (scalar:Enum8) | Authentication types can be simple, md5 or none. | SELECTION: 0 - none 1 - simple 2 - md5 3 - unspecified DEFAULT: unspecified |
Related Documentation
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload:
https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide:
Configuring OSPF SnmpTrap
Configuring OSPF SnmpTrap
POST http://<mgmt_IP>/api/mo/sys.json
{
"topSystem": {
"children": [
{
"ospfSnmpTrapsEntity": {
"children": [
{
"ospfTospf": {
"attributes": {
"ospfInstName": "1234",
"trapAll": "yes"
}
}
}
]
}
}
]
}
}
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<System xmlns=http://cisco.com/ns/yang/cisco-nx-os-device>
<ospftrap-items>
<inst-items>
<Tospf-list>
<ospfInstName>1234</ospfInstName>
</Tospf-list>
</inst-items>
</ospftrap-items>
</System>
</config>
</edit-config>
</rpc>
Note: This example was added in Release 10.2(1).
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.
[no] snmp-server enable traps ospf [<tag>]
Verifying a DME Configuration
The following table contains the distinguished name (DN) for each managed object (MO) in the DME payload. Issue a GET request using the DN to verify the configuration was posted or to get information about the configured properties of a particular object.
MO | DN |
---|---|
AsnmpOspfTraps | sys/ospftrap-%s |
AsnmpOspfTraps Properties
The following table contains information about the DomEspNewPBI properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.
Property Name | Data Type | Description | Values |
---|---|---|---|
trapAll | Scalar: Bool | SNMP OSPF trap for ospf process | SELECTION: true or false DEFAULT: false |
Note: For commands with no
Related Documentation
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload:
https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide:
Configuring OSPF SnmpTrap for all LSA
Configuring OSPF SnmpTrap for all LSA
POST http://<mgmt_IP>/api/mo/sys.json
{
"topSystem": {
"children": [
{
"ospfSnmpTrapsEntity": {
"children": [
{
"ospfTospf": {
"attributes": {
"ospfInstName": "abcd",
"trapLsa": "yes"
}
}
}
]
}
}
]
}
}
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<System xmlns=http://cisco.com/ns/yang/cisco-nx-os-device>
<ospftrap-items>
<inst-items>
<Tospf-list>
<ospfInstName>abcd</ospfInstName>
<trapLsa>true</trapLsa>
</Tospf-list>
</inst-items>
</ospftrap-items>
</System>
</config>
</edit-config>
</rpc>
Note: This example was added in Release 10.2(1).
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.
[no] snmp-server enable traps ospf [<tag>] lsa
Verifying a DME Configuration
The following table contains the distinguished name (DN) for each managed object (MO) in the DME payload. Issue a GET request using the DN to verify the configuration was posted or to get information about the configured properties of a particular object.
MO | DN |
---|---|
AsnmpOspfTraps | sys/ospftrap-%s |
AsnmpOspfTraps Properties
The following table contains information about the DomEspNewPBI properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.
Property Name | Data Type | Description | Values |
---|---|---|---|
trapLsa | Scalar: Bool | SNMP OSPF trap for all ospf lsa | SELECTION: true or false DEFAULT: false |
Related Documentation
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload:
https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide:
Configuring OSPF SnmpTrap window & rate
Configuring OSPF SnmpTrap window & rate
POST http://<mgmt_IP>/api/mo/sys.json
{
"topSystem": {
"children": [
{
"ospfSnmpTrapsEntity": {
"children": [
{
"ospfTospf": {
"attributes": {
"ospfInstName": "wxyz",
"trapRate": "255",
"trapWindow": "2"
}
}
}
]
}
}
]
}
}
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<edit-config>
<target>
<running/>
</target>
<config>
<System xmlns=http://cisco.com/ns/yang/cisco-nx-os-device>
<ospftrap-items>
<inst-items>
<Tospf-list>
<ospfInstName>wxyz</ospfInstName>
<trapWindow>255</trapWindow>
<trapRate>2</trapRate>
</Tospf-list>
</inst-items>
</ospftrap-items>
</System>
</config>
</edit-config>
</rpc>
Note: This example was added in Release 10.2(1).
CLI Commands
The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.
[no] snmp-server enable traps ospf [<tag>] rate-limit [<window> <rate>
Verifying a DME Configuration
The following table contains the distinguished name (DN) for each managed object (MO) in the DME payload. Issue a GET request using the DN to verify the configuration was posted or to get information about the configured properties of a particular object.
MO | DN |
---|---|
AsnmpOspfTraps | sys/ospftrap-%s |
AsnmpOspfTraps Properties
The following table contains information about the DomEspNewPBI properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.
Property Name | Data Type | Description | Values |
---|---|---|---|
windowtype | Scalar: UByte | SNMP OSPF trap window | RANGE: [1:60] DEFAULT: 10(unspecified) |
windowtype | Scalar: Unit16 | SNMP OSPF trap Rate | RANGE: [0:256] DEFAULT: 7(unspecified) |
Note: In Netconf, the default values will be displayed as 0 for windowtype and 256 for rate.
Related Documentation
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload:
https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide: