简介
本文档介绍如何在路由器上查找下一代(YANG)型号。为了了解特定的Cisco IOS® XR版本支持哪些YANG型号可能比较繁琐,并且会不时添加新型号或更改当前型号。作为参考,您还可以在github上找到YANG模型,但这些模型可能不是最新的。
这是指向github存储库的链接。github存储库
在XR中查找YANG模型
下面是一个示例,其中有两个模型尚未解析:
RP/0/RSP0/CPU0:ASR9904-B#show telemetry model-driven subscription 1
Mon Apr 30 04:33:42.421 EST
Subscription: 1
-------------
State: NOT ACTIVE
Sensor groups:
Id: Memory
Sample Interval: 10000 ms
Sensor Path: Cisco-IOS®-XR-nto-misc-oper:memory-summary/nodes/node/summary
Sensor Path State: Not Resolved
Sensor Path: Cisco-IOS®-XR-procmem-oper:processes-memory/nodes/node/process-ids/process-id
Sensor Path State: Not Resolved
集合组:
------------------
No active collection groups
The first thing to do after going into the shell is to change directories to /pkg/yang. This is where the yang models are stored.
The models we specified in the configuration are not resolved because the models do not exist on the router as we can see from the 'ls' commands. When we search for the 'procmem' yang model
for instance we see that it has changed from Cisco-IOS®-XR-procmem-oper to Cisco-IOS®-XR-nto-misc-shprocmem-oper.
However, we should examine this file further to see if anything else has changed in the model structure.
As we can see with this model the container/list process-ids/process-id has changed to job-ids/job-id.
RP/0/RSP0/CPU0:ASR9904-B#
RP/0/RSP0/CPU0:ASR9904-B#
RP/0/RSP0/CPU0:ASR9904-B#run
Mon Apr 30 04:34:04.911 EST
# cd /pkg/yang
# ls -l Cisco-IOS®-XR-nto-misc-oper*
ls: No such file or directory (Cisco-IOS-XR-nto-misc-oper*)
# ls -l Cisco-IOS®-XR-procmem-oper*
ls: No such file or directory (Cisco-IOS-XR-procmem-oper*)
# ls -l Cisco-IOS®-XR-nto-misc*
-rw-r--r-- 2 13707 25 4320 Jun 29 2017 Cisco-IOS®-XR-nto-misc-shmem-oper-sub1.yang
-rw-r--r-- 2 13707 25 1732 Jun 29 2017 Cisco-IOS®-XR-nto-misc-shmem-oper.yang
-rw-r--r-- 2 13707 25 1388 Jun 29 2017 Cisco-IOS®-XR-nto-misc-shprocmem-oper-sub1.yang
-rw-r--r-- 2 13707 25 1719 Jun 29 2017 Cisco-IOS®-XR-nto-misc-shprocmem-oper.yang
# ls -l Cisco-IOS®-XR*procmem*
-rw-r--r-- 2 13707 25 1388 Jun 29 2017 Cisco-IOS®-XR-nto-misc-shprocmem-oper-sub1.yang
-rw-r--r-- 2 13707 25 1719 Jun 29 2017 Cisco-IOS®-XR-nto-misc-shprocmem-oper.yang
#
# more Cisco-IOS®-XR-nto-misc-shprocmem-oper.yang
module Cisco-IOS®-XR-nto-misc-shprocmem-oper {
/*** NAMESPACE / PREFIX DEFINITION ***/
namespace "http://cisco.com/ns/yang"+
"/Cisco-IOS®-XR-nto-misc-shprocmem-oper";
prefix "nto-misc-shprocmem-oper";
/*** LINKAGE (IMPORTS / INCLUDES) ***/
import Cisco-IOS®-XR-types { prefix "xr"; }
include Cisco-IOS®-XR-nto-misc-shprocmem-oper-sub1 {
revision-date 2015-11-09;
}
/*** META INFORMATION ***/
organization "Cisco Systems, Inc.";
contact
"Cisco Systems, Inc.
Customer Service
Postal: 170 West Tasman Drive
San Jose, CA 95134
Tel: +1 800 553-NETS
E-mail: cs-yang@cisco.com";
description
"This module contains a collection of YANG definitions
for Cisco IOS®-XR nto-misc-shprocmem package operational data.
This module contains definitions
for the following management objects:
processes-memory: Process statistics
Copyright (c) 2013-2016 by Cisco Systems, Inc.
All rights reserved.";
revision "2015-11-09" {
description
"IOS® XR 6.0 revision.";
}
container processes-memory {
config false;
description "Process statistics";
container nodes {
description "List of nodes";
list node {
key "node-name";
description "Node ID";
container job-ids {
description "List of jobs";
list job-id {
key "job-id";
description "Job Id";
leaf job-id {
type int32;
description "Job Id";
}
uses PROCESSESMEMORY-ENTRY;
}
}
leaf node-name {
type xr:Node-id;
description "Node name";
}
}
}
}
}
# exit
提交这些更改后,您可以看到这两个模型现已解决。
以下示例还显示,可以指定部分传感器路径,并且必须为Cisco-IOS®-XR-nto-misc-shprocmem-oper和not process-id指定job-id容器。
RP/0/RSP0/CPU0:ASR9904-B#show telemetry model-driven subscription 1
Tue May 1 06:33:15.986 EST
Subscription: 1
-------------
State: NOT ACTIVE
Sensor groups:
Id: Memory
Sample Interval: 10000 ms
Sensor Path: Cisco-IOS®-XR-nto-misc-oper:memory-summary/nodes/node/summary
Sensor Path State: Not Resolved
Sensor Path: Cisco-IOS®-XR-nto-misc-shmem-oper:memory-summary
Sensor Path State: Resolved
Sensor Path: Cisco-IOS®-XR-nto-shmem-misc-oper:memory-summary
Sensor Path State: Not Resolved
Sensor Path: Cisco-IOS®-XR-nto-misc-shmem-oper:memory-summary/nodes/node/summary
Sensor Path State: Resolved
Sensor Path: Cisco-IOS®-XR-nto-misc-shprocmem-oper:processes-memory/nodes/node/process-ids/process-id
Sensor Path State: Not Resolved
Sensor Path: Cisco-IOS®-XR-nto-misc-shprocmem-oper:processes-memory/nodes/node/job-ids/job-id
Sensor Path State: Resolved
Sensor Path: Cisco-IOS®-XR-procmem-oper:processes-memory/nodes/node/process-ids/process-id
Sensor Path State: Not Resolved
Collection Groups:
------------------
No active collection groups
在管理模式下查找YANG模型(eXR)
相同的承担者可用于在XR到管理模式下查找YANG模型,唯一的区别是路径。
YANG型号所在的路径如下:/opt/cisco/calvados/1.00/etc/confd/yang