3

APIs and Intent-Driven Networking

In Chapter 2, Low-Level Network Device Interactions, we looked at ways to interact with network devices using Python libraries such as Pexpect, Paramiko, Netmiko, and Nornir. Paramiko and similar libraries use persistent sessions that simulate a user typing in commands as if sitting in front of a Terminal. This approach works fine up to a point. It is easy to send commands for execution on a device and capture the output. However, when the output becomes more than a few lines of characters, it becomes difficult for a computer program to interpret the output. The returned output from Paramiko, for example, is a series of characters meant to be read by a human being. The structure of the output consists of lines ...

Get Mastering Python Networking - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.