Getting Started with the Cisco Nexus 3000 and 9000 Series NX-API REST SDK
Using NX-API REST with the Cisco Nexus 3000 and 9000 Series switches requires the following main steps:
- Enabling NX-API REST on the switch, which allows communication with the switch using HTTP calls.
- Installing and Using a REST Client. You can use a variety of REST clients to run NX-API REST. For example, Postman is provided as a free download for Google Chrome, and allows you to build and issue HTTP requests that execute the NX-API REST APIs to configure the switch. For details on using REST clients, see the "Running the APIs" section below.
- Verifying the Configuration. After you execute one or more HTTP requests to execute NX-API REST calls, you should verify that the configuration is active by issuing GET commands from your REST client or appropriate CLI commands at the switch console.
- Optionally, you can use the NX-API REST API from the Guest Shell.
NX-API REST is available for use with the Cisco Nexus 3132Q-XL, 3172PQ-XL, and 3172TQ-XL switches [starting with Cisco NX-OS Release 7.0(3)I2(2)], the Cisco Nexus 3164Q and 31128PQ switches, and the Cisco Nexus 9000 Series switches. NX-API REST is not supported for other Cisco Nexus 3000 and 3100 Series switches.
NX-API REST Management Commands
NX-API REST Management Commands
This section lists CLI commands that enable and configure NX-API REST on the switch.
Enabling NX-API REST on the Switch
To enable NX-API, enter the following CLI command on the switch:
feature nxapi
NX-API REST and the DME database are now enabled.
By default, the NX-API REST feature is enabled for HTTP listen on port 80 and HTTPS listen on port 443. If you need to change the HTTP or HTTPS port, you can use the nxapi port command.
Enabling and Disabling HTTP Ports for NX-API REST
By default, when you enable the NX-API REST feature, NX-API REST is configured for HTTP listen on port 80 and HTTPS listen on port 443.
To change the listen ports, use the following command:
nxapi {http | https} port port_number
where port_number specifies the port number to use for HTTP listen or HTTPS listen.
To disable a specified port enter the following command:
no nxapi {http | https}
Specifying http disables the active HTTP port and specifying https disables the active HTTPS port.
Uploading and Enabling Certificates
If you want to use a security certificate to authenticate users of NX-API REST, you must upload a certificate and then enable it.
To upload a certificate, enter the following command:
nxapi certificate {httpscrt | httpskey}
where:
- httpscrt specifies uploading an HTTPS certificate.
- httpskey specifies uploading an HTTPS key.
To enable the certificate or key, enter the following command;
nxapi certificate enable
Querying the NX-API REST Configuration
To display the current NX-API REST configuration, enter the following command:
show nxapi
The console indicates whether NX-API REST is enabled and indicates the listen ports:
nxapi enabled HTTP Listen on port 80 HTTPS Listen on port 443
VRF Commands
nxapi use-vrf
Specifies the default VRF, management VRF, or named VRF.
Iptables is a command-line firewall utility that uses policy chains to allow or block traffic and almost always comes pre-installed on any Linux distribution.
ip netns exec management iptables
Implements any access restrictions and can be run in management VRF.
Running the APIs
You can use a number of commercially available and freeware REST clients to issue HTTP requests using NX-API REST. Some commonly used REST clients are:
Postman: Postman is a developer utility that allows you to construct and issue HTTP requests. There are many versions; for example, Google provides Google Postman Extension for Chrome, which is downloadable from the Google Chrome Store. You can download the Google Postman Extension for Chrome from the Chrome Store at the following URL:
https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en]
Cocoa REST Client: A freeware REST client that runs on the MAC OS. You can download the Cocoa REST Client from the following URL:
](http://mmattozzi.github.io/cocoa-rest-client/)
RESTtest: A MAC-OS app that lets you test REST clients. This app is available on the Apple Mac App Store. You can download RESTtest from the following URL:
There are many other Postman products or REST clients that you can use to issue NX-API REST HTTP requests.
Entering URLs
URLs represent endpoints for the HTTP communication that transfers the HTTP request. The target endpoint for an NX-API REST call is the IP address or hostname of a Nexus 3000 or 9000 switch.
Header
You can use the sample URLs provided in this document by pasting the URL into the Postman URL input field or clicking a saved URL in the list of saved requests or collections at the left of the Postman display. Or if you know the object IDs stored in the DME database, you can use the Postman key-value editor to construct the URL.
HTTP Methods
With Postman, you can select the HTTP method from the Postman method pull-down. With other REST clients, you use the client user interface to specify the method type.
With NX-API REST, you will send a GET, a POST, or a DELETE.
HTTP GET
The GET method retrieves data from a specified MO on the switch.
POST
The POST method writes data to the MO database on the switch.
HTTP DELETE
The DELETE method deletes a specified configuration. For example, you can delete a switch user.
Message Body
The Message body (payload) contains JSON code that specifies the data for the HTTP method.
Message Response
The message response is an HTTP return code and an HTTP Response Body that contains JSON code showing the data returned by the method.
Filtering API Query Results
Filtering API Query Results
OPTIONS http://<mgmt_0>/api/mo/sys/bgp.json
{
"imdata": [
{
"Options": {
"query-target-depth=<depth>": {
"<depth>": "depth of query target, only supported for subscription"
},
"recursive-query=<value>": {
"yes": "perform recursive query, only supported for subscription"
},
"query-target=<value>": {
"self": "query only self",
"children": "query down to children",
"subtree": "query the entire subtree"
},
"query-target-filter=<value>": {
"<value>": "query target filter string"
},
"target-tree=<value>": {
"running": "target is running config tree",
"candidate": "target is candidate tree",
"applied": "target is applied config tree",
"session": "target is session tree"
},
"target-subtree-class=<value>": {
"<value>": "target subtree class URL string"
},
"enable-polling=<value>": {
"yes": "enable polling feature"
},
"commit-timout=<value>": {
"<value>": "commit timeout value"
},
"include-hidden=<value>": {
"yes": "include hidden props"
},
"target-class=<value>": {
"<value>": "class URL string, for url option 'query-path' or url contains 'trace' or both 'tag' and 'class' are stated in URL"
},
"full-path=<value>": {
"yes": "enable full path, for url option query-path or url contains trace or both 'tag' and 'class' are stated in URL"
},
"batch-id=<value>": {
"<value>": "batch id value"
},
"batch-size=<value>": {
"<value>": "batch size value"
},
"batch-context=<value>": {
"<value>": "batch context value"
},
"subscription-timeout=<value>": {
"<value>": "subscription timeout value"
},
"rsp-subtree-depth=<depth>": {
"<depth>": "depth of subtree in response"
},
"rsp-ancestor-depth=<depth>": {
"<depth>": "depth of ancestor in response"
},
"rsp-subtree=<value>": {
"if type is update or delete": {
"no": "show no tree in response",
"modified": "show only modified tree in response",
"full": "show full tree in response"
},
"other type": {
"no": "show no tree in response",
"children": "show only children in response",
"full": "show full tree in response"
}
},
"rsp-matching-only=<value>": {
"yes": "turn on matching only in response"
},
"rsp-subtree-class=<value>": {
"<value>": "subtree class URL string"
},
"rsp-subtree-include=<value>": {
"values are separated by ',', possible values listed below": {
"tasks": "collect response include tasks",
"faults": "collect response include faults",
"health": "collect response include health",
"stats": "collect response include stats",
"relations": "collect response include relations",
"relations-with-parent": "collect response include relations with parent",
"no-scoped": "collect response subtree include no scoped",
"subtree": "collect response subtree include record subtree",
"record-subtree": "collect response subtree include record subtree",
"fault-records": "collect response include fault recored",
"deployment": "collect response include deployment",
"port-deployment": "collect response include port development",
"health-records": "collect response include health records",
"audit-logs": "collect response include audit logs",
"event-logs": "collect response include event logs",
"required": "collect response include required",
"count": "collect response include count",
"fault-count": "collect response include faults count",
"dnlocation": "collect response include DN location"
}
},
"rsp-prop-include=<value>": {
"all": "show all property in response",
"naming-only": "show naming property only in response",
"config-only": "show config property only in response",
"set-config-only": "show config property set by users only in response",
"nondefault-config-only": "show non-default value property only in response"
},
"rsp-subtree-filter=<value>": {
"<value>": "Response subtree filter string"
},
"rsp-foreign-subtree=<value>": {
"none": "show no subtree in response",
"applied-config": "show applied config tree",
"ephemeral": "show ephemeral tree"
},
"rsp-keep-prop-type=<value>": {
"yes": "keep prop type in response"
},
"rsp-keep-regex-filter=<value>": {
"<value>": "response regex filter string"
}
}
}
]
}
You can filter the results of an API query by appending one or more condition statements to the query URL as a parameter in this format:
https://URI?condition[&condition[&...]]
Multiple condition statements are joined by an ampersand (&).
Options are available to filter by object attributes and object subtrees. To determine the filter options, send an OPTIONS request; this returns a response payload with a list of possible filter options as demonstrated in the payload on the right. You can use these options to construct a query. For example, the payload in the pane on the right says that the rsp-subtree=
can be used with the type full
. The payload also lists rsp-prop-include
, which can be used with the type config-only
. Joining these with an ampersand creates a filter that you can attach for a query: GET http://<mgmt_0>/api/mo/sys.json?rsp-subtree=full&rsp-prop-include=config-only
. For more information, see Applying Query Scoping Filters below.
Applying Query Scoping Filters
You can limit the scope of the response to an API query by applying scoping filters. You can limit the scope to the first level of an object or to one or more of its subtrees or children based on the class, properties, categories, or qualification by a logical filter expression.
This section uses example GET requests to demonstrate how to apply query-scoping filters.
Note: These example payloads are requesting information provided by the following BGP cofiguration:
router bgp 100
router-id 10.11.11.1
log-neighbor-changes
address-family ipv4 unicast
neighbor 10.11.11.5
remote-as 100
timers 5 15
vrf vrf1
router-id 10.11.11.10
Querying by Target (Self)
Querying by Target (Self)
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?query-target=self
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying by Target (Children)
Querying by Target (Children)
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?query-target=children
{
"totalCount": "1",
"imdata": [
{
"bgpInst": {
"attributes": {
"activateTs": "2019-02-06T23:14:28.711+00:00",
"adminSt": "enabled",
"affGrpActv": "0",
"asPathDbSz": "0",
"asn": "100",
"attribDbSz": "0",
"childAction": "",
"createTs": "2019-02-06T23:14:27.890+00:00",
"ctrl": "fastExtFallover",
"disPolBatch": "disabled",
"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": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"numAsPath": "0",
"numRtAttrib": "0",
"operErr": "",
"persistentOnReload": "true",
"srgbMaxLbl": "none",
"srgbMinLbl": "none",
"status": "",
"waitDoneTs": "2019-02-06T23:14:28.711+00:00"
}
}
}
]
}
Querying by Filter String
Querying by Filter String
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?query-target-filter=and(eq(faultInst.cause,"config-failure"))
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying by Target Tree (Running)
Querying by Target Tree (Running)
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?target-tree=running
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying by Target Tree (Candidate)
Querying by Target Tree (Candidate)
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?target-tree=candidate
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying by Target Tree (Applied)
Querying by Target Tree (Applied)
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?target-tree=applied
{
"totalCount": "0",
"imdata": []
}
Querying to Include Hidden Properties
Querying to Include Hidden Properties
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?include-hidden=yes
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"monPolDn": "uni/fabric/monfab-default",
"name": "bgp",
"operErr": "",
"operSt": "enabled",
"persistentOnReload": "true",
"status": "",
"uid": "0"
}
}
}
]
}
Querying the Depth of Subtree in Response
Querying the Depth of Subtree in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-depth=1
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
},
"children": [
{
"bgpInst": {
"attributes": {
"activateTs": "2019-02-06T23:14:28.711+00:00",
"adminSt": "enabled",
"affGrpActv": "0",
"asPathDbSz": "0",
"asn": "100",
"attribDbSz": "0",
"childAction": "",
"createTs": "2019-02-06T23:14:27.890+00:00",
"ctrl": "fastExtFallover",
"disPolBatch": "disabled",
"disPolBatchv4PfxLst": "",
"disPolBatchv6PfxLst": "",
"epeActivePeers": "0",
"epeConfiguredPeers": "0",
"fabricSoo": "unknown:unknown:0:0",
"flushRoutes": "disabled",
"isolate": "disabled",
"lnkStClnt": "inactive",
"lnkStSrvr": "inactive",
"medDampIntvl": "0",
"memAlert": "normal",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"numAsPath": "0",
"numRtAttrib": "0",
"operErr": "",
"persistentOnReload": "true",
"rn": "inst",
"srgbMaxLbl": "none",
"srgbMinLbl": "none",
"status": "",
"waitDoneTs": "2019-02-06T23:14:28.711+00:00"
}
}
}
]
}
}
]
}
Querying the Depth of Ancestor in Response
Querying the Depth of Ancestor in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-ancestor-depth=2
{
"totalCount": "1",
"imdata": [
{
"topSystem": {
"attributes": {
"childAction": "",
"currentTime": "2019-02-07T00:27:59.806+00:00",
"dn": "sys",
"modTs": "2019-02-03T23:11:28.627+00:00",
"name": "N9504-4",
"persistentOnReload": "true",
"serial": "FOX1847GGXC",
"status": "created,modified",
"systemUpTime": "00:18:50:58.000"
}
}
}
]
}
Querying to Show No Tree in Response
Querying to Show No Tree in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree=no
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying to Show Only Children in Response
Querying to Show Only Children in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree=children
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
},
"children": [
{
"bgpInst": {
"attributes": {
"activateTs": "2019-02-06T23:14:28.711+00:00",
"adminSt": "enabled",
"affGrpActv": "0",
"asPathDbSz": "0",
"asn": "100",
"attribDbSz": "0",
"childAction": "",
"createTs": "2019-02-06T23:14:27.890+00:00",
"ctrl": "fastExtFallover",
"disPolBatch": "disabled",
"disPolBatchv4PfxLst": "",
"disPolBatchv6PfxLst": "",
"epeActivePeers": "0",
"epeConfiguredPeers": "0",
"fabricSoo": "unknown:unknown:0:0",
"flushRoutes": "disabled",
"isolate": "disabled",
"lnkStClnt": "inactive",
"lnkStSrvr": "inactive",
"medDampIntvl": "0",
"memAlert": "normal",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"numAsPath": "0",
"numRtAttrib": "0",
"operErr": "",
"persistentOnReload": "true",
"rn": "inst",
"srgbMaxLbl": "none",
"srgbMinLbl": "none",
"status": "",
"waitDoneTs": "2019-02-06T23:14:28.711+00:00"
}
}
}
]
}
}
]
}
Querying to Show Full Tree in Response
Querying to Show Full Tree in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree=full
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
},
"children": [
{
"bgpInst": {
"attributes": {
"activateTs": "2019-02-06T23:14:28.711+00:00",
"adminSt": "enabled",
"affGrpActv": "0",
"asPathDbSz": "0",
"asn": "100",
"attribDbSz": "0",
"childAction": "",
"createTs": "2019-02-06T23:14:27.890+00:00",
"ctrl": "fastExtFallover",
"disPolBatch": "disabled",
"disPolBatchv4PfxLst": "",
"disPolBatchv6PfxLst": "",
"epeActivePeers": "0",
"epeConfiguredPeers": "0",
"fabricSoo": "unknown:unknown:0:0",
"flushRoutes": "disabled",
"isolate": "disabled",
"lnkStClnt": "inactive",
"lnkStSrvr": "inactive",
"medDampIntvl": "0",
"memAlert": "normal",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"numAsPath": "0",
"numRtAttrib": "0",
"operErr": "",
"persistentOnReload": "true",
"rn": "inst",
"srgbMaxLbl": "none",
"srgbMinLbl": "none",
"status": "",
"waitDoneTs": "2019-02-06T23:14:28.711+00:00"
},
"children": [
{
"bgpEvtHist": {
"attributes": {
"childAction": "",
"modTs": "2019-02-06T23:14:26.535+00:00",
"persistentOnReload": "true",
"rn": "evthist-cli",
"size": "default",
"status": "",
"type": "cli"
}
}
},
{
"bgpEvtHist": {
"attributes": {
"childAction": "",
"modTs": "2019-02-06T23:14:26.535+00:00",
"persistentOnReload": "true",
"rn": "evthist-errors",
"size": "default",
"status": "",
"type": "errors"
}
}
},
{
"bgpEvtHist": {
"attributes": {
"childAction": "",
"modTs": "2019-02-06T23:14:26.535+00:00",
"persistentOnReload": "true",
"rn": "evthist-events",
"size": "default",
"status": "",
"type": "events"
}
}
},
{
"bgpDom": {
"attributes": {
"always": "disabled",
"bestPathIntvl": "300",
"bgpCfgFailedBmp": "",
"bgpCfgFailedTs": "00:00:00:00.000",
"bgpCfgState": "0",
"childAction": "",
"clusterId": "",
"firstPeerUpTs": "2019-02-06T05:37:02.209+00:00",
"holdIntvl": "180",
"id": "0",
"kaIntvl": "60",
"localAsn": "",
"maxAsLimit": "0",
"modTs": "2019-02-06T23:15:15.298+00:00",
"mode": "fabric",
"name": "vrf1",
"numEstPeers": "0",
"numPeers": "0",
"numPeersPending": "0",
"operRtrId": "0.0.0.0",
"operSt": "down",
"persistentOnReload": "true",
"pfxPeerTimeout": "30",
"pfxPeerWaitTime": "90",
"reConnIntvl": "60",
"rn": "dom-vrf1",
"routerMac": "00:00:00:00:00:00",
"rtrId": "10.11.11.10",
"status": "",
"vnid": "0",
"vtepIp": "0.0.0.0",
"vtepVirtIp": "0.0.0.0"
}
}
},
{
"bgpDom": {
"attributes": {
"always": "disabled",
"bestPathIntvl": "300",
"bgpCfgFailedBmp": "",
"bgpCfgFailedTs": "00:00:00:00.000",
"bgpCfgState": "0",
"childAction": "",
"clusterId": "",
"firstPeerUpTs": "2019-02-06T05:37:02.209+00:00",
"holdIntvl": "180",
"id": "1",
"kaIntvl": "60",
"localAsn": "",
"maxAsLimit": "0",
"modTs": "2019-02-06T23:14:35.566+00:00",
"mode": "fabric",
"name": "default",
"numEstPeers": "0",
"numPeers": "1",
"numPeersPending": "0",
"operRtrId": "10.11.11.1",
"operSt": "up",
"persistentOnReload": "true",
"pfxPeerTimeout": "30",
"pfxPeerWaitTime": "90",
"reConnIntvl": "60",
"rn": "dom-default",
"routerMac": "00:00:00:00:00:00",
"rtrId": "10.11.11.1",
"status": "",
"vnid": "0",
"vtepIp": "0.0.0.0",
"vtepVirtIp": "0.0.0.0"
},
"children": [
{
"bgpPeer": {
"attributes": {
"activePfxPeers": "0",
"addr": "10.11.11.5",
"adminSt": "enabled",
"affGrp": "0",
"asn": "100",
"bgpCfgFailedBmp": "",
"bgpCfgFailedTs": "00:00:00:00.000",
"bgpCfgState": "0",
"bmpSrvId1St": "disabled",
"bmpSrvId2St": "disabled",
"capSuppr4ByteAsn": "disabled",
"childAction": "",
"connMode": "",
"ctrl": "",
"curPfxPeers": "0",
"dynRtMap": "",
"epe": "disabled",
"epePeerSet": "",
"holdIntvl": "15",
"inheritContPeerCtrl": "",
"kaIntvl": "5",
"logNbrChgs": "none",
"lowMemExempt": "disabled",
"maxCurPeers": "0",
"maxPeerCnt": "0",
"maxPfxPeers": "0",
"modTs": "2019-02-06T23:15:07.193+00:00",
"name": "",
"passwdType": "LINE",
"password": "",
"peerImp": "",
"peerType": "fabric-internal",
"persistentOnReload": "true",
"privateASctrl": "none",
"rn": "peer-[10.11.11.5]",
"sessionContImp": "",
"srcIf": "unspecified",
"status": "",
"totalPfxPeers": "0",
"ttl": "0",
"ttlScrtyHops": "0"
},
"children": [
{
"bgpPeerEntry": {
"attributes": {
"addr": "10.11.11.5",
"advCap": "",
"childAction": "",
"connAttempts": "na",
"connDrop": "0",
"connEst": "0",
"connIf": "unspecified",
"fd": "4294967295",
"flags": "cap-neg,gr-enabled",
"holdIntvl": "180",
"kaIntvl": "60",
"lastFlapTs": "2019-02-06T23:14:54.689+00:00",
"localIp": "0.0.0.0",
"localPort": "unspecified",
"maxConnRetryIntvl": "60",
"modTs": "never",
"operSt": "idle",
"passwdSet": "disabled",
"peerIdx": "3",
"persistentOnReload": "false",
"prevOperSt": "illegal",
"rcvCap": "",
"remotePort": "unspecified",
"rn": "ent-[10.11.11.5]",
"rtrId": "0.0.0.0",
"shutStQual": "unspecified",
"stReason": "none",
"status": "",
"type": "ibgp",
"updateElapsedTs": "2019-02-06T05:37:02.209+00:00"
},
"children": [
{
"bgpPeerEntryStats": {
"attributes": {
"byteInRecvQ": "0",
"byteInSendQ": "0",
"byteRcvd": "0",
"byteSent": "0",
"capRcvd": "0",
"capSent": "0",
"connectRetryTs": "2019-02-06T23:15:00.690+00:00",
"kaRcvd": "0",
"kaSent": "0",
"kaTs": "1970-01-01T00:00:00.000+00:00",
"msgRcvd": "0",
"msgSent": "0",
"notifRcvd": "0",
"notifSent": "0",
"openRcvd": "0",
"openSent": "0",
"rn": "peerstats",
"routeRefreshRcvd": "0",
"routeRefreshSent": "0",
"updateRcvd": "0",
"updateSent": "0"
}
}
},
{
"bgpPeerEvents": {
"attributes": {
"childAction": "",
"lastErrDataRsvd": "",
"lastErrDataSent": "",
"lastErrLenRsvd": "0",
"lastErrLenSent": "0",
"lastErrValRsvd": "0",
"lastErrValSent": "0",
"majErrRstRsvd": "none",
"majErrRstSent": "none",
"minErrRstRsvd": "none",
"minErrRstSent": "none",
"modTs": "never",
"persistentOnReload": "false",
"rn": "ev",
"rstRsvdTs": "2019-02-06T05:37:02.209+00:00",
"rstSentTs": "2019-02-06T05:37:02.209+00:00",
"status": ""
}
}
},
{
"bgpGrSt": {
"attributes": {
"grTs": "1970-01-01T00:00:00.000+00:00",
"operSt": "na",
"restartIntvl": "0",
"rn": "gr"
}
}
}
]
}
}
]
}
},
{
"bgpRtCtrl": {
"attributes": {
"childAction": "",
"enforceFirstAs": "enabled",
"fibAccelerate": "disabled",
"logNeighborChanges": "enabled",
"modTs": "2019-02-06T23:14:42.920+00:00",
"persistentOnReload": "true",
"rn": "rtctrl",
"status": "",
"supprRt": "enabled"
}
}
},
{
"bgpDomAf": {
"attributes": {
"advPip": "disabled",
"advSysMac": "disabled",
"advertL2vpnEvpn": "disabled",
"allocLblAll": "disabled",
"allocLblRtMap": "",
"bestPathCmpltTs": "2019-02-06T23:14:48.387+00:00",
"bestPathSigTs": "2019-02-06T23:14:48.385+00:00",
"childAction": "",
"clReflection": "enabled",
"critNhTimeout": "crit",
"defInfOrigRd": "unknown:unknown:0:0",
"defInfOrigRtt": "unknown:unknown:0:0",
"defInfOriginate": "disabled",
"defMetric": "",
"exportGwIp": "disabled",
"igpMetric": "600",
"lblAllocMod": "disabled",
"maxEcmp": "1",
"maxExtEcmp": "1",
"maxExtIntEcmp": "1",
"maxMxdEcmp": "1",
"modTs": "2019-02-06T23:14:48.372+00:00",
"nhRtMap": "",
"nonCritNhTimeout": "noncrit",
"numAggregates": "0",
"numNetworks": "0",
"numPaths": "0",
"numPeers": "0",
"numPeersActive": "0",
"numRoutes": "0",
"persistentOnReload": "true",
"retainRttAll": "disabled",
"retainRttRtMap": "",
"rn": "af-ipv4-ucast",
"status": "",
"supprInactive": "disabled",
"tblId": "0x1",
"tblMap": "",
"tblMapFltr": "disabled",
"tblSt": "up",
"tblVer": "2",
"tmrBstpthDfr": "0",
"tmrMax": "0",
"type": "ipv4-ucast",
"vniEthTag": "disabled"
}
}
}
]
}
}
]
}
}
]
}
}
]
}
Querying to Turn on Matching Only in Response
Querying to Turn on Matching Only in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-matching-only=yes
{
"totalCount": "14",
"imdata": [
{
"bgpEvtHist": {
"attributes": {
"childAction": "",
"dn": "sys/bgp/inst/evthist-errors",
"modTs": "2019-02-06T23:14:26.535+00:00",
"persistentOnReload": "true",
"size": "default",
"status": "created,modified",
"type": "errors"
}
}
},
{
"bgpPeer": {
"attributes": {
"activePfxPeers": "0",
"addr": "10.11.11.5",
"adminSt": "enabled",
"affGrp": "0",
"asn": "100",
"bgpCfgFailedBmp": "",
"bgpCfgFailedTs": "00:00:00:00.000",
"bgpCfgState": "0",
"bmpSrvId1St": "disabled",
"bmpSrvId2St": "disabled",
"capSuppr4ByteAsn": "disabled",
"childAction": "",
"connMode": "",
"ctrl": "",
"curPfxPeers": "0",
"dn": "sys/bgp/inst/dom-default/peer-[10.11.11.5]",
"dynRtMap": "",
"epe": "disabled",
"epePeerSet": "",
"holdIntvl": "15",
"inheritContPeerCtrl": "",
"kaIntvl": "5",
"logNbrChgs": "none",
"lowMemExempt": "disabled",
"maxCurPeers": "0",
"maxPeerCnt": "0",
"maxPfxPeers": "0",
"modTs": "2019-02-06T23:15:07.193+00:00",
"name": "",
"passwdType": "LINE",
"password": "",
"peerImp": "",
"peerType": "fabric-internal",
"persistentOnReload": "true",
"privateASctrl": "none",
"sessionContImp": "",
"srcIf": "unspecified",
"status": "created,modified",
"totalPfxPeers": "0",
"ttl": "0",
"ttlScrtyHops": "0"
}
}
},
{
"bgpEvtHist": {
"attributes": {
"childAction": "",
"dn": "sys/bgp/inst/evthist-events",
"modTs": "2019-02-06T23:14:26.535+00:00",
"persistentOnReload": "true",
"size": "default",
"status": "created,modified",
"type": "events"
}
}
},
{
"bgpDom": {
"attributes": {
"always": "disabled",
"bestPathIntvl": "300",
"bgpCfgFailedBmp": "",
"bgpCfgFailedTs": "00:00:00:00.000",
"bgpCfgState": "0",
"childAction": "",
"clusterId": "",
"dn": "sys/bgp/inst/dom-default",
"firstPeerUpTs": "2019-02-06T05:37:02.209+00:00",
"holdIntvl": "180",
"id": "1",
"kaIntvl": "60",
"localAsn": "",
"maxAsLimit": "0",
"modTs": "2019-02-06T23:14:35.566+00:00",
"mode": "fabric",
"name": "default",
"numEstPeers": "0",
"numPeers": "1",
"numPeersPending": "0",
"operRtrId": "10.11.11.1",
"operSt": "up",
"persistentOnReload": "true",
"pfxPeerTimeout": "30",
"pfxPeerWaitTime": "90",
"reConnIntvl": "60",
"routerMac": "00:00:00:00:00:00",
"rtrId": "10.11.11.1",
"status": "created,modified",
"vnid": "0",
"vtepIp": "0.0.0.0",
"vtepVirtIp": "0.0.0.0"
}
}
},
{
"bgpPeerEntry": {
"attributes": {
"addr": "10.11.11.5",
"advCap": "",
"childAction": "",
"connAttempts": "na",
"connDrop": "0",
"connEst": "0",
"connIf": "unspecified",
"dn": "sys/bgp/inst/dom-default/peer-[10.11.11.5]/ent-[10.11.11.5]",
"fd": "4294967295",
"flags": "cap-neg,gr-enabled",
"holdIntvl": "180",
"kaIntvl": "60",
"lastFlapTs": "2019-02-06T23:14:54.689+00:00",
"localIp": "0.0.0.0",
"localPort": "unspecified",
"maxConnRetryIntvl": "60",
"modTs": "never",
"operSt": "idle",
"passwdSet": "disabled",
"peerIdx": "3",
"persistentOnReload": "false",
"prevOperSt": "illegal",
"rcvCap": "",
"remotePort": "unspecified",
"rtrId": "0.0.0.0",
"shutStQual": "unspecified",
"stReason": "none",
"status": "created,modified",
"type": "ibgp",
"updateElapsedTs": "2019-02-06T05:37:02.209+00:00"
}
}
},
{
"bgpRtCtrl": {
"attributes": {
"childAction": "",
"dn": "sys/bgp/inst/dom-default/rtctrl",
"enforceFirstAs": "enabled",
"fibAccelerate": "disabled",
"logNeighborChanges": "enabled",
"modTs": "2019-02-06T23:14:42.920+00:00",
"persistentOnReload": "true",
"status": "created,modified",
"supprRt": "enabled"
}
}
},
{
"bgpPeerEvents": {
"attributes": {
"childAction": "",
"dn": "sys/bgp/inst/dom-default/peer-[10.11.11.5]/ent-[10.11.11.5]/ev",
"lastErrDataRsvd": "",
"lastErrDataSent": "",
"lastErrLenRsvd": "0",
"lastErrLenSent": "0",
"lastErrValRsvd": "0",
"lastErrValSent": "0",
"majErrRstRsvd": "none",
"majErrRstSent": "none",
"minErrRstRsvd": "none",
"minErrRstSent": "none",
"modTs": "never",
"persistentOnReload": "false",
"rstRsvdTs": "2019-02-06T05:37:02.209+00:00",
"rstSentTs": "2019-02-06T05:37:02.209+00:00",
"status": "created,modified"
}
}
},
{
"bgpPeerEntryStats": {
"attributes": {
"byteInRecvQ": "0",
"byteInSendQ": "0",
"byteRcvd": "0",
"byteSent": "0",
"capRcvd": "0",
"capSent": "0",
"connectRetryTs": "2019-02-06T23:15:00.690+00:00",
"dn": "sys/bgp/inst/dom-default/peer-[10.11.11.5]/ent-[10.11.11.5]/peerstats",
"kaRcvd": "0",
"kaSent": "0",
"kaTs": "1970-01-01T00:00:00.000+00:00",
"msgRcvd": "0",
"msgSent": "0",
"notifRcvd": "0",
"notifSent": "0",
"openRcvd": "0",
"openSent": "0",
"routeRefreshRcvd": "0",
"routeRefreshSent": "0",
"updateRcvd": "0",
"updateSent": "0"
}
}
},
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
},
{
"bgpEvtHist": {
"attributes": {
"childAction": "",
"dn": "sys/bgp/inst/evthist-cli",
"modTs": "2019-02-06T23:14:26.535+00:00",
"persistentOnReload": "true",
"size": "default",
"status": "created,modified",
"type": "cli"
}
}
},
{
"bgpDomAf": {
"attributes": {
"advPip": "disabled",
"advSysMac": "disabled",
"advertL2vpnEvpn": "disabled",
"allocLblAll": "disabled",
"allocLblRtMap": "",
"bestPathCmpltTs": "2019-02-06T23:14:48.387+00:00",
"bestPathSigTs": "2019-02-06T23:14:48.385+00:00",
"childAction": "",
"clReflection": "enabled",
"critNhTimeout": "crit",
"defInfOrigRd": "unknown:unknown:0:0",
"defInfOrigRtt": "unknown:unknown:0:0",
"defInfOriginate": "disabled",
"defMetric": "",
"dn": "sys/bgp/inst/dom-default/af-ipv4-ucast",
"exportGwIp": "disabled",
"igpMetric": "600",
"lblAllocMod": "disabled",
"maxEcmp": "1",
"maxExtEcmp": "1",
"maxExtIntEcmp": "1",
"maxMxdEcmp": "1",
"modTs": "2019-02-06T23:14:48.372+00:00",
"nhRtMap": "",
"nonCritNhTimeout": "noncrit",
"numAggregates": "0",
"numNetworks": "0",
"numPaths": "0",
"numPeers": "0",
"numPeersActive": "0",
"numRoutes": "0",
"persistentOnReload": "true",
"retainRttAll": "disabled",
"retainRttRtMap": "",
"status": "created,modified",
"supprInactive": "disabled",
"tblId": "0x1",
"tblMap": "",
"tblMapFltr": "disabled",
"tblSt": "up",
"tblVer": "2",
"tmrBstpthDfr": "0",
"tmrMax": "0",
"type": "ipv4-ucast",
"vniEthTag": "disabled"
}
}
},
{
"bgpGrSt": {
"attributes": {
"dn": "sys/bgp/inst/dom-default/peer-[10.11.11.5]/ent-[10.11.11.5]/gr",
"grTs": "1970-01-01T00:00:00.000+00:00",
"operSt": "na",
"restartIntvl": "0"
}
}
},
{
"bgpInst": {
"attributes": {
"activateTs": "2019-02-06T23:14:28.711+00:00",
"adminSt": "enabled",
"affGrpActv": "0",
"asPathDbSz": "0",
"asn": "100",
"attribDbSz": "0",
"childAction": "",
"createTs": "2019-02-06T23:14:27.890+00:00",
"ctrl": "fastExtFallover",
"disPolBatch": "disabled",
"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": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"numAsPath": "0",
"numRtAttrib": "0",
"operErr": "",
"persistentOnReload": "true",
"srgbMaxLbl": "none",
"srgbMinLbl": "none",
"status": "created,modified",
"waitDoneTs": "2019-02-06T23:14:28.711+00:00"
}
}
},
{
"bgpDom": {
"attributes": {
"always": "disabled",
"bestPathIntvl": "300",
"bgpCfgFailedBmp": "",
"bgpCfgFailedTs": "00:00:00:00.000",
"bgpCfgState": "0",
"childAction": "",
"clusterId": "",
"dn": "sys/bgp/inst/dom-vrf1",
"firstPeerUpTs": "2019-02-06T05:37:02.209+00:00",
"holdIntvl": "180",
"id": "0",
"kaIntvl": "60",
"localAsn": "",
"maxAsLimit": "0",
"modTs": "2019-02-06T23:15:15.298+00:00",
"mode": "fabric",
"name": "vrf1",
"numEstPeers": "0",
"numPeers": "0",
"numPeersPending": "0",
"operRtrId": "0.0.0.0",
"operSt": "down",
"persistentOnReload": "true",
"pfxPeerTimeout": "30",
"pfxPeerWaitTime": "90",
"reConnIntvl": "60",
"routerMac": "00:00:00:00:00:00",
"rtrId": "10.11.11.10",
"status": "created,modified",
"vnid": "0",
"vtepIp": "0.0.0.0",
"vtepVirtIp": "0.0.0.0"
}
}
}
]
}
Querying to Include Tasks in Response
Querying to Include Tasks in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=tasks
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying to Include Faults in Response
Querying to Include Faults in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=faults
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying to Include Health in Response
Querying to Include Health in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=health
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
},
"children": [
{
"healthInst": {
"attributes": {
"chng": "0",
"cur": "100",
"maxSev": "cleared",
"prev": "100",
"rn": "health",
"twScore": "100",
"updTs": "2019-02-07T00:28:02.186+00:00"
}
}
}
]
}
}
]
}
Querying to Include Stats in Response
Querying to Include Stats in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=stats
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying to Include Relations in Response
Querying to Include Relations in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=relations
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying to Include Relations With the Parent in Response
Querying to Include Relations With the Parent in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=relations-with-parent
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying to Include Record Subtree in Response
Querying to Include Record Subtree in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=subtree,no-scoped
{
"totalCount": "0",
"imdata": []
}
Querying to Include No Scoping in Response
Querying to Include No Scoping in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=no-scoped
{
"totalCount": "0",
"imdata": []
}
Querying to Include Record Subtree in Response
Querying to Include Record Subtree in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=no-scoped,record-subtree
{
"totalCount": "0",
"imdata": []
}
Querying to Include Fault Records in Response
Querying to Include Fault Records in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=fault-records
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying to Include Deployment in Response
Querying to Include Deployment in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=deployment
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying to Include Port Deployment in Response
Querying to Include Port Deployment in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=port-deployment
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying to Include Health Records in Response
Querying to Include Health Records in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=health-records
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying to Include Audit Logs in Response
Querying to Include Audit Logs in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=audit-logs
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying to Include Event Logs in Response
Querying to Include Event Logs in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=event-logs
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying to Include Required in Response
Querying to Include Required in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=required
{
"totalCount": "0",
"imdata": []
}
Querying to Include Count in Response
Querying to Include Count in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=count
{
"totalCount": "1",
"imdata": [
{
"moCount": {
"attributes": {
"childAction": "",
"count": "1",
"dn": "",
"status": ""
}
}
}
]
}
Querying to Include Fault Count in Response
Querying to Include Fault Count in Response
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-include=fault-count
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
},
"children": [
{
"faultCounts": {
"attributes": {
"crit": "0",
"maj": "0",
"minor": "0",
"rn": "fltCnts",
"warn": "0"
}
}
}
]
}
}
]
}
Querying to Include Properties in Response (All)
Querying to Include Properties in Response (All)
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-prop-include=all
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying to Include Properties in Response (Naming Only)
Querying to Include Properties in Response (Naming Only)
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-prop-include=naming-only
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"dn": "sys/bgp"
}
}
}
]
}
Querying to Include Properties in Response (Config Only)
Querying to Include Properties in Response (Config Only)
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-prop-include=config-only
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"dn": "sys/bgp",
"name": "bgp",
"persistentOnReload": "true"
}
}
}
]
}
Querying to Include Properties in Response (Set Config Only)
Querying to Include Properties in Response (Set Config Only)
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-prop-include=set-config-only
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"dn": "sys/bgp"
}
}
}
]
}
Querying to Include Properties in Response (Nondefault Config Only)
Querying to Include Properties in Response (Nondefault Config Only)
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-prop-include=nondefault-config-only
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"dn": "sys/bgp"
}
}
}
]
}
Querying a Subtree Filter String
Querying a Subtree Filter String
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-subtree-filter=lt(healthInst.cur,"50")
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying a Foreign Subtree (None)
Querying a Foreign Subtree (None)
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-foreign-subtree=none
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying a Foreign Subtree (Applied Config)
Querying a Foreign Subtree (Applied Config)
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?applied-config
{
"imdata": [
{
"error": {
"attributes": {
"code": "20",
"text": "Value is not specified for the argument 'applied-config'"
}
}
}
]
}
Querying a Foreign Subtree (Ephemeral)
Querying a Foreign Subtree (Ephemeral)
For an example of an ephemeral query, see Querying IP IGMP Groups.
Querying to Keep the Property Type
Querying to Keep the Property Type
GET http://<mgmt0_IP>/api/mo/sys/bgp.json?rsp-keep-prop-type=yes
{
"totalCount": "1",
"imdata": [
{
"bgpEntity": {
"attributes": {
"adminSt": "enabled",
"childAction": "",
"dn": "sys/bgp",
"modTs": "2019-02-06T23:14:26.535+00:00",
"name": "bgp",
"operSt": "enabled",
"persistentOnReload": "true",
"status": ""
}
}
}
]
}
Querying by Batch Id
Querying by Batch Id
For an example of querying by batch Id, see see Querying IP IGMP Groups.
Querying by Batch Size
Querying by Batch Size
For an example of querying by batch size, see see Querying IP IGMP Groups.
query-target={self | children | subtree}
This statement restricts the scope of the query. This list describes the available scopes:
self—(Default) Considers only the MO itself, not the children or subtrees.
children—Considers only the children of the MO, not the MO itself.
subtree—Considers the MO itself and its subtrees.
target-subtree-class=mo-class1[,mo-class2]...
This statement specifies which object classes are to be considered when the query-target option is used with a scope other than self. You can specify multiple desired object types as a comma-separated list with no spaces.
To request subtree information, combine query-target=subtree with the target-subtree-class statement to indicate the specific subtree as follows:
query-target=subtree&target-subtree-class=className
query-target-filter=filter-expression
This statement specifies a logical filter to be applied to the response. This statement can be used by itself or applied after the query-target statement.
rsp-subtree={no | children | full}
For objects returned, this option specifies whether child objects are included in the response. This list describes the available choices:
- no—(Default) Response includes no children.
- children—Response includes only the children.
- full—Response includes the entire structure including the children.
rsp-subtree-class=mo-class
When child objects are to be returned, this statement specifies that only child objects of the specified object class are included in the response.
rsp-subtree-filter=filter-expression
When child objects are to be returned, this statement specifies a logical filter to be applied to the child objects.
rsp-subtree-include=category1[,category2...][option]
When child objects are to be returned, this statement specifies additional contained objects or options to be included in the response. You can specify one or more of the following categories in a comma-separated list with no spaces:
- audit-logs—Response includes subtrees with the history of user modifications to managed objects.
- event-logs—Response includes subtrees with event history information.
- faults—Response includes subtrees with currently active faults.
- fault-records—Response includes subtrees with fault history information.
- health—Response includes subtrees with current health information.
- health-records—Response includes subtrees with health history information.
**relations**—Response includes relations-related subtree information.
- stats—Response includes statistics-related subtree information.
- tasks—Response includes task-related subtree information.
With any of the preceding categories, you can also specify one of the following options to further refine the query results:
- count—Response includes a count of matching subtrees but not the subtrees themselves.
**no-scoped**—Response includes only the requested subtree information. Other top-level information of the target MO is not included in the response.
- required—Response includes only the managed objects that have subtrees matching the specified category.
For example, to include fault-related subtrees, specify faults in the list. To return only fault-related subtrees and no other top-level MO information, specify faults,no-scoped in the list as shown in this example:
query-target=subtree&rsp-subtree-include=faults,no-scoped
rsp-prop-include={all | naming-only | config-only}
This statement specifies what type of properties should be included in the response when the rsp-subtree option is used with an argument other than no.
- all—Response includes all properties of the returned managed objects.
- naming-only—Response includes only the naming properties of the returned managed objects.
- config-only—Response includes only the configurable properties of the returned managed objects.
Composing Query Filter Expressions
You can filter the response to an API query by applying an expression of logical operators and values. A basic equality or inequality test is expressed as follows:
query-target-filter=[eq|ne](attribute,value)
You can create a more complex test by combining operators and conditions using parentheses and commas:
query-target-filter=[and|or]([eq|ne](attribute,value),[eq|ne](attribute,value),...)
Available Logical Operators
The following table lists the available logical operators for query filter expressions.
Operator | Description |
---|---|
eq | Equal to |
ne | Not equal to |
lt | Less than |
gt | Greater than |
le | Less than or equal to |
ge | Greater than or equal to |
bw | Between |
not | Logical inverse |
and | Logical AND |
or | Logical OR |
xor | Logical exclusive OR |
true | Boolean TRUE |
false | Boolean FALSE |
anybit | TRUE if at least one bit is set |
allbits | Wildcard |
pholder | Property holder |
passive | Passive holder |
Examples
This example returns all managed objects of class aaaUser whose last name is equal to "Washington":
GET https://<IP_Address>/api/class/aaaUser.json? query-target-filter=eq(aaaUser.lastName,"Washington")
This example returns aaa:Domain objects whose names are not "infra" or "common":
GET https://<IP_Address>/api/class/aaaDomain.json? query-target-filter= and(ne(aaaDomain.name,"infra"), ne(aaaDomain.name,"common"))
Verifying the Configuration
To verify the configuration, do one of the following:
If you issued an POST call, issue an HTTP GET querying the managed object addressed in the POST operation.
Issue an NX-OS show command that shows the result of the command or commands that you used to enable configuration settings.
For example, if you issued a
http://<IP address>/api/mo/sys/bgp/inst.json
command to set BGP configuration values, you could issue the show running-config bgp command to display the BGP configuration and verify it.Use the Visore browser to navigate to the MO that holds the configuration that you specified using an POST method and verify that the attributes of the object are correct.
For more information, see the "Using the Managed Object Browser" section.
Using the Developer Sandbox
The NX-API Developer Sandbox is a web form, hosted on the switch, that can translate NX-OS CLI commands into equivalent JSON or XML payloads that can be pushed to the NX-API REST API. The web form is a single screen with three panes — Command (top pane), Request, and Response — as shown in the figure.
When you type or paste one or more CLI commands into the Command pane, the web form converts the commands into an API payload, checking for configuration errors, and displays the resulting payload in the Request pane. If you then choose to post the payload directly from the Sandbox to the switch, using the POST button in the Command pane, the Response pane displays the API response.
For detailed instructions on using the NX-API Developer Sandbox, see the Cisco Nexus 9000 Series NX-OS Programmability Guide.
NX-API Feature Model
Hierarchy
- fm:Entity (sys/fm)
- fm:Nxapi (sys/fm/nxapi)
Supported Configuration
- Configuring feature nxapi in config mode
- Managed Object: fm:Nxapi
Attribute | Description | Naming property (y/n) | Type | Acceptable values (numeric values) | Default Values |
---|---|---|---|---|---|
adminSt | The administrative state of the object or policy | N | Enum | enabled (1) disabled (2) | disabled(2) |
Corresponding CLI
switch(config)# feature nxapi
Operational properties
Oper data
Attribute | Description | Type | Acceptable values (numeric values) | Default Values |
---|---|---|---|---|
operSt | The runtime state of the object | Enum | enabled disabled | disabled |
maxInstance | Number of instances configured | Uint32 | 1 | 1 |
Retries
None
Faults
None
Show CLIshow feature