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.
Start your free trial

You might also like

Python和NLTK实现自然语言处理

Python和NLTK实现自然语言处理

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

Go程序设计语言

艾伦A. A.多诺万, 布莱恩W. 柯尼汉
弱监督学习实用指南

弱监督学习实用指南

Wee Hyong Tok, Amit Bahree, Senja Filipi
Python实用技能学习指南

Python实用技能学习指南

Posts & Telecom Press, Robert Smallshire, Austin Bingham

Publisher Resources

ISBN: 9787115606181