Network Automation | Python Cisco Jinja
Dr Pi
Network Automation - updating Cisco Router configs using Python and Jinja. The code in this example shows you how to create Cisco router configs from a script that reads values from a CSV file and applies them to a template. We can make as many configs as we want. We just need 1 row of data in the CSV per target to upgrade (network device).
The templates is based upon the Cisco Router running-config file.
◼️ We add new VLANs and edit the HOST NAME programmatically.
"Jinja is a fast, expressive, extensible templating engine. Special placeholders in the template allow writing code similar to Python syntax."
🌏 https://pypi.org/project/Jinja2/
= Chapter timings =
⭕ 0:00 Intro ⭕ 01:12 Get the existing config to make the Jinja template with ⭕ 03:35 Editing placeholders in the Jinja template ⭕ 06:01 Updating the source CSV ⭕ 09:10 editing the Python code to add new variables ⭕ 11:39 testing the Python code and checking the output ⭕ 14:58 Telnet and pexpect - code to log on with Python script
Network Automation Playlist: 🌏 https://www.youtube.com/playlist?list=PLKMY3XNPiQ7vhVEvu6-ryv85tEb4gFvcI
Visit redandgreen blog for more Tutorials
🌏 http://redandgreen.co.uk/about/blog/
Subscribe to the YouTube Channel
🌏 https://www.youtube.com/c/DrPiCode
Follow on Twitter - to get notified of new videos
👍 Become a patron 👍 🌏 https://www.patreon.com/drpi
😊 Buy Dr Pi a coffee (or Tea) 😊 ☕ ☕ ☕ https://www.buymeacoffee.com/DrPi ☕ ☕ ☕
Proxies
If you need a good, easy to use proxy, I was recommended this one, and having used ScraperAPI for a while I can vouch for them. If you were going to sign up anyway, then maybe you would be kind enough to use the link and the coupon code below?
You can also do a full working trial first as well, (unlike some other companies). The trial doesn't ask for any payment details either so all good! 👍
🌏 10% off ScraperAPI : https://www.scraperapi.com?fpr=ken49 ◼️ ◼️ Coupon Code: DRPI10 ◼️ (You can also get started with 1000 free API calls. No credit card required.)
Thumbs up yeah? (cos Algos..)
#Jinja #Cisco #python ... https://www.youtube.com/watch?v=t8dtURdcMZw
103243976 Bytes