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 可编程网络自动化
136
5
5.5.2
 深入
YANG
语言终有局限。如果说一图胜千言,那么亲眼看看
YANG
是如何映射到
XML
JSON
CLI
,也一定能达到同样的效果。我们将深入
YANG
语句,阐明
YANG
是如何转换为
两个系统用来进行通信的数据的。
注意,我们不会展示如何创建定制的
YANG
模型,这超出了本书的范畴,但
会重点介绍一些
YANG
语句,帮助你更好地理解
YANG
可以使用
YANG
语言的
leaf
语句定义单实例对象,该对象只有一个值,没有子对象。
leaf hostname {
type string;
mandatory true;
config true;
description "Hostname for the network device";
}
可以从
leaf
语句推断出这段代码的用途。该语句创建了一个名为
hostname
的构件,用于
保存网络设备的主机名,主机名必须是字符串,不能空缺,同时还是可配置的。
也可以使用
leaf
语句定义操作数据,将
config
设置为
false
YANG
leaf
XML
JSON
中被描述为单个元素或“键
值”对。
<hostname>
NYC-R1
</hostname>
{
"hostname"
: "NYC-R1"
}
另一个
YANG
语句是
leaf-list
。该语句类似于
leaf
,但可以有多个实例。由于是列表对
象,因此可以依据顺序是否重要,将参数
ordered-by
设置为
user
system
leaf-list name-server {
type ...
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