Configuring OSPF
This section contains payload examples to demonstrate how to use the NX-API REST API to configure OSPF on the Cisco Nexus 3000 and 9000 Series switches.
Disabling Segment Routing in an Area
Disabling Segment Routing in an Area
POST http://<mgmt0_IP>/api/mo/sys/ospf.json
{
"ospfEntity": {
"children": [
{
"ospfInst": {
"attributes": {
"name": "Test_1"
},
"children": [
{
"ospfDom": {
"attributes": {
"name": "default"
},
"children": [
{
"ospfArea": {
"attributes": {
"id": "0.0.48.57",
"sgmntRtgMpls": "disable"
}}}]}}]}}]}}
{
imdata:[]
}
<System>
<ospf-items>
<inst-items>
<Inst-list>
<name>Test_1</name>
<dom-items>
<Dom-list>
<name>default</name>
<area-items>
<Area-list>
<id>0.0.48.57</id>
<sgmntRtgMpls>disable</sgmntRtgMpls>
</Area-list>
</area-items>
</Dom-list>
</dom-items>
</Inst-list>
</inst-items>
</ospf-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.
router ospf Test_1
area 12345 segment-routing disable
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/media/dme/index.html
Unconfiguring Disabled Segment Routing in an Area
Unconfiguring Disabled Segment Routing in an Area
POST http://<mgmt0_IP>/api/mo/sys/ospf.json
{
"ospfEntity": {
"children": [
{
"ospfInst": {
"attributes": {
"name": "Test_1"
},
"children": [
{
"ospfDom": {
"attributes": {
"name": "default"
},
"children": [
{
"ospfArea": {
"attributes": {
"id": "0.0.48.57",
"sgmntRtgMpls": "unspecified"
}}}]}}]}}]}}
{
imdata:[]
}
<System>
<ospf-items>
<inst-items>
<Inst-list>
<name>Test_1</name>
<dom-items>
<Dom-list>
<name>default</name>
<area-items>
<Area-list>
<id>0.0.48.57</id>
<sgmntRtgMpls>unspecified</sgmntRtgMpls>
</Area-list>
</area-items>
</Dom-list>
</dom-items>
</Inst-list>
</inst-items>
</ospf-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.
router ospf Test_1
no area 12345 segment-routing disable
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/media/dme/index.html
Enabling Segment Routing MPLS in an Area
Enabling Segment Routing MPLS in an Area
POST http://<mgmt0_IP>/api/mo/sys/ospf.json
{
"ospfEntity": {
"children": [
{
"ospfInst": {
"attributes": {
"name": "Test_1"
},
"children": [
{
"ospfDom": {
"attributes": {
"name": "default"
},
"children": [
{
"ospfArea": {
"attributes": {
"id": "0.0.48.57",
"sgmntRtgMpls": "mpls"
}}}]}}]}}]}}
{
imdata:[]
}
<System>
<ospf-items>
<inst-items>
<Inst-list>
<name>Test_1</name>
<dom-items>
<Dom-list>
<name>default</name>
<area-items>
<Area-list>
<id>0.0.48.57</id>
<sgmntRtgMpls>mpls</sgmntRtgMpls>
</Area-list>
</area-items>
</Dom-list>
</dom-items>
</Inst-list>
</inst-items>
</ospf-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.
router ospf Test_1
area 12345 segment-routing mpls
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/media/dme/index.html
Disabling Segment Routing MPLS in an Area
Disabling Segment Routing MPLS in an Area
POST http://<mgmt0_IP>/api/mo/sys/ospf.json
{
"ospfEntity": {
"children": [
{
"ospfInst": {
"attributes": {
"name": "Test_1"
},
"children": [
{
"ospfDom": {
"attributes": {
"name": "default"
},
"children": [
{
"ospfArea": {
"attributes": {
"id": "0.0.48.57",
"sgmntRtgMpls": "unspecified"
}}}]}}]}}]}}
{
imdata:[]
}
<System>
<ospf-items>
<inst-items>
<Inst-list>
<name>Test_1</name>
<dom-items>
<Dom-list>
<name>default</name>
<area-items>
<Area-list>
<id>0.0.48.57</id>
<sgmntRtgMpls>unspecified</sgmntRtgMpls>
</Area-list>
</area-items>
</Dom-list>
</dom-items>
</Inst-list>
</inst-items>
</ospf-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.
router ospf Test_1
no area 12345 segment-routing mpls
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/media/dme/index.html
Enabling Segment Routing MPLS
Enabling Segment Routing MPLS
POST http://<mgmt0_IP>/api/mo/sys/ospf.json
{
"ospfEntity": {
"children": [
{
"ospfInst": {
"attributes": {
"name": "Test_1"
},
"children": [
{
"ospfDom": {
"attributes": {
"ctrl": "segrt",
"name": "default"
}}}]}}]}}
{
imdata:[]
}
<System>
<ospf-items>
<inst-items>
<Inst-list>
<name>Test_1</name>
<dom-items>
<Dom-list>
<name>default</name>
<ctrl>segrt</ctrl>
</Dom-list>
</dom-items>
</Inst-list>
</inst-items>
</ospf-items>
</System>
To configure segment routing under the OSPF process using REST or resconf, submit a GET request for the dom-default MO under the OSPF process instance. Check the value in the ctrl
field of the response payload and apply the configurations given here so that the value of the ctrl
field obtained in the GET is kept in addition to the segrt
value that is getting applied.
For example, if the value for the ctrl
field is empty, then the POST for configuring segment routing under the OSPF process should assign 'ctrl': 'segrt.'
If the value for the ctrl
field is bfd
, then REST post for configuring segment-routing under process OSPF should assign 'ctrl':'segrt, bfd'
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.
router ospf Test_1
segment-routing mpls
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/media/dme/index.html
Disabling Segment Routing MPLS
Disabling Segment Routing MPLS
POST http://<mgmt0_IP>/api/mo/sys/ospf.json
{
"ospfEntity": {
"children": [
{
"ospfInst": {
"attributes": {
"name": "Test_1"
},
"children": [
{
"ospfDom": {
"attributes": {
"ctrl": "",
"name": "default"
}}}]}}]}}
{
imdata:[]
}
<System>
<ospf-items>
<inst-items>
<Inst-list>
<name>Test_1</name>
<dom-items>
<Dom-list>
<name>default</name>
<ctrl></ctrl>
</Dom-list>
</dom-items>
</Inst-list>
</inst-items>
</ospf-items>
</System>
To remove segment routing under the OSPF process using REST or resconf, submit a GET request for the dom-default MO under the OSPF process instance. Check the value in the ctrl
field of the response payload and apply the configurations given here so that the value of the ctrl
field obtained from the GET request is kept and only the segrt
value is removed.
For example, if the value of the ctrl
field in the GET request is segrt
, disable SR under the OSPF process by assigning an empty value in the REST POST (example: "ctrl": ""
). If the value of the ctrl
field in the GET request is segrt, bfd
, disable SR under the OSPF process by removing segrt
(example: "ctrl": "bfd"
).
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.
router ospf Test_1
no segment-routing mpls
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/media/dme/index.html