Chapter 5. Data Formats and Data Models

If you’ve done any amount of exploration into the world of APIs, you’ve likely heard about terms like JSON, XML, or YAML. Perhaps you’ve heard the terms XSD or YANG. You may have heard the term markup language when discussing one of these. But what are these things, and what do they have to do with networking or network automation?

In the same way that routers and switches require standardized protocols in order to communicate, applications need to be able to agree on some kind of syntax in order to exchange data between them. For this, applications can use standard data formats like JSON and XML (among others). Not only do applications need to agree on how the data is formatted, but also on how the data is structured. Data models define how the data stored in a particular data format is structured.

In this chapter, we’ll discuss some of the formats most commonly used with network APIs and automation tools, and how you as a network developer can leverage these tools to accomplish tasks. We’ll also briefly discuss data models and their role in network automation.

Introduction to Data Formats

A computer programmer typically uses a wide variety of tools to store and work with data in the programs they build. They may use simple variables (single value), arrays (multiple values), hashes (key-value pairs), or even custom objects built in the syntax of the language they’re using.

This is all perfectly standard within the confines ...

Get Network Programmability and Automation 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.