Configuring a BGP Router
This section contains payload and CLI examples to demonstrate many of the BGP configuration options and to show how the REST APIs correspond to the CLI commands.
Creating a BGP Instance
Creating a BGP Instance
POST http://<mgmt0_IP>/api/mo/sys/bgp.json
{
"bgpEntity": {
"children": [
{
"bgpInst": {
"attributes": {
"asn": "100"
}}}]}}
{
imdata:[]
}
<System>
<bgp-items>
<inst-items>
<asn>100</asn>
</inst-items>
</bgp-items>
</System>
This example enables BGP and assigns the AS number to the local BGP speaker. The AS number can be a 16-bit integer or a 32-bit integer in the form of a higher 16-bit decimal number and a lower 16-bit decimal number in xx.xx format.
Issue an HTTP GET request to verify that the configuration was successful. See Verifying a BGP Instance.
CLI Command
The CLI command below is the equivalent of the payload example 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 or the YANG tab to view the XML payload.
router bgp 100
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
Verifying a BGP Instance
Verifying a BGP Instance
GET http://<IP_address>/api/mo/sys/bgp/inst.json
{
"totalCount": "1",
"imdata": [
{
"bgpInst": {
"attributes": {
"activateTs": "2017-12-23T13:54:24.388+00:00",
"adminSt": "enabled",
"affGrpActv": "0",
"asPathDbSz": "0",
"asn": "100",
"attribDbSz": "116",
"childAction": "",
"createTs": "2017-12-23T13:53:49.823+00:00",
"ctrl": "fastExtFallover",
"disPolBatch": "enabled",
"disPolBatchv4PfxLst": "",
"disPolBatchv6PfxLst": "",
"dn": "sys/bgp/inst",
"epeActivePeers": "0",
"epeConfiguredPeers": "0",
"fabricSoo": "unknown:unknown:0:0",
"flushRoutes": "disabled",
"isolate": "disabled",
"lnkStClnt": "inactive",
"lnkStSrvr": "inactive",
"medDampIntvl": "0",
"memAlert": "normal",
"modTs": "2017-12-23T13:55:11.144+00:00",
"monPolDn": "uni/fabric/monfab-default",
"name": "bgp-Inst",
"numAsPath": "0",
"numRtAttrib": "1",
"operErr": "",
"persistentOnReload": "true",
"snmpTrapSt": "disable",
"srgbMaxLbl": "none",
"srgbMinLbl": "none",
"status": "",
"syslogLvl": "err",
"uid": "0",
"ver": "v4",
"waitDoneTs": "2017-12-23T13:59:29.028+00:00"
}
}
}
]
}
GET: http://<IP_Address>/restconf/data/Cisco-NX-OS-device:System/bgp-items/inst-items/asn
<asn>100</asn>
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 the Router Id
Configuring the Router Id
POST http://<mgmt0_IP>/api/mo/sys/bgp/inst.json
{
"bgpInst": {
"attributes": {
"asn": "100"
},
"children": [
{
"bgpDom": {
"attributes": {
"name": "default",
"rtrId": "1.1.1.1"
}}}]}}
{
imdata:[]
}
<System>
<bgp-items>
<inst-items>
<asn>100</asn>
<dom-items>
<Dom-list>
<name>default</name>
<rtrId>1.1.1.1</rtrId>
</Dom-list>
</dom-items>
</inst-items>
</bgp-items>
</System>
This example configures the BGP router ID. This IP address identifies this BGP speaker.
Note: This example was added in Release 7.0(3)I6(1).
CLI Commands
The CLI commands and options 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 or the YANG tab to view the XML payload.
router bgp 100
router-id 1.1.1.1
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 the Cluster Id
Configuring the Cluster Id
POST http://<mgmt0_IP>/api/mo/sys/bgp/inst.json
{
"bgpInst": {
"attributes": {
"asn": "100"
},
"children": [
{
"bgpDom": {
"attributes": {
"clusterId": "110",
"name": "default"
}}}]}}
{
imdata:[]
}
<System>
<bgp-items>
<inst-items>
<asn>100</asn>
<dom-items>
<Dom-list>
<name>default</name>
<clusterId>110</clusterId>
</Dom-list>
</dom-items>
</inst-items>
</bgp-items>
</System>
This example configures the local router as one of the route reflectors that serve the cluster. You specify a cluster ID to identify the cluster. This command triggers an automatic soft clear or refresh of BGP neighbor sessions.
Note: This example was added in Release 7.0(3)I6(1).
CLI Commands
The CLI commands and options 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 or the YANG tab to view the XML payload.
router bgp 100
cluster-id 110
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 the Graceful Restart Helper
Configuring the Graceful Restart Helper
POST http://<mgmt0_IP>/api/mo/sys/bgp/inst.json
{
"bgpInst": {
"attributes": {
"asn": "100"
},
"children": [
{
"bgpDom": {
"attributes": {
"name": "default"
},
"children": [
{
"bgpGr": {
"attributes": {
"ctrl": "complete,helper"
}}}]}}]}}
{
imdata:[]
}
<System>
<bgp-items>
<inst-items>
<asn>100</asn>
<dom-items>
<Dom-list>
<name>default</name>
<gr-items>
<ctrl>complete,helper</ctrl>
</gr-items>
</Dom-list>
</dom-items>
</inst-items>
</bgp-items>
</System>
This example enables the graceful restart helper functionality. Use this command if you have disabled graceful restart but you still want to enable graceful restart helper functionality. This command triggers an automatic notification and session reset for the BGP neighbor sessions.
Note: This example was added in Release 7.0(3)I6(1).
CLI Commands
The CLI commands and options 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 or the YANG tab to view the XML payload.
router bgp 100
graceful-restart-helper
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 the Graceful Restart Time
Configuring the Graceful Restart Time
POST http://<mgmt0_IP>/api/mo/sys/bgp/inst.json
{
"bgpInst": {
"attributes": {
"asn": "100"
},
"children": [
{
"bgpDom": {
"attributes": {
"name": "default"
},
"children": [
{
"bgpGr": {
"attributes": {
"restartIntvl": "200"
}}}]}}]}}
{
imdata:[]
}
<System>
<bgp-items>
<inst-items>
<asn>100</asn>
<dom-items>
<Dom-list>
<name>default</name>
<gr-items>
<restartIntvl>200</restartIntvl>
</gr-items>
</Dom-list>
</dom-items>
</inst-items>
</bgp-items>
</System>
This example configures the maximum time for a restart sent to the BGP peer.
Note: This example was added in Release 7.0(3)I6(1).
CLI Commands
The CLI commands and options 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 or the YANG tab to view the XML payload.
router bgp 100
graceful-restart restart-time 200
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 the Graceful Restart Stale-Path Time
Configuring the Graceful Restart Stale-path Time
POST http://<mgmt0_IP>/api/mo/sys/bgp/inst.json
{
"bgpInst": {
"attributes": {
"asn": "100"
},
"children": [
{
"bgpDom": {
"attributes": {
"name": "default"
},
"children": [
{
"bgpGr": {
"attributes": {
"staleIntvl": "400"
}}}]}}]}}
{
imdata:[]
}
<System>
<bgp-items>
<inst-items>
<asn>100</asn>
<dom-items>
<Dom-list>
<name>default</name>
<gr-items>
<staleIntvl>400</staleIntvl>
</gr-items>
</Dom-list>
</dom-items>
</inst-items>
</bgp-items>
</System>
This example configures the maximum time that BGP keeps the stale routes from the restarting BGP peer.
Note: This example was added in Release 7.0(3)I6(1).
CLI Commands
The CLI commands and options 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 or the YANG tab to view the XML payload.
router bgp 100
graceful-restart stalepath-time 400
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 the Confederation Identifier
Configuring the Confederation Identifier
POST http://<mgmt0_IP>/api/mo/sys/bgp/inst.json
{
"bgpInst": {
"attributes": {
"asn": "100"
},
"children": [
{
"bgpDom": {
"attributes": {
"name": "default"
},
"children": [
{
"bgpConfederation": {
"attributes": {
"asn": "102"
}}}]}}]}}
{
imdata:[]
}
<System>
<bgp-items>
<inst-items>
<asn>100</asn>
<dom-items>
<Dom-list>
<name>default</name>
<confed-items>
<asn>102</asn>
</confed-items>
</Dom-list>
</dom-items>
</inst-items>
</bgp-items>
</System>
This example configures a confederation identifier for an AS confederation. This command triggers an automatic notification and session reset for the BGP neighbor sessions.
Note: This example was added in Release 7.0(3)I6(1).
CLI Commands
The CLI commands and options 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 or the YANG tab to view the XML payload.
router bgp 100
confederation identifier 102
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
Relaxing AS-Path Restrictions when Choosing Multipath
Relaxing AS-Path Restrictions when Choosing Multipath
POST http://<mgmt0_IP>/api/mo/sys/bgp/inst.json
{
"bgpInst": {
"attributes": {
"asn": "100"
},
"children": [
{
"bgpDom": {
"attributes": {
"name": "default"
},
"children": [
{
"bgpPathCtrl": {
"attributes": {
"asPathMultipathRelax": "enabled"
}}}]}}]}}
{
imdata:[]
}
<System>
<bgp-items>
<inst-items>
<asn>100</asn>
<dom-items>
<Dom-list>
<name>default</name>
<pathctrl-items>
<asPathMultipathRelax>enabled</asPathMultipathRelax>
</pathctrl-items>
</Dom-list>
</dom-items>
</inst-items>
</bgp-items>
</System>
Allows load sharing across the providers with different (but equal-length) AS paths. Without the as-path multipath-relax option, the AS paths must be identical for load sharing.
Note: This example was added in Release 7.0(3)I6(1).
CLI Commands
The CLI commands and options 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 or the YANG tab to view the XML payload.
router bgp 100
bestpath as-path multipath-relax
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
Comparing the Router Id for Identical EBGP Paths
Comparing the Router Id for Identical EBGP Paths
POST http://<mgmt0_IP>/api/mo/sys/bgp/inst.json
{
"bgpInst": {
"attributes": {
"asn": "100"
},
"children": [
{
"bgpDom": {
"attributes": {
"name": "default"
},
"children": [
{
"bgpPathCtrl": {
"attributes": {
"compRtrId": "enabled"
}}}]}}]}}
{
imdata:[]
}
<System>
<bgp-items>
<inst-items>
<asn>100</asn>
<dom-items>
<Dom-list>
<name>default</name>
<pathctrl-items>
<compRtrId>enabled</compRtrId>
</pathctrl-items>
</Dom-list>
</dom-items>
</inst-items>
</bgp-items>
</System>
Compares the router IDs for identical eBGP paths.
Note: This example was added in Release 7.0(3)I6(1).
CLI Commands
The CLI commands and options 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 or the YANG tab to view the XML payload.
router bgp 100
bestpath compare-routerid
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
Compare MED on Paths from a Different AS
Compare MED on Paths from a Different AS
POST http://<mgmt0_IP>/api/mo/sys/bgp/inst.json
{
"bgpInst": {
"attributes": {
"asn": "100"
},
"children": [
{
"bgpDom": {
"attributes": {
"name": "default"
},
"children": [
{
"bgpPathCtrl": {
"attributes": {
"alwaysCompMed": "enabled"
}}}]}}]}}
{
imdata:[]
}
<System>
<bgp-items>
<inst-items>
<asn>100</asn>
<dom-items>
<Dom-list>
<name>default</name>
<pathctrl-items>
<alwaysCompMed>enabled</alwaysCompMed>
</pathctrl-items>
</Dom-list>
</dom-items>
</inst-items>
</bgp-items>
</System>
Compares MED on paths from different autonomous systems.
Note: This example was added in Release 7.0(3)I6(1).
CLI Commands
The CLI commands and options 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 or the YANG tab to view the XML payload.
router bgp 100
bestpath always-compare-med
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
Deleting a BGP
Deleting a BGP
POST http://<mgmt0_IP>/api/mo/sys/bgp.json
{
"bgpEntity": {
"children": [
{
"bgpInst": {
"attributes": {
"status": "deleted"
}}}]}}
{
imdata:[]
}
<System>
<bgp-items>
<inst-items xc:operation="delete">
</inst-items>
</bgp-items>
</System>
This Example demonstrates how to delete a BGP instance.
CLI Commands
The CLI command below is the equivalent of the payload example 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 or the YANG tab to view the XML payload.
no router bgp 100
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