簡介
本檔案介紹如何在路由器上尋找其他新一代(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-ids容器。
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到admin模式下查詢YANG模型,唯一的區別是路徑。
YANG型號所在的路徑如下:/opt/cisco/calvados/1.00/etc/confd/yang