- Mastering Python Networking
- Eric Chou
- 352字
- 2021-07-02 21:42:38
API and Intent-Driven Networking
In the previous chapter, we looked at ways to interact with the device interactively using Pexpect and Paramiko. Both of these tools use a persistent session that simulates a user typing in commands as if they are sitting in front of the Terminal. This works fine up to a point. It is easy enough to send commands over for execution on the device and capture the output back. However, when the output becomes more than a few lines of characters, it becomes difficult for a computer program to interpret the output. In order for our simple computer program to automate some of what we do, we need to be able to interpret the returned results and make follow-up actions based on the returned result. When we cannot accurately and predictably interpret the results back, we cannot execute the next command with confidence.
Luckily, this problem was solved by the Internet community. Imagine the difference between a computer and a human being reading a web page. The human sees words, pictures, and spaces interpreted by the browser; the computer sees raw HTML code, Unicode characters, and binary files. What happens when a website needs to become a web service for another computer? Doesn't this problem sound familiar to the one that we presented before? The answer is the application program interface, or API for short. An API is a concept; according to Wikipedia:
In our use case, the set of clearly defined methods of communication would be between our Python program and the destination device.
In this chapter, we will look at the following topics:
- Treating infrastructure as code and data modeling
- Cisco NX-API and application-centric infrastructure
- Juniper NETCONF and PyEZ
- Arista eAPI and pyeapi
- 測試驅動開發:入門、實戰與進階
- Azure IoT Development Cookbook
- SQL Server 2012數據庫技術及應用(微課版·第5版)
- Apache Hive Essentials
- Java編程指南:基礎知識、類庫應用及案例設計
- C#程序設計(慕課版)
- Hadoop+Spark大數據分析實戰
- Bootstrap 4:Responsive Web Design
- Hadoop 2.X HDFS源碼剖析
- RubyMotion iOS Develoment Essentials
- 原型設計:打造成功產品的實用方法及實踐
- HTML5 and CSS3:Building Responsive Websites
- jQuery Essentials
- INSTANT Apache Maven Starter
- Vue.js項目開發實戰