Configuring OSPFv2

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

  1. OSPFv2 operational support is not available through NX-API in releases earlier than Cisco NX-OS 7.0(3)I5(1).
  2. 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.
  3. If an interface is configured with area="0.0.0.0", the REST GET for the interface MO shows area="backbone".
  4. Operational information objects (status and statistics) are maintained only for a single OSPF instance. When multiple OSPF instances exist, operational information is not supported.
  5. When configuring or querying an OSPFv2 interface, do not use the ospfInternalIf managed object. Use ospfIf instead.

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

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

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

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

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

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

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