Chapter 14 - Network Automation

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Thinking Devices

Whenever a device takes a course of action based on an outside piece of information, then that device is referred to as a smart device. Many devices that we interact with now have the word smart in their names. This indicates that the device has the ability to alter its behavior depending on its environment.

The API Concept

An API is software that allows other applications to access its data or services. It is a set of rules describing how one application can interact with another, and the instructions to allow the interaction to occur. The user sends an API request to a server asking for specific information and receives an API response in return from the server along with the requested information.

JSON Data Format

JSON is a human readable data format used by applications for storing, transferring and reading data. JSON is a very popular format used by web services and APIs to provide public data. This is because it is easy to parse and can be used with most modern programming languages, including Python.

CRUD

RESTful APIs use common HTTP methods including POST, GET, PUT, PATCH and DELETE. These correspond to RESTful operations: Create - POST Read - GET Update - PUT/PATCH Delete - DELETE (or CRUD).

Data Format Rules

Data formats have rules and structure similar to what we have with programming and written languages. Each data format will have specific characteristics: - Syntax, which includes the types of brackets used, such as [ ], ( ), { }, the use of white space, or indentation, quotes, commas, and more. - How objects are represented, such as characters, strings, lists, and arrays. - How key/value pairs are represented. The key is usually on the left side and it identifies or describes the data. - The value on the right is the data itself and can be a character, string, number, list or another type of data.

RESTful Implementation

A RESTful web service is implemented using HTTP. It is a collection of resources with four defined aspects: - The base Uniform Resource Identifier (URI) for the web service, such as http://example.com/resources. - The data format supported by the web service. This is often JSON, YAML, or XML but could be any other data format that is a valid hypertext standard. - The set of operations supported by the web service using HTTP methods. - The API must be hypertext driven.

Actuator

A device that causes a machine or other device to operate

Cisco DNA Center

Cisco DNA Center is the foundational controller and analytics platform at the heart of Cisco DNA. It supports the expression of intent for multiple use cases, including basic automation capabilities, fabric provisioning, and policy-based segmentation in the enterprise network. Cisco DNA Center is a network management and command center for provisioning and configuring network devices. It is a hardware and software platform providing a 'single-pane-of-glass' (single interface) that focuses on assurance, analytics, and automation. The DNA Center interface launch page gives you an overall health summary and network snapshot

Smart devices

Smart devices are, in fact, tiny computers. For a smart device, such as an actuator, to react to changing conditions, it must be able to receive and interpret information sent to it by another smart device, such as a sensor. These two smart devices must share a common 'language' which is called a data format. Shared data formats are also used by other devices in the network

API call

The message from the requesting application to the server where the data resides is known as an API call.

URI

Uniform Resource Identifier

Common data formats used in Network Automation is:

XML - eXtensible Markup Language JSON - Java Script Object Notation YMAL - YMAL Ain't Markup Language The data format that is selected will depend on the format that is used by the application, tool, or script that you are using. Many systems will be able to support more than one data format, which allows the user to choose their preferred one.

The Data Formats Concept

A computer must put the data into a format that another computer can understand. Data formats are simply a way to store and exchange data in a structured format. One such format is called Hypertext Markup Language (HTML). HTML is a standard markup language for describing the structure of web pages,

Types of Web Service APIs

A web service is a service that is available over the internet, using the World Wide Web. There are four types of web service APIs: Simple Object Access Protocol (SOAP) Representational State Transfer (REST) eXtensible Markup Language-Remote Procedure Call (XML-RPC) JavaScript Object Notation-Remote Procedure Call (JSON-RPC) SOAP: Data Format - XML First released - 1998 Strengths - Well-established REST: Data Format - JSON, XML, YAML, and others First released - 2000 Strengths - Flexible formatting and most widely used XML-RPC: Data Format - XML First released - 1998 Strengths - Well-established, simplicity JSON-RPC: Data Format - JSON First released - 2005 Strengths -Simplicity SOAP is a messaging protocol for exchanging XML-structured information, most often over HTTP or Simple Mail Transfer Protocol (SMTP). Designed by Microsoft in 1998, SOAP APIs are considered slow to parse, complex, and rigid. This led to the development of a simpler REST API framework which does not require XML. REST uses HTTP, is less verbose, and is easier to use than SOAP. REST refers to the style of software architecture and has become popular due to its performance, scalability, simplicity, and reliability. REST is the most widely used web service API, accounting for over 80% of all the API types used. RPC is when one system requests that another system executes some code and returns the information. This is done without having to understand the details of the network. This works much like a REST API but there are differences dealing with formatting and flexibility. XML-RPC is a protocol developed prior to SOAP, and later evolved into what became SOAP. JSON-RPC is a very simple protocol and similar to XML-RPC.

Open, Internal, and Partner APIs

An important consideration when developing an API is the distinction between open, internal, and partner APIs: Open APIs or Public APIs These APIs are publicly available and can be used with no restrictions. The International Space Station API is an example of a Public API. Because these APIs are public, many API providers, such as Google Maps, require the user to get a free key, or token, prior to using the API. This is to help control the number of API requests they receive and process. Search the internet for a list of public APIs. Internal or Private APIs These are APIs that are used by an organization or company to access data and services for internal use only. An example of an internal API is allowing authorized salespeople access to internal sales data on their mobile devices. Partner APIs These are APIs that are used between a company and its business partners or contractors to facilitate business between them. The business partner must have a license or other form of permission to use the API. A travel service using an airline's API is an example of a partner API.

API

Application Programming Interface Data formats shared between smart devices often use an Application Programming Interface (API). An API is software that allows other applications to access the smart devices data or services. Popular API frameworks: - SOAP - By Microsoft - build internet web services - html, XML - REST - more flexible than SOAP - XML, HTML, JSON - NETCONF - Designed to replace SNMP as a programmatic interface between management programs and network devices. - SSH, XML - RESTCONF - REST like interface to the network. Supports XML and JSON. Defines transport and communication and is coupled to YANG for data.

Cisco Digital Network Architecture (DNA)

Cisco implements the IBN fabric using Cisco DNA. As displayed in the figure, the business intent is securely deployed into the network infrastructure (the fabric). Cisco DNA then continuously gathers data from a multitude of sources (devices and applications) to provide a rich context of information. This information can then be analyzed to make sure the network is performing securely at its optimal level and in accordance with business intent and network policies. Cisco DNA is a system that is constantly learning, adapting to support the business needs.

Configuration Management Tools

Configuration management tools make use of RESTful API requests to automate tasks and can scale across thousands of devices. Configuration management tools maintain the characteristics of a system, or network, for consistency. These are some characteristics of the network that administrators benefit from automating: - Software and version control - Device attributes such as names, addressing, and security - Protocol configurations - ACL configurations Configuration management tools typically include automation and orchestration. Automation is when a tool automatically performs a task on a system. This might be configuring an interface or deploying a VLAN. Orchestration is the process of how all these automated activities need to happen, such as the order in which they must be done, what must be completed before another task is begun, etc. Orchestration is the arranging of the automated tasks that results in a coordinate process or workflow. There are several tools available to make configuration management easier: Ansible Chef Puppet SaltStack

Network Infrastructure as Fabric

From the perspective of IBN, the physical and virtual network infrastructure is a fabric. Fabric is a term used to describe an overlay that represents the logical topology used to virtually connect to devices The overlay limits the number of devices the network administrator must program. It also provides services and alternative forwarding methods not controlled by the underlying physical devices. For example, the overlay is where encapsulation protocols like IP security (IPsec) and Control and Provisioning of Wireless Access Points (CAPWAP) occur. Using an IBN solution, the network administrator can specify through policies exactly what happens in the overlay control plane. Notice that how the switches are physically connected is not a concern of the overlay. The underlay network is the physical topology that includes all hardware required to meet business objectives. The underlay reveals additional devices and specifies how these devices are connected. End points, such as the servers in the figure, access the network through the Layer 2 devices. The underlay control plane is responsible for simple forwarding tasks.

Intent-Based Networking

IBN

Intent-Based Networking Overview

IBN is the emerging industry model for the next generation of networking. IBN builds on Software-Defined Networking (SDN), transforming a hardware-centric and manual approach to designing and operating networks to one that is software-centric and fully automated. Business objectives for the network are expressed as intent. IBN captures business intent and uses analytics, machine learning, and automation to align the network continuously and dynamically as business needs change. IBN captures and translates business intent into network policies that can be automated and applied consistently across the network. Cisco views IBN as having three essential functions: translation, activation, and assurance. These functions interact with the underlying physical and virtual infrastructure

Benefits of automation

Machines can work 24 hours a day without breaks, which results in greater output. Machines provide a more uniform product. Automation allows the collection of vast amounts of data that can be quickly analyzed to provide information which can help guide an event or process. Robots are used in dangerous conditions such as mining, firefighting, and cleaning up industrial accidents. This reduces the risk to humans. Under certain circumstances, smart devices can alter their behavior to reduce energy usage, make a medical diagnosis, and improve automobile driving safety

Traditional Network Configuration

Network devices such as router, switches, and firewalls have traditionally been configured by a network administrator using the CLI. But of course, this is ineffective and slow in large networks Simple Network Management Protocol (SNMP) was developed to allow administrators to manage nodes such as servers, workstations, routers, switches, and security appliances, on an IP network. Using a network management station (NMS), SNMP enables network administrators to monitor and manage network performance, find and solve network problems, and perform queries for statistics. SNMP works reasonably well for device monitoring. HOWEVER, it is not typically used for configuration due to security concerns and difficulty in implementation. Although SNMP is widely available, it cannot serve as an automation tool for today's networks. You can instead use APIs to automate the deployment and management of network resources. Instead of the network administrator manually configuring ports, access lists, quality of service (QoS), and load balancing policies, they can use tools to automate configurations. These tools hook into network APIs to automate routine network provisioning tasks, enabling the administrator to select and deploy the network services they need. This can significantly reduce many repetitive and mundane tasks to free up time for network administrators to work on more important things.

The table lists some Cisco DNA products and solutions.

SD-Access - First intent-based enterprise networking solution built using Cisco DNA. - It uses a single network fabric across LAN and WLAN to create a consistent, highly secure user experience. - It segments user, device, and application traffic and automates user-access policies to establish the right policy for any user or device, with any application, across a network. + Enables network access in minutes for any user or device to any application without compromising security. SD-WAN - It uses a secure cloud-delivered architecture to centrally manage WAN connections. - It simplifies and accelerates delivery of secure, flexible and rich WAN services to connect data centers, branches, campuses, and colocation facilities. + Delivers better user experiences for applications residing on-premise or in the cloud. + Achieve greater agility and cost savings through easier deployments and transport independence. Cisco DNA Assurance - Used to troubleshoot and increase IT productivity. - It applies advanced analytics and machine learning to improve performance and issue resolution, and predict to assure network performance. - It provides real-time notification for network conditions that require attention. + Allows you to identify root causes and provides suggested remediation for faster troubleshooting. + The Cisco DNA Center provides an easy-to-use single dashboard with insights and drill-down capabilities. + Machine learning continually improves network intelligence to predict problems before they occur. Cisco DNA Security - Used to provide visibility by using the network as a sensor for real-time analysis and intelligence. - It provides increased granular control to enforce policy and contain threats across the network. + Reduce risk and protect your organization against threats - even in encrypted traffic. + Gain 360-degree visibility through real-time analytics for deep intelligence across the network. + Lower complexity with end-to-end security.

Data format

Smart devices must share a common 'language' to communicate. This is called a data format. In web programming, data formats are simply a way to store and exchange data in a structured format. Examples of data formats: HTML Characteristics of data formats are: - Data is structured and meant to be easily processed by computer software as well as human readable - Data has special syntax - Data can represent objects - Data objects are represented by using key/value notation. Values can be strings, numbers, Booleans, objects, lists/arrays. - Data is serialized. Converted to a format that allows sharing or storage in a form that allows recovery of it's original structure.

RESTful API Applications

Some RESTful API requests can be made by typing in the URI from within a web browser. A RESTful API request can also be made in other ways. Developer website Developers often maintain web sites that include information about the API, parameter information, and usage examples. These sites may also allow the user to perform the API request within the developer web page by entering in the parameters and other information. Postman Postman is an application for testing and using REST APIs. It is available as a browser app or a standalone install. It contains everything required for constructing and sending REST API requests, including entering query parameters and keys. Postman allows you to collect and save frequently used API calls in history, or as collections. Postman is an excellent tool for learning how to construct API requests, and for analyzing the data that is returned from an API Python APIs can also be called from within a Python program. This allows for possible automation, customization, and App integration of the API Network operating systems (Command prompt) Using protocols such as NETCONF (NET CONFiguration) and RESTCONF, network operating systems are beginning to provide an alternative method for configuration, monitoring, and management. For example, the following output might be the opening response from a router after the user has established a NETCONF session at the command line. However, working at the command line is not automating the network. Instead, a network administrator can use Python scripts or other automation tools, like Cisco DNA Center, to programmatically interact with the router.

JSON Syntax Rules

These are some of the characteristics of JSON: - It uses a hierarchical structure and contains nested values. - It uses braces { } to hold objects and square brackets [ ] hold arrays. - Its data is written as key/value pairs. In JSON, the data known as an object is one or more key/value pairs enclosed in braces { }. The syntax for a JSON object includes: - Keys must be strings within double quotation marks " ". - Values must be a valid JSON data type (string, number, array, Boolean, null, or another object). - Keys and values are separated by a colon. - Multiple key/value pairs within an object are separated by commas. - Whitespace is not significant. At times a key may contain more than one value. This is known as an array. An array in JSON is an ordered list of values. Characteristics of arrays in JSON include: - The key followed by a colon and a list of values enclosed in square brackets [ ]. - The array is an ordered list of values. - The array can contain multiple value types including a string, number, Boolean, object or another array inside the array. - Each value in the array is separated by a comma.

Parts of an API Request

These are the different parts of the API request: API Server This is the URL for the server that answers REST requests. In this example it is the MapQuest API server. Resources Specifies the API that is being requested. In this example it is the MapQuest directions API. Query Specifies the data format and information the client is requesting from the API service. Queries can include: - Format This is usually JSON but can be YAML or XML. In this example JSON is requested. - Key - The key is for authorization, if required. MapQuest requires a key for their directions API. In the above URI, you would need to replace "KEY" with a valid key to submit a valid request. - Parameters - Parameters are used to send information pertaining to the request. In this example, the query parameters include information about the directions that the API needs so it knows what directions to return: "from=San+Jose,Ca" and "to=Monterey,Ca". Many RESTful APIs, including public APIs, require a key. The key is used to identify the source of the request. Here are some reasons why an API provider may require a key: To authenticate the source to make sure they are authorized to use the API. To limit the number of people using the API. To limit the number of requests per user. To better capture and track the data being requested by users. To gather information on the people using the API. Note: If you wish to use the MapQuest API, the API does require a key. Search the internet for the URL to obtain a MapQuest key. Use the search parameters: developer.mapquest. You can also search the internet for the current URL that outlines the MapQuest privacy policy.

Parse

To parse, in computer science, is where a string of commands - usually a program - is separated into more easily processed components, which are analyzed for correct syntax and then attached to tags that define each component. The computer can then process each program chunk and transform it into machine language.

Network Automation

We are rapidly moving away from a world where a network administrator manages a few dozen network devices, to one where they are deploying and managing hundreds, thousands, and even tens of thousands of complex network devices (both physical and virtual) with the help of software. This transformation is quickly spreading from its beginnings in the data center, to all places in the network. There are new and different methods for network operators to automatically monitor, manage, and configure the network. These include protocols and technologies such as REST, Ansible, Puppet, Chef, Python, JSON, XML, and more.

REST and RESTful API

Web browsers use HTTP or HTTPS to request (GET) a web page. If successfully requested (HTTP status code 200), web servers respond to GET requests with an HTML coded web page REST is an architectural style for designing web service applications. It refers to a style of web architecture that has many underlying characteristics and governs the behavior of clients and servers. Simply stated, a REST API is an API that works on top of the HTTP protocol. It defines a set of functions developers can use to perform requests and receive responses via HTTP protocol such as GET and POST. Conforming to the constraints of the REST architecture is generally referred to as being "RESTful". An API can be considered "RESTful" if it has the following features: Client-Server - The client handles the front end and the server handles the back end. Either can be replaced independently of the other. Stateless - No client data is stored on the server between requests. The session state is stored on the client. Cacheable - Clients can cache responses to improve performance.

URI, URN, and URL

Web resources and web services such as RESTful APIs are identified using a URI. A URI is a string of characters that identifies a specific network resource. A URI has two specializations: Uniform Resource Name (URN) identifies only the namespace of the resource (web page, document, image, etc.) without reference to the protocol. Uniform Resource Locator (URL) idefines the network location of a specific resource on the network. HTTP or HTTPS URLs are typically used with web browsers. Other protocols such as FTP, SFTP, SSH, and others can use a URL. A URL using SFTP might look like: sftp://sftp.example.com. These are the parts of a URI, as shown in the figure: Protocol/scheme - HTTPS or other protocols such as FTP, SFTP, mailto, and NNTP Hostname - www.example.com Path and file name - /author/book.html Fragment - #page155

XML Data Format

XML is one more type of human readable data format used to store, transfer, and read data by applications. Some of the characteristics of XML include: - It is like HTML , which is the standardized markup language for creating web pages and web applications. - It is self-descriptive. It encloses data within a related set of tags: <tag>data</tag> - Unlike HTML, XML uses no predefined tags or document structure. XML objects are one or more key/value pairs, with the beginning tag used as the name of the key: <key>value</key>

YAML Data Format

YAML is another type of human readable data format used by applications for storing, transferring, and reading data. Some of the characteristic of YAML include: - It is like JSON and is considered a superset of JSON. - It has a minimalist format making it easy to both read and write. - It uses indentation to define its structure, without the use of brackets or commas.


Ensembles d'études connexes

Chapter 21 Quiz: Tax COnsiderations

View Set

chapter 9, 10, 11, 12 bio 163 exam

View Set

Social Studies Quiz: Topic 5, Lessons 1-3

View Set

Prep U questions Med Surg exam 3

View Set