Using Screen Scraping in Network Automation
The first time I encountered screen scraping was in mid-1990. All business applications were running on IBM mainframes those days, and IBM used proprietary terminal system (remember 3270) that was almost impossible to interact with, so some people got the “bright” idea of emulating that screen, scraping information off the emulated screen and copying it into HTML pages… thus webifying their ancient apps.
Guess what – we’re still doing the very same thing in network automation as Andrea Dainese succinctly explained in the latest addition to his Automation for Cisco NetDevOps article.
In the background i have created python functions for each of these options. Based on the options the user wants to configure it needs to fill in certain values. These values are transformed into key/value pairs which can then be used in a jinja2 template to create the device configuration.
With netmiko you can just add these conf files as a variable to netmiko and send this configuration file over ssh to the device.
The funny thing is, I tried this with netconf as this was to supposed the best next thing, but there are no generic yang templates which covers every vendor. Ofcourse you can do very generic stuff, but if you want to create a good device configuration you are bound to the specific yang models which the vendor is offering, and what you are then actually doing is converting the CLI of the vendor to XML…