CABUORCH-1697

出自 qingwei personal wiki
於 2018年6月14日 (四) 12:08 由 Qingwei (對話 | 貢獻) 所做的修訂
前往: 導覽搜尋
Tips

Investigation: CLI to XML Conversion for NSO


jira wiki


描述

Investigation: CLI to XML Conversion for NSO

wiki

http://cmtswiki.cisco.com:8080/display/cmtsdpub/DSG+and+Load+Balancing+Requirements+and+High+Level+Design
http://cmtswiki.cisco.com:8080/display/cmtsdpub/LB+and+DSG+with+OPS

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]

轉化

rpd config

bash-4.2# cat cable-rpd.text 
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
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]