cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1230
Views
5
Helpful
1
Replies

How to do selective rollback using python maapi api ?

abdelseaudi
Level 1
Level 1

I was able to test https://community.cisco.com/t5/nso-developer-hub-discussions/commit-and-rollback-usint-action-python-code/m-p/4145068.

 

I used transaction.load_rollback(rollback_nr), and it works.

 

I tried also _ncs.maapi.load_rollback, and _ncs_maapi.load_rollback_fixed, and they work.

 

However, it rolls back the configuration up to the rollback number given to the function

 

How can I do a selective rollback instead ?

 

 

1 Accepted Solution

Accepted Solutions

snovello
Cisco Employee
Cisco Employee
Hi,
There is an action to do rollbacks. Here is a python function to invoke that action. You will need a write transaction to create ‘root’, and you need to apply that transaction.

def rollback_id( root, rollback_number):
apply_rollback_file = root.rollback_files.apply_rollback_file
args = apply_rollback_file.get_input()
args.fixed_number = rollback_number
args.selective.create()
apply_rollback_file(args)

View solution in original post

1 Reply 1

snovello
Cisco Employee
Cisco Employee
Hi,
There is an action to do rollbacks. Here is a python function to invoke that action. You will need a write transaction to create ‘root’, and you need to apply that transaction.

def rollback_id( root, rollback_number):
apply_rollback_file = root.rollback_files.apply_rollback_file
args = apply_rollback_file.get_input()
args.fixed_number = rollback_number
args.selective.create()
apply_rollback_file(args)
Polls
AI-powered tools for network troubleshooting are likely to be part of everyone’s workflow sooner or later. What is the single biggest challenge or concern you see with adopting these tools in your organization?