August 2018
Intermediate to advanced
466 pages
10h 23m
English
Our API can now provide static information about the network; anything that we can store in the database can be returned to the requester. It would be great if we can interact with our network directly, such as a query for the device information or to push configuration changes to the device.
We will start this process by leveraging the script we have already seen in Chapter 2, Low-Level Network Device Interactions, for interacting with a device via Pexpect. We will modify the script slightly into a function we can repeatedly use in chapter9_pexpect_1.py:
# We need to install pexpect for our virtual env$ pip install pexpect$ cat chapter9_pexpect_1.pyimport pexpectdef show_version(device, prompt, ip, username, password): ...
Read now
Unlock full access