From the course: Python NAPALM Network Automation

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

JSON and additional commands

JSON and additional commands

- [Instructor] JSON allows us to format this in human readable format, in other words to make it a lot easier to read. So let's edit our script, and what I'm gonna do here is add a line called import JSON, and I'll change the print to say print json.dumps, iOS output, and I'll indent it with four characters. Now to be consistent with Python 3, I'll add additional brackets here, and I'll save the file. So let's run it again, python napalm1.py. Notice the output is a lot more readable. We can see the iOS version, shown here. We can see the uptime, we can see a list of interfaces, on the device including vLANs, or SVIs. We can see the vendor is Cisco, we can see the serial number, model is iOSv, hostname is S1, fully qualified domain name is S1.cciepython.com. So as an example, if I created another SVI here, and let's create two. So show IP interface brief. Shows us these additional interfaces, what happens when we run our script again? Notice we see the additional vLANs. So this little…

Contents