“CABUORCH-1697”的版本间的差异

来自qingwei personal wiki
跳转至: 导航搜索
问题
NSO 验证
 
(未显示同一用户的14个中间版本)
第1行: 第1行:
 +
{{HeaderOfTask
 +
| content=Investigation: CLI to XML Conversion for NSO
 +
| wiki=http://cmtswiki.cisco.com:8080/display/cmtsdpub/DSG+and+Load+Balancing+Requirements+and+High+Level+Design
 +
| wiki2=http://cmtswiki.cisco.com:8080/display/cmtsdpub/LB+and+DSG+with+OPS
 +
}}
 +
 +
 
== 描述 ==
 
== 描述 ==
 
Investigation: CLI to XML Conversion for NSO
 
Investigation: CLI to XML Conversion for NSO
== tool ==
+
=== wiki ===
 +
http://cmtswiki.cisco.com:8080/display/cmtsdpub/DSG+and+Load+Balancing+Requirements+and+High+Level+Design<br />
 +
http://cmtswiki.cisco.com:8080/display/cmtsdpub/LB+and+DSG+with+OPS
 +
 
 +
== ntool ==
 +
=== git ===
 
https://github.com/NSO-developer/ntool
 
https://github.com/NSO-developer/ntool
 
=== 在NSO docker安装ntool ===
 
=== 在NSO docker安装ntool ===
第20行: 第32行:
 
yum install 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
 
</source>
 
</source>
 +
 
=== 问题 ===
 
=== 问题 ===
 
<source lang="shell">
 
<source lang="shell">
第37行: 第62行:
 
# 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>
 +
=== 转化 ===
 +
rpd config
 +
<source lang="shell">
 +
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
 +
</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>
 +
 +
== NSO 验证 ==
 +
=== 上传image到仓库 ===
 +
<source lang="shell">
 +
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"
 +
</source>
 +
=== IOS cli ===
 +
<source lang="shell">
 +
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
 +
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
 +
init-tech-list 4
 +
interval 5
 +
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
 +
init-tech-list 4
 +
interval 5
 +
 +
</source>
 +
=== NSO cmd ===
 +
<source lang="shell">
 +
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
 +
  !
 +
!
 +
!
 +
 +
</source>
 +
=== 转化后的XML ===
 +
<source lang="xml">
 +
<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">
 +
          <load-balance>
 +
            <docsis-group>
 +
              <docsis-group-list>
 +
                <docsis-group-id>10011</docsis-group-id>
 +
                <downstream>
 +
                  <Downstream-Cable>
 +
                    <name>7/0/1</name>
 +
                    <rf-channel>0-3 8-11</rf-channel>
 +
                  </Downstream-Cable>
 +
                </downstream>
 +
                <upstream>
 +
                  <Upstream-Cable>
 +
                    <name>7/0/2</name>
 +
                    <us-channel>0-3</us-channel>
 +
                  </Upstream-Cable>
 +
                </upstream>
 +
                <method>
 +
                  <type>utilization</type>
 +
                  <us-method>modems</us-method>
 +
                </method>
 +
                <threshold>
 +
                  <load>
 +
                    <percentage>30</percentage>
 +
                  </load>
 +
                  <stability>70</stability>
 +
                </threshold>
 +
                <policy>pure-ds-load</policy>
 +
                <init-tech-list>
 +
                  <grouplist>4</grouplist>
 +
                </init-tech-list>
 +
              </docsis-group-list>
 +
              <docsis-group-list>
 +
                <docsis-group-id>10012</docsis-group-id>
 +
                <restricted/>
 +
                <downstream>
 +
                  <Downstream-Cable>
 +
                    <name>7/0/1</name>
 +
                    <rf-channel>0-3 8-11 18-21 26-29</rf-channel>
 +
                  </Downstream-Cable>
 +
                </downstream>
 +
                <upstream>
 +
                  <Upstream-Cable>
 +
                    <name>7/0/2</name>
 +
                    <us-channel>4</us-channel>
 +
                  </Upstream-Cable>
 +
                </upstream>
 +
                <interval>5</interval>
 +
                <init-tech-list>
 +
                  <grouplist>4</grouplist>
 +
                </init-tech-list>
 +
              </docsis-group-list>
 +
              <docsis-group-list>
 +
                <docsis-group-id>10013</docsis-group-id>
 +
                <restricted/>
 +
                <downstream>
 +
                  <Downstream-Cable>
 +
                    <name>7/0/1</name>
 +
                    <rf-channel>0-31</rf-channel>
 +
                  </Downstream-Cable>
 +
                </downstream>
 +
                <upstream>
 +
                  <Upstream-Cable>
 +
                    <name>7/0/2</name>
 +
                    <us-channel>1-4</us-channel>
 +
                  </Upstream-Cable>
 +
                </upstream>
 +
                <threshold>
 +
                  <load>
 +
                    <minimum>1</minimum>
 +
                  </load>
 +
                </threshold>
 +
                <interval>5</interval>
 +
                <init-tech-list>
 +
                  <grouplist>4</grouplist>
 +
                </init-tech-list>
 +
              </docsis-group-list>
 +
            </docsis-group>
 +
          </load-balance>
 +
        </cable>
 +
      </config>
 +
  </device>
 +
</devices>
 +
</config-template>
 +
 
</source>
 
</source>
 
[[category: cisco]]
 
[[category: cisco]]
 
[[category: task]]
 
[[category: task]]

2018年6月19日 (二) 07:58的最新版本

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"

IOS cli

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
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
 init-tech-list 4
 interval 5
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
 init-tech-list 4
 interval 5

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
  !
 !
!

转化后的XML

<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">
          <load-balance>
            <docsis-group>
              <docsis-group-list>
                <docsis-group-id>10011</docsis-group-id>
                <downstream>
                  <Downstream-Cable>
                    <name>7/0/1</name>
                    <rf-channel>0-3 8-11</rf-channel>
                  </Downstream-Cable>
                </downstream>
                <upstream>
                  <Upstream-Cable>
                    <name>7/0/2</name>
                    <us-channel>0-3</us-channel>
                  </Upstream-Cable>
                </upstream>
                <method>
                  <type>utilization</type>
                  <us-method>modems</us-method>
                </method>
                <threshold>
                  <load>
                    <percentage>30</percentage>
                  </load>
                  <stability>70</stability>
                </threshold>
                <policy>pure-ds-load</policy>
                <init-tech-list>
                  <grouplist>4</grouplist>
                </init-tech-list>
              </docsis-group-list>
              <docsis-group-list>
                <docsis-group-id>10012</docsis-group-id>
                <restricted/>
                <downstream>
                  <Downstream-Cable>
                    <name>7/0/1</name>
                    <rf-channel>0-3 8-11 18-21 26-29</rf-channel>
                  </Downstream-Cable>
                </downstream>
                <upstream>
                  <Upstream-Cable>
                    <name>7/0/2</name>
                    <us-channel>4</us-channel>
                  </Upstream-Cable>
                </upstream>
                <interval>5</interval>
                <init-tech-list>
                  <grouplist>4</grouplist>
                </init-tech-list>
              </docsis-group-list>
              <docsis-group-list>
                <docsis-group-id>10013</docsis-group-id>
                <restricted/>
                <downstream>
                  <Downstream-Cable>
                    <name>7/0/1</name>
                    <rf-channel>0-31</rf-channel>
                  </Downstream-Cable>
                </downstream>
                <upstream>
                  <Upstream-Cable>
                    <name>7/0/2</name>
                    <us-channel>1-4</us-channel>
                  </Upstream-Cable>
                </upstream>
                <threshold>
                  <load>
                    <minimum>1</minimum>
                  </load>
                </threshold>
                <interval>5</interval>
                <init-tech-list>
                  <grouplist>4</grouplist>
                </init-tech-list>
              </docsis-group-list>
            </docsis-group>
          </load-balance>
        </cable>
      </config>
  </device>
</devices>
</config-template>