NXOS
The following services are supported by the REST connector for NXOS.
get
API to send GET command to the device.
Argument |
Description |
Default |
---|---|---|
|
Unique distinguished name describes the place in the tree |
Mandatory |
|
Headers to send with the GET command |
None |
|
Maximum time it can take to disconnect to the device. |
30 seconds |
|
Return code that is expected. |
None (Any good result) |
# Assuming the device is already connected
url = '/api/mo/sys/bgp/inst/dom-default/af-ipv4-mvpn.json'
output = device.rest.get(url)
post
API to send POST command to the device.
Argument |
Description |
Default |
---|---|---|
|
Unique distinguished name describes the place in the tree |
Mandatory |
|
Payload to send to the device |
Mandatory |
|
Headers to send with the GET command |
None |
|
Maximum time it can take to disconnect to the device. |
30 seconds |
|
Return code that is expected. |
None (Any good result) |
# Assuming the device is already connected
payload = """
{
"bgpInst": {
"attributes": {
"isolate": "disabled",
"adminSt": "enabled",
"fabricSoo": "unknown:unknown:0:0",
"ctrl": "fastExtFallover",
"medDampIntvl": "0",
"affGrpActv": "0",
"disPolBatch": "disabled",
"flushRoutes": "disabled"
},
"children": [
{
"bgpDom": {
"attributes": {
"name": "default",
"pfxPeerTimeout": "30",
"pfxPeerWaitTime": "90",
"clusterId": "",
"maxAsLimit": "0",
"reConnIntvl": "60",
"rtrId": "0.0.0.0"
},
"children": [
{
"bgpRtCtrl": {
"attributes": {
"logNeighborChanges": "disabled",
"enforceFirstAs": "enabled",
"fibAccelerate": "disabled",
"supprRt": "enabled"
}
}
},
{
"bgpPathCtrl": {
"attributes": {
"alwaysCompMed": "disabled",
"asPathMultipathRelax": "disabled",
"compNbrId": "disabled",
"compRtrId": "disabled",
"costCommunityIgnore": "disabled",
"medConfed": "disabled",
"medMissingAsWorst": "disabled",
"medNonDeter": "disabled"
}
}
}
]
}
}
]
}
}
"""
url = 'api/mo/sys/bgp/inst.json'
device.rest.post(url, payload)
delete
API to send DELETE command to the device.
Argument |
Description |
Default |
---|---|---|
|
Unique distinguished name describes the place in the tree |
Mandatory |
|
Headers to send with the GET command |
None |
|
Maximum time it can take to disconnect to the device. |
30 seconds |
|
Return code that is expected. |
None (Any good result) |
# Assuming the device is already connected
url = '/api/mo/sys/bgp/inst/dom-default/af-ipv4-mvpn.json'
output = device.rest.delete(url)
patch
API to send PATCH command to the device.
Argument |
Description |
Default |
---|---|---|
|
Unique distinguished name describes the place in the tree |
Mandatory |
|
Payload to send to the device |
Mandatory |
|
Headers to send with the GET command |
None |
|
Maximum time it can take to disconnect to the device. |
30 seconds |
|
Return code that is expected. |
None (Any good result) |
# Assuming the device is already connected
payload = """{
"intf-items": {
"phys-items": {
"PhysIf-list": [
{
"adminSt": "down",
"id": "eth1/2",
"userCfgdFlags": "admin_layer,admin_state"
}
]
}
}
}
"""
url = '/api/mo/sys/bgp/inst/dom-default/af-ipv4-mvpn.json'
output = device.rest.patch(url, payload)
put
API to send PUT command to the device.
Argument |
Description |
Default |
---|---|---|
|
Unique distinguished name describes the place in the tree |
Mandatory |
|
Payload to send to the device |
Mandatory |
|
Headers to send with the GET command |
None |
|
Maximum time it can take to disconnect to the device. |
30 seconds |
|
Return code that is expected. |
None (Any good result) |
# Assuming the device is already connected
payload = """{
"intf-items": {
"phys-items": {
"PhysIf-list": [
{
"adminSt": "down",
"id": "eth1/2",
"userCfgdFlags": "admin_layer,admin_state"
}
]
}
}
}
"""
url = '/api/mo/sys/bgp/inst/dom-default/af-ipv4-mvpn.json'
output = device.rest.put(url, payload)
Section author: Jean-Benoit Aubin <jeaubin@cisco.com>