官术网_书友最值得收藏!

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 computer programming , an A pplication Programming Interface ( API ) is a set of subroutine definitions, protocols, and tools for building application software . In general terms, it's a set of clearly defined methods of communication between various software components. A good API makes it easier to develop a computer program by providing all the building blocks, which are then put together by the programmer .

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
主站蜘蛛池模板: 望江县| 柳江县| 宣汉县| 额济纳旗| 城市| 邵阳市| 颍上县| 肥西县| 望都县| 长寿区| 河津市| 新兴县| 同江市| 武宁县| 新巴尔虎左旗| 怀安县| 泰宁县| 聊城市| 驻马店市| 大兴区| 铜山县| 赣榆县| 商河县| 泗洪县| 怀远县| 亳州市| 莱西市| 根河市| 米易县| 罗田县| 泗水县| 松阳县| 瓦房店市| 花莲市| 固阳县| 镇沅| 封开县| 平江县| 剑阁县| 广丰县| 沧州市|