“CABUORCH-1697”的版本间的差异
来自qingwei personal wiki
(→在NSO docker安装ntool) |
|||
第50行: | 第50行: | ||
# export JAVA_HOME | # export JAVA_HOME | ||
bash-4.2# export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64 | bash-4.2# export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64 | ||
+ | </source> | ||
+ | |||
+ | == ntool 使用 == | ||
+ | === 验证 === | ||
+ | <source lang="shell"> | ||
+ | admin@ncs> ntool verify type cisco-ios file /mnt/datafs/ncs-run/cable-rpd.text | ||
+ | Verifying [cisco-ios] command(s) sequence.... | ||
+ | cable rpd 225400000002 | ||
+ | identifier 2254.0000.0002 | ||
+ | core-interface Te7/1/0 | ||
+ | principal | ||
+ | rpd-ds 0 downstream-cable 7/0/4 profile 1 | ||
+ | rpd-us 0 upstream-cable 7/0/4 profile 1 | ||
+ | r-dti 1 | ||
+ | rpd-event profile 0 | ||
+ | Verification completed | ||
+ | [ok][2018-05-28 00:51:07] | ||
+ | </source> | ||
+ | === 转化 === | ||
+ | <source lang="shell"> | ||
+ | admin@ncs> ntool template type ios template-type config file /mnt/datafs/ncs-run/cable-rpd.text | ||
+ | |||
+ | Creating template [ios] .... | ||
+ | Reading input command file /mnt/datafs/ncs-run/cable-rpd.text | ||
+ | Executing template create action.... | ||
+ | |||
+ | <config-template xmlns="http://tail-f.com/ns/config/1.0"> | ||
+ | <devices xmlns="http://tail-f.com/ns/ncs"> | ||
+ | <device> | ||
+ | <name>{$DEVICE}</name> | ||
+ | <config> | ||
+ | <cable xmlns="urn:ios"> | ||
+ | <rpd> | ||
+ | <name>225400000002</name> | ||
+ | <identifier>2254.0000.0002</identifier> | ||
+ | <core-interface> | ||
+ | <Te> | ||
+ | <name>7/1/0</name> | ||
+ | <principal/> | ||
+ | <rpd-ds> | ||
+ | <port>0</port> | ||
+ | <name>downstream-cable</name> | ||
+ | <id>7/0/4</id> | ||
+ | <profile>1</profile> | ||
+ | </rpd-ds> | ||
+ | <rpd-us> | ||
+ | <port>0</port> | ||
+ | <name>upstream-cable</name> | ||
+ | <id>7/0/4</id> | ||
+ | <profile>1</profile> | ||
+ | </rpd-us> | ||
+ | </Te> | ||
+ | </core-interface> | ||
+ | <r-dti>1</r-dti> | ||
+ | <rpd-event> | ||
+ | <profile>0</profile> | ||
+ | </rpd-event> | ||
+ | </rpd> | ||
+ | </cable> | ||
+ | </config> | ||
+ | </device> | ||
+ | </devices> | ||
+ | </config-template> | ||
+ | |||
+ | Template create completed | ||
+ | |||
+ | [ok][2018-05-28 00:51:49] | ||
</source> | </source> | ||
[[category: cisco]] | [[category: cisco]] | ||
[[category: task]] | [[category: task]] |
2018年5月28日 (一) 07:58的版本
描述
Investigation: CLI to XML Conversion for NSO
ntool
https://github.com/NSO-developer/ntool
在NSO docker安装ntool
# 修改 repo
# editing both /etc/yum.repos.d/epel.repo and /etc/yum.repos.d/epel-testing.repo files, commenting all entries starting with mirrorlist=... and uncommenting all the entries starting with baseurl=....
# 配置代理
bash-4.2# export http_proxy=http://proxy-wsa.esl.cisco.com:80
bash-4.2# export https_proxy=http://proxy-wsa.esl.cisco.com:80
bash-4.2# env | grep proxy
http_proxy=http://proxy-wsa.esl.cisco.com:80
https_proxy=http://proxy-wsa.esl.cisco.com:80
# 安装 make
yum install make
# 安装 ant
yum install ant
# JAVA_HOME指向错误,不是正确的jdk位置,要重新export
# export JAVA_HOME
bash-4.2# export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64
# 安装ntool, 将ntool 拷贝到下面目录
cd /mnt/datafs/ncs-run/packages
make -C ntool/src clean all
#重启NSO !!!
cd /mnt/datafs/ncs-run
ncs --stop
ncs
问题
/usr/bin/ant: Failed to set JAVACMD
Error: JAVA_HOME is not defined correctly.
We cannot execute /usr/bin/java/bin/java
make: *** [javac] Error 1
make: Leaving directory `/mnt/datafs/ncs-run/packages/ntool/src'
# JAVA_HOME配置错误
# 找到Jdk 位置,修改JAVA_HOME
bash-4.2# find /usr/ -name *jdk* -type d
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.el7_4.x86_64
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64
/usr/lib/jvm-exports/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64 #用这个jdk
# export JAVA_HOME
bash-4.2# export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64
ntool 使用
验证
admin@ncs> ntool verify type cisco-ios file /mnt/datafs/ncs-run/cable-rpd.text
Verifying [cisco-ios] command(s) sequence....
cable rpd 225400000002
identifier 2254.0000.0002
core-interface Te7/1/0
principal
rpd-ds 0 downstream-cable 7/0/4 profile 1
rpd-us 0 upstream-cable 7/0/4 profile 1
r-dti 1
rpd-event profile 0
Verification completed
[ok][2018-05-28 00:51:07]
转化
admin@ncs> ntool template type ios template-type config file /mnt/datafs/ncs-run/cable-rpd.text
Creating template [ios] ....
Reading input command file /mnt/datafs/ncs-run/cable-rpd.text
Executing template create action....
<config-template xmlns="http://tail-f.com/ns/config/1.0">
<devices xmlns="http://tail-f.com/ns/ncs">
<device>
<name>{$DEVICE}</name>
<config>
<cable xmlns="urn:ios">
<rpd>
<name>225400000002</name>
<identifier>2254.0000.0002</identifier>
<core-interface>
<Te>
<name>7/1/0</name>
<principal/>
<rpd-ds>
<port>0</port>
<name>downstream-cable</name>
<id>7/0/4</id>
<profile>1</profile>
</rpd-ds>
<rpd-us>
<port>0</port>
<name>upstream-cable</name>
<id>7/0/4</id>
<profile>1</profile>
</rpd-us>
</Te>
</core-interface>
<r-dti>1</r-dti>
<rpd-event>
<profile>0</profile>
</rpd-event>
</rpd>
</cable>
</config>
</device>
</devices>
</config-template>
Template create completed
[ok][2018-05-28 00:51:49]