cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
976
Views
0
Helpful
0
Replies

Let's roll back the last configuration commits

saalvare
Cisco Employee
Cisco Employee

In two previous post, we discussed the Executor service and how to send custom syslog messages using that service.  In addition to the Syslog RPC (action), XR 6.1.2 also provides an RPC to rollback configuration.  Here are three sample apps to roll back a number of the most recent configuration commits:

nc-execute-xr-cfgmgr-rollback-act-20-ydk.py - rollback last configuration commit

nc-execute-xr-cfgmgr-rollback-act-22-ydk.py - rollback of the last two configuration commits and add a comment

nc-execute-xr-cfgmgr-rollback-act-24-ydk.py - forced rollback of the last five configuration commits, add a comment and add a label

Here's a log of the execution of nc-execute-xr-cfgmgr-rollback-act-24-ydk.py :

$ ./nc-execute-xr-cfgmgr-rollback-act-24-ydk.py ssh://admin:admin@router -v

2016-12-13 15:20:24,906 - ydk.providers.netconf_provider - INFO - NetconfServiceProvider connected to router:None using ssh

2016-12-13 15:20:24,925 - ydk.services.executor_service - INFO - Executor operation initiated

2016-12-13 15:20:24,926 - ydk.providers._provider_plugin - DEBUG -

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:929de084-8b88-4bd8-9920-c73782023864">

  <roll-back-configuration-last xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-cfgmgr-rollback-act">

    <count>5</count>

    <force>true</force>

    <label>PRB-005</label>

    <comment>Forced programmatic rollback</comment>

  </roll-back-configuration-last>

</rpc>

2016-12-13 15:20:25,191 - ydk.providers._provider_plugin - DEBUG -

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:929de084-8b88-4bd8-9920-c73782023864">

  <ok/>

</rpc-reply>

2016-12-13 15:20:25,191 - ydk.services.executor_service - INFO - Executor operation completed

2016-12-13 15:20:25,371 - ydk.providers.netconf_provider - INFO - NetconfServiceProvider disconnected from router using ssh

$

As usual, you can build your own using this boilerplate:

nc-execute-xr-cfgmgr-rollback-act-10-ydk.py - execute boilerplate

Try your own!

0 Replies 0