Code here: bit.ly/2MyRDLR Menu: 00:00 - Introduction 02:29 - Spreadsheet conversion 04:19 - Importing using Python 13:41 - What are the advantages of using Jinja2 templates? 16:35 - Skills that Network Engineers should learn? 19:00 - The working template 32:09 - Exporting to a text file 35:22 - Using a script 37:46 - How would I turn this into something that configures a device? 51:18 - Should I use CSV/YAML/JSON? Links: Video 1 in series: kzbin.info/www/bejne/hnOcdWeIpqeUh9k Video 2 in series: kzbin.info/www/bejne/aGTLgZpubdWNeNE Start Now Page on Devnet: bit.ly/2WBjb5v NetDevOps Live Episode on Python Libraries including CSV: bit.ly/2VjbGP4 Coding Fundamentals Learning Labs: bit.ly/2vU1BO8 Network programmability Basics Video Series covering CSV: bit.ly/2JzlbY4 Jinja2 template video: kzbin.info/www/bejne/d4OphmppqcabbqM
@eltreum15 жыл бұрын
I work in telco service provider land and we manage literally a few million devices internally or for customers as a managed service. This is about how we do it but in large scale. The template process we made is in 2 phases to first assemble a complete device template file out of sub-template modules that models a specific piece of equipment or config package we want to deploy from an internal catalog. Next it populates that file with the specific fill in the blank data from whatever data source we want. We have an API service for template generation. I have used netmiko and CSV for small jobs all the time like this and is a great thing for an engineer to learn. Template engines like jinja or a YAML model used in a python app is best for assembling boiler-plate modules but let something else do the fill in the blank stuff. Pythons built-in string replace method is implemented in C in the background and lightning fast already. We have modules for everything we use; DHCP, ACLs, NAT, routing protocols and maps, QOS maps, SMNP, AAA, VPN, EEM or TCL scripts etc. We have used a few template systems over the years and let me caution about jinja and template engine use in general from my experience. You want as little template engine logic mixed in with your device config stuff as possible so it's more readable by other network engineers who are not programmers and lets them contribute modules to the library easier. Your templates also become coupled to that engine so change is hard later. It's a programmers best practice to separate business data from business logic as much as possible. In their example we do not use logic for trunk or access mode anymore in the interface module templates because it can vary by manufacturer, OS series, or firmware so we need a few versions anyway. We pull in the right access version, trunk version, or sub interface version of a template module as needed. Instead of a CSV our equipment inventory database has all the device specific IP data and options our generator program consumes via a fancy DB query. The database field names that get returned in the JSON reply match the template module variable names so string find/replace to fill in the blanks is trivial and tiny intuitive code to read/maintain. We can add new variables without changing code except the DB query which is in a isolated module by itself the program imports. We just add a new DB field name and referencing them in the template modules as variables. As long as they match it just works. Passwords, license keys, and security certificates should be variables called from a separate true-crypt like database when it renders the template. Do not leave those things lying around in plain text template modules. Whatever method you want to use put all your template modules, YAMLs, and program code in an internal GIT server so you have revision control and it facilitates secure collaboration. Our template system pulls all the module pieces out of git on demand and uses databases to fill in the blanks when we want to render a template. We maintain the central repository and every template is rendered in the latest version by default. We can use those to audit/update the network with worker scripts but that is another novel to explain lol.
@amphaeon52464 жыл бұрын
This was one of the best tutorials I've ever seen for network admins with little programming experience. Glad to have found this channel! 10/10
@davidbombal4 жыл бұрын
Glad you liked it!
@NathanWind993 жыл бұрын
This is the best, no nonsense tutorial on this stuff that I’ve seen. Well done gentlemen!
@christostz03 Жыл бұрын
Hank & David, David & Hank, an awesome network - automation - couple !!! Thank you guys !!!
@ajaycnt4 жыл бұрын
Thank you very much! This is a very useful and detailed tutorial for network professionals looking for automation!
@HankPreston5 жыл бұрын
Glad everyone is enjoying the video and series. You can find the code samples at github.com/hpreston/python_networking/tree/master/csv_config_gen
@ericdavid8904 жыл бұрын
Hank & David this is an awesome video thanks for putting this together! I'm going through the Jinja2 templating doc but the method to adapt for IOS configs hadn't clicked just yet. This helps alot! Thanks again keep up the great work
@naveenjkumar96844 жыл бұрын
Thumbs up David and Preston for this support 😃
@davidbombal4 жыл бұрын
Thank you
@otonielricardo5 жыл бұрын
This is priceless information, thank you for sharing!
@henrys55205 жыл бұрын
Thanks for the video Bombal and Hank! Idea for next video: use cases for network automation? Or what other network engineers are doing to start automating?
@jackmorris32794 жыл бұрын
Amazing work! Great video Hank and David
@davidbombal4 жыл бұрын
Glad you enjoyed it!
@menukawijayarathne8864 жыл бұрын
Enjoyed this ,thanks hanks and david
@MariaSanchez-lb4kp4 жыл бұрын
Awesome! Thanks for sharing! This will definitely help me with Network Automation. Thanks guys!
@riccardoandreetta95203 жыл бұрын
Very cool. You can also use spreadsheets to convert them into YAML files, to be further processed by Ansible or similar tools. Pretty much the same approach, in that case you can have the same stuff to configure not only routers but also firewalls, ACI data center, and so on. Good job anyway, very useful explanation. A 'device' column could be added in such a way that the same format could be used for all devices in the network.
@hansthepeter Жыл бұрын
came back today just for fun. This video series with hank got me started back then. Turned out i was already perfect skilled for upcoming job requierements! Same as Cybersecurity today. Thank you so much David! How do you archive always being ahead of the time?
@ragayclark5 жыл бұрын
Thanks for all your videos david, you're one of the main reasons I am studying my CCNP R&S :D,
@zilhazrahman32804 жыл бұрын
This is really cool. Thank you for sharing!!
@mjgritli4 жыл бұрын
Thank you very much for such session
@kewlguyjason4 жыл бұрын
I'm guessing the answer is "use jinja2 templates" but what if we had to do deeper into the prompt, such as*interface* or *config-bgp* *config-ospf*, is it still possible to configure with just netmiko? I guess we would just have to change what we expect back from the router as the expect value (so not #) or just put in send_config_timing?
@m.imraniqbaal69127 ай бұрын
Hi David, I came here to see if we can achieve Zero touch provisioning for Cisco Devices, like literally out of the box. Can you please recommend this piece if you've already made it. Thanks!
@craigallan1145 жыл бұрын
Such a great video!
@tarunjha44215 жыл бұрын
great video David.. thank you
@javiersegovia44203 жыл бұрын
I have a file with extension text, how conversion to spreadsheet? or how can read with python?
@rajeshreddyn30805 жыл бұрын
Thanks David .. really appreciate your efforts. Can you please make some video on pyang Vs YDK and deep dive on pyang..
@MrLupoNino2 жыл бұрын
I would suggest to give some more instruction, how to create the .csv template file, you had in first column "Switch", and inside seem only one device is there sbx-n9kv-ao, but what about if we had a 2nd, 3rd switch, for example sw02, sw03...how to make the loop to generate separate config file for each of the switches? Also some more recommandation how to create the structure of inventory file (no matter in csv or yaml) could be helpful, where to include stuff like ospf, bgp, and how to connect with proper interfaces, neighbors etc. Anyway, thanks so much for you guys brining this session
@luongtrongvinh94573 жыл бұрын
I have a quesiton? What OS and software does he use for simulating in the video? Hopefully you reply me.
@francis2k4885 жыл бұрын
Thanks for the video David. What's the prerequisite for this tutorial? Seems like good knowledge of Python is important.
@Houston123ABC4 жыл бұрын
This is so great
@jhonvinod89884 жыл бұрын
Awesome video
@networkpips3233 жыл бұрын
Can u do a video on how to automate ios patch upgrade with Python
@lahcenkhweb1912 Жыл бұрын
great video ☻
@omega10074 жыл бұрын
I loved Jinja2 until I tried to use a variable I had declared in a for loop. Why the hell would they limit the scope that much, limits Jinjas use cases so much by doing so. I was using Jinja to write 15000 line config files but can no longer as I'm unable to carry variables across multiple blocks.
@madaraekouta80585 жыл бұрын
Bombal the Rock of the Network . we're wainting your ccnp enterprise or Service provider after febuary sir .please
@davidbombal5 жыл бұрын
Thank you. I will be working on CCNP :)
@ashishsolanki864 жыл бұрын
Hi David, I had scheduled Cisco 200-901 exam on 2nd of July 1845 IST however at the scheduled time I was not able to launch the exam and now it's been 5 days I'm chasing Pearson but not getting any response can you help me to reach out someone else who can help me..
@charfeddinealioui35074 жыл бұрын
thank you for sharing
@seand80304 жыл бұрын
Whoa! 🤯
@kiefffrc23865 жыл бұрын
what great info and well explained. Thanks for the video David and Hank, powerful stuff.
@davidbombal5 жыл бұрын
Thank you! Hank is amazing :)
@kenmurphy42595 жыл бұрын
Great review of Netmiko, Jinja2 and CSV. Is there a link to the code used in this example?
@davidbombal5 жыл бұрын
Here you go: bit.ly/2MyRDLR
@amitbeniwal15 жыл бұрын
Hi David the videos are a great content and it feels like I am being greedy but if you could upload the scripts used in the videos to github and share it would be great. Specially the ones used for restconf/netconf
@davidbombal5 жыл бұрын
Here you go: bit.ly/2MyRDLR
@UlissesOliva5 жыл бұрын
Perfect!
@milangerloff52523 жыл бұрын
Font is very small, i can bearly see
@ahmedbadal37955 жыл бұрын
thanks david always delivering wat is best for us ....but this new 200-301 ccna is scary to me ...cant we just become network developers with out the certificates us u know u programming is free ......
@davidbombal5 жыл бұрын
The new CCNA will only have a small portion focusing on Network Automation. The bulk of the cert is still focused on traditional networking. I don't think you have to worry.