Skip to Content
可编程网络自动化
book

可编程网络自动化

by Jason Edelman, Scott S. Lowe, Matt Oswalt
January 2023
Intermediate to advanced
458 pages
14h 16m
Chinese
Posts & Telecom Press
Content preview from 可编程网络自动化
数据格式与数据模型
121
5.2
 
YAML
如果你阅读本书是由于在网上或者某次演讲中看到或听到了一些令人印象深刻的网络自动
化案例,因而想进一步了解,那么你可能听说过
Y
AML
YAML
是一种对人类用户格外友
好的数据格式,有鉴于此,本节的讨论就从它开始。
YAML
代表
YAML Ain
t Markup Language
YAML
并非标记语言),这看起
来是想告诉我们,
YAML
的作者不愿意使其仅成为某种新的标记语言标准,
而且还别出心裁地尝试以人类可读的方式描述数据。除此之外,其名称缩写
还采用了递归形式。
5.2.1
 
YAML
基础
如果将
YAML
与我们将要讨论的其他数据格式(比如
XML
JSON
)进行比较,似乎做
的事情都差不多:描述诸如列表、“键
值”对
、字符串和整数之类的构造。但你很快就
会看到,
Y
AML
采用了一种特别便于人类阅读的方式。如果理解了上一节中讨论的基本数
据类型,那么
Y
AML
非常易于读写。
这是越来越多的工具(参考
Ansible
)将
Y
AML
用作定义自动化工作流或者提供要处理的
数据集(比如
VLAN
列表)的重要原因
YAML
能够非常容易地从零实现实用的自动化工
作流,或是定义要推送到设备的数据。
在撰写本书之际,最新的
Y
AML
规范是
YAML 1.2
。该站点还提供了一份实现
YAML
软件项目清单,通常可用于读取特定语言的数据结构并对其进行处理。如果你有中意的语
言,那么不妨跟着本章的
Y
AML
示例,尝试使用某个库来实现这些例子。
来看几个例子。假设我们想使用
Y
AML
描述网络厂商列表。如果认真阅读过上一节,那么 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

弱监督学习实用指南

弱监督学习实用指南

Wee Hyong Tok, Amit Bahree, Senja Filipi
Python和NLTK实现自然语言处理

Python和NLTK实现自然语言处理

Posts & Telecom Press, Nitin Hardeniya
Go程序设计语言

Go程序设计语言

艾伦A. A.多诺万, 布莱恩W. 柯尼汉
Python机器学习案例精解

Python机器学习案例精解

Posts & Telecom Press, Yuxi (Hayden) Liu

Publisher Resources

ISBN: 9787115606181