The REST API (or RESTful API) is one of the Northbound APIs supported by NSO, and the client can operate NSO using HTTP(S).
NSO can use JSON or XML for the payload.By , client applications can choose either easily by specifying the Content-type to include in the HTTP header.
REST API vs. RESTCONF
The REST API and RESTCONF are similar in name and behavior but they are different northbound APIs.Although RESTCONF is defined in RFC 8040, there is no standardized specification in the REST API itself, and it is implemented by NSO (and software supporting REST API) by itself.
In NSO, RESTCONF protocol is supported by NSO 4.3 or later.
This document explains about REST API.
URI and Resources
In the REST API, operations are performed on a object (node) that can be identified by URI. Each object belongs to one of the resources.
Get a list of available methods for the specified resource
By adding the query parameter to the URI followed by "?" (Question Mark), you can change the normal behavior and make various differences. Note that it is not related to the REST Query API which will be explained later.
For example, if you wish to do "commit dry-run" on the commit action from REST, we use this feature
Since many types of query parameters are defined, only some of them are listed here. For other parameters, refer to the following in the manual.
NSO 4.4 Northbound APIs -> The REST API -> Getting started -> Query Parameters
When changing data, commit dry-run equivalent will be done.Do not make changes to Southbound equipment or CDB at all, only calculate data to be changed.
When changing data, do commit no-networking equivalent.Do not change to Southbound equipment, only change CDB.
When acquiring data, execute show running-config | detail equivalent.Include default values in retrieved data.
* dry-run example is included in later examples of REST calls.
REST API Examples
The below all examples are using curl commands.
OPTIONS against /api
To check what method is available, use OPTIONS method. We now know that GET and HEAD method is usable.
This example returns what resources are available by using GET method on /api. curl command actually performs GET when -X option is missing, however it is used to show GET is used. -i option shows the HTTP response headers together.
The default data format is in XML.
$ curl -i -X GET http://localhost:8080/api -u admin:admin
Hi, We have a instance of NSO community edition running in our lab. We wanted to try performing OS/firmware upgrade on Cisco routers/switch using NSO. It is learnt that os upgrade service package needs to be installed.Is it possible to install the os...
I'll tried to execute a LUX test on Cisco NSO 5.3 installed on a VM with Centos SO but 'i've an error
[15:45:49]-nso:_NIZZA_$ lux run.lux
=ERROR REPORT==== 23-May-2022::15:45:...