CABUORCH-1697

来自qingwei personal wiki
Qingwei讨论 | 贡献2018年6月19日 (二) 07:23的版本 ntool
跳转至: 导航搜索
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

git

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]

NSO 验证

上传image到仓库

curl --noproxy cisco.com -i -X PUT -u robot-dev-deployer:qqyiwhc7ts6um8sw -v --retry 999 --retry-max-time 0 -T ncs-4.5.6-cisco-ios-6.0.6.tar.gz "http://engci-maven-master.cisco.com/artifactory/robot-dev-thirdparty/com.cisco/cfgsvc/nso-4.5.6/ncs-4.5.6-cisco-ios-6.0.6.tar.gz"

curl --noproxy cisco.com -i -X PUT -u robot-dev-deployer:qqyiwhc7ts6um8sw -v --retry 999 --retry-max-time 0 -T ncs-4.5.6-cisco-iosxr-7.0.6.tar.gz "http://engci-maven-master.cisco.com/artifactory/robot-dev-thirdparty/com.cisco/cfgsvc/nso-4.5.6/ncs-4.5.6-cisco-iosxr-7.0.6.tar.gz"

curl --noproxy cisco.com -i -X PUT -u robot-dev-deployer:qqyiwhc7ts6um8sw -v --retry 999 --retry-max-time 0 -T nso-4.5.6.linux.x86_64.installer.bin "http://engci-maven-master.cisco.com/artifactory/robot-dev-thirdparty/com.cisco/cfgsvc/nso-4.5.6/nso-4.5.6.linux.x86_64.installer.bin"

curl --noproxy cisco.com -i -X PUT -u robot-dev-deployer:qqyiwhc7ts6um8sw -v --retry 999 --retry-max-time 0 -T nso-4.5.6.darwin.x86_64.installer.bin "http://engci-maven-master.cisco.com/artifactory/robot-dev-thirdparty/com.cisco/cfgsvc/nso-4.5.6/nso-4.5.6.darwin.x86_64.installer.bin"

NSO cmd

admin@ncs# show running-config devices device f0bf1cdf-bee1-3525-817c-b593fcb8c8bb config ios:cable load-balance docsis-group    
devices device f0bf1cdf-bee1-3525-817c-b593fcb8c8bb
 config
  ios:cable load-balance docsis-group 10011
   downstream Downstream-Cable 7/0/1 rf-channel 0-3 8-11
   upstream Upstream-Cable 7/0/2 us-channel 0-3
   method utilization us-method modems
   threshold load 30
   threshold stability 70
   policy pure-ds-load
   init-tech-list 4
  !
  ios:cable load-balance docsis-group 10012
   restricted
   downstream Downstream-Cable 7/0/1 rf-channel 0-3 8-11 18-21 26-29
   upstream Upstream-Cable 7/0/2 us-channel 4
   interval   5
   init-tech-list 4
  !
  ios:cable load-balance docsis-group 10013
   restricted
   downstream Downstream-Cable 7/0/1 rf-channel 0-31
   upstream Upstream-Cable 7/0/2 us-channel 1-4
   threshold load minimum 1
   interval   5
   init-tech-list 4
  !
 !
!