cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
872
Views
3
Helpful
5
Replies

New to network programing

Aggron
Level 1
Level 1

I'm exploring network programming because I've got a project where it seems like it would be critical / necessary. I want to develop an automated way to backup the running config, diff it to the last stored copy, store / version if different, and most importantly be able to automate a full restore or going back to a prior version.

I discovered RESTconf and how I can use it to pull the full running-config from Cat9300 that I setup for this testing lab. That was between use of Google, YouTube videos, and some use of GenAi. Pretty neat. Just using 'postman' at the moment to start out with delivering the API calls / curl statements.

Where I'm confused or not sure about what to research is how to "deliver" the versioned prior config. As far as REST, this can't be done. That is, I have to use a pre-existing method like scp, http, ftp, tftp, etc, first to upload. Then I might be able to use REST to "configure replace" the file or such. Or maybe I need do use something else like Anisble to script the file delivery and command execution.

In general, am I on the right track? Is there something I'm missing. Easier way to do this? Thanks, I appreciate any feedback.

5 Replies 5

Sounds like you're off to a great start! You have two main options when updating your devices: an incremental update (merging just the changed parts) or a full replace (for a complete restore). For your full restore use case, a hybrid approach is best.
 
You can use restconf to pull, diff, and save the versioned config. However, for a full restore, you must first use a separate mechanism like scp (handled by a library such as Paramiko/Netmiko/Napalm/Scrapcli in Python) to deliver the versioned file to the devices local storage. Once the file is on there, you then use a tool like Netmiko (or other) to connect and execute the CLI command, such as configure replace flash:/old_config.txt, to activate the rollback.
 
Hope this helps.
Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Ok, so the para / netmiko, etc, looks like those are libraries for Python. While that's news to me, I am working together with a coder and they might be familiar with one or multiple. Seems like my role would then be to deliver the CLI commands / IP addressing and User / PW combos, right?

Yes and this is why you are a huge asset to this group building the code, as netmiko is built specifically for network engineers to handle the CLI over SSH. It abstracts away the "human" parts of SSH sessions.

The build approach of start small and design for scale and portability and focusing on a framework is key to making your effort worthwhile across your devices as you scale up. A solid automation framework should be broken into three portable, distinct stages: Data, Logic, and Execution.

Good luck!

 

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Jesus Illescas
Cisco Employee
Cisco Employee

If you are starting I think it makes sense to use files to get the cli config and push the cli config to the device storage, from there use a cli command (Ansible, python) to replace/merge the config.

There is a more programmatic approach, but might be too complicated, which is using RESTCONF operations (http verbs) but you would need to handle the config in a structured way. https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/prog/configuration/1717/b_1717_programmability_cg/m_1717_prog_restconf.html 

For small projects go with the first option. 

Idea right now is to start small then scale. Would like to develop a framework that is transferable / portable / adaptable. Scale size maybe 10-20 network devices (mostly MLS maybe some ASA).