Get the basics right first.
- [Instructor] So let's start with the first script. This is a basic script that imports the ConnectHandler from Netmiko. We've got a dictionary that contains information about an iosv layer two switch. This is a simple a variable. The device type is device type is Cisco IOS. This is the IP address of the switch, the username and the password to use when connecting to the switch. We've got a net connect variable that uses the ConnectHandler to connect to the switch.
The results of the show IP interface brief command are gonna stored in the output variable, and we're gonna print that output. So fairly simple script to get started. So here's the Ubuntu device. Nano netmiko1.py. I'll paste the script in, and then I'll save it. So python netmiko1.py. What this should do is connect to the switch and return back show IP interface brief, and that's what it's done.
These are the physical IP addresses and switch to virtual interface on the switch. We can see that while logging into the switch and type in show IP interface brief. Notice the output is the same. Here's the output of that command, and it's also shown on the Ubuntu server through the Python script. So that's our first script.