August 2018
Intermediate to advanced
466 pages
10h 23m
English
Our first program will use the same general structure as the Pexpect program we have put together. We will loop over a list of devices and commands while using Paramiko instead of Pexpect. This will give us a good compare and contrast of the differences between Paramiko and Pexpect.
If you have not done so already, you can download the code, chapter2_3.py, from the book's GitHub repository, https://github.com/PacktPublishing/Mastering-Python-Networking-second-edition. I will list the notable differences here:
devices = {'iosv-1': {'ip': '172.16.1.20'}, 'iosv-2': {'ip': '172.16.1.21'}}
We no longer need to match the device prompt using Paramiko; therefore, the device dictionary can be simplified:
commands = ['show ...
Read now
Unlock full access