07-18-2019 06:18 AM - edited 07-18-2019 06:19 AM
How to rollback the configuration file with the name <name>0</name> from rollback configuration datastore per REST-API?
Do I need a HTTP-POST-requests to start the rollback?
<rollbacks xmlns="http://tail-f.com/ns/rest" xmlns:y="http://tail-f.com/ns/rest"> <file> <name>0</name> <creator>admin</creator> <date>2019-07-18 13:15:18</date> <via>rest</via> <label></label> <comment></comment> </file> <file> <name>1</name> <creator>admin</creator> <date>2019-07-18 13:13:16</date> <via>rest</via> <label></label> <comment></comment> </file> <file> <name>2</name> <creator>admin</creator> <date>2019-07-18 13:01:09</date> <via>rest</via> <label></label> <comment></comment> </file> </rollbacks>
Solved! Go to Solution.
07-29-2019 06:19 AM
Hello,
using admin:admin as username/password - this will apply the latest rollback file
curl -X POST \ http://<IP>:<PORT>/api/running/_rollback \ -H 'Accept: application/vnd.yang.data+json' \ -H 'Authorization: Basic YWRtaW46YWRtaW4=' \ -H 'Content-Type: application/vnd.yang.data+json' \ -d '{ "file": 0 }'
This is documented `$NCS_DIR/doc/html/nso_northbound/ch03s04s06.html` for NSO 4.7.2 if you want more information.
07-19-2019 10:03 AM
Hello,
via the REST(CONF) API you have an action apply-rollback-file defined in
$NCS_DIR/src/ncs/yang/tailf-rollback.yang
The documentation of NSO 5.1 has a chapter including an example on how to use this action (the two code snapshots below are from this documentation):
Step 1: (not mandatory if you know for sure which rollback file you want to apply). Get the list of available rollback files using
GET /restconf/data/tailf-rollback:rollback-files
Step 2: you can use the action to apply a rollback file:
POST /restconf/data/tailf-rollback:rollback-files/apply-rollback-file HTTP/1.1 Content-Type: application/yang-data+xml <input xmlns="http://tail-f.com/ns/rollback"> <id>0</id> </input>
Note: there is a second action in the YANG module that allows you to get the content of the rollback file if you need it.
PS: the reason I wrote REST(CONF) is that the REST API will be deprecated in NSO 5.3 as per the release notes of NSO 5.1 and so it is better to start using RESTCONF rather than REST to be future proof.
07-20-2019 01:57 AM
07-29-2019 06:19 AM
Hello,
using admin:admin as username/password - this will apply the latest rollback file
curl -X POST \ http://<IP>:<PORT>/api/running/_rollback \ -H 'Accept: application/vnd.yang.data+json' \ -H 'Authorization: Basic YWRtaW46YWRtaW4=' \ -H 'Content-Type: application/vnd.yang.data+json' \ -d '{ "file": 0 }'
This is documented `$NCS_DIR/doc/html/nso_northbound/ch03s04s06.html` for NSO 4.7.2 if you want more information.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide