New install NSO and Connect with XR by CLI/Netconf NED

Not update any NSO article to my blog, I will put more NSO info to here, wish that will help more guys. The article will include more hands-on experiences, help beginner fast connect xr devices with nso by cli or netconf ned. For netcong NED, build by Pioneer at former, that need to manual exclude the Yang file that no support. In the article, will build netconf ned by native tool of NSO 5.2.0.

Platform Info

[root@nso opt]# ncs --version
5.2.0.1
[root@nso opt]# cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core) 
RP/0/RP0/CPU0:frank#show ins ac sum
Wed Aug  7 01:53:03.286 UTC
    Active Packages: 1
        xrv9k-xr-6.6.3.14I version=6.6.3.14I [Boot image]

Install NSO

[root@nso nso-install]# bash nso-5.2.0.1.linux.x86_64.signed.bin
[root@nso nso-install]# ./nso-5.2.0.1.linux.x86_64.installer.bin /opt/ncs-520
[root@nso nso-install]# cd ..
[root@nso opt]# source ncs-520/ncsrc
[root@nso opt]# ncs-setup --dest /opt/ncs-520-run
[root@nso opt]# cd ncs-520-run/
[root@nso ncs-520-run]# ncs
[root@nso nso-install]# ncs_cli -u admin -C

admin connected from 10.125.6.211 using ssh on nso
admin@ncs#

Put the ncsrc to bashrc:

[root@nso ~]# echo "source /opt/ncs-520/ncsrc" >> .bash_profile

Enable copy/paste of multi-line

Add follow config under of ncs.conf <cli>:

    <space-completion><enabled>false</enabled></space-completion>
    <ignore-leading-whitespace>true</ignore-leading-whitespace>
    <auto-wizard><enabled>false</enabled></auto-wizard>

Then do package reload in NSO:

admin@ncs# packages reload

Add XRv9k and connect by by CLI NED

Add xrv9k, then commit

XR Version is 6.6.3 14i

Attention: xr 6.6.2 have an issu for “Cisco-IOS-XR-sysadmin-vm.yang” , so if you use 6.6.2, please exclude the yang when you build the netconf ned. 

Cisco-IOS-XR-sysadmin-vm.yang has a violation of RFC 6087 YANG model guidelines, section 4.9. This will be corrected in future release.

devices authgroups group frank
 default-map remote-name cisco
 default-map remote-password cisco123

devices device xrv9k-controller
 address   192.168.0.6
 authgroup frank
 device-type cli ned-id cisco-ios-xr
 device-type cli protocol ssh
 state admin-state unlocked

Enable SSH/netconf-yang, and generate ssh key:

RP/0/RP0/CPU0:R6_bgp_controller(config)#show configuration 
Tue Jul 30 10:04:21.566 UTC
Building configuration...
!! IOS XR Configuration 6.6.3.14I
netconf-yang agent
 ssh
!
ssh server logging
ssh server v2
ssh server netconf vrf default

RP/0/RP0/CPU0:R6_bgp_controller(config)#commit
Sun Aug  4 15:29:19.990 UTC
RP/0/RP0/CPU0:R6_bgp_controller(config)#end
RP/0/RP0/CPU0:R6_bgp_controller#crypto key generate dsa 
Sun Aug  4 15:30:51.032 UTC
The name for the keys will be: the_default
  Choose the size of your DSA key modulus. Modulus size can be 512, 768, or 1024 bits. Choosing a key modulus
How many bits in the modulus [1024]: 
Generating DSA keys ...
Done w/ crypto generate keypair
[OK]

Then fetch ssh host key:

admin@ncs# devices device xrv9k-controller ssh fetch-host-keys

sync config from xrv9k:

admin@ncs# devices device xrv9k-controller sync-from

Build Yang NED by native tools in 5.2.x and change to Netconf NED

Change cli to netconf and enable yang project by native tools

admin@ncs# devtools true 
admin@ncs# config
Entering configuration mode terminal
admin@ncs(config)# 
......
admin@ncs(config)# show config
netconf-ned-builder project xr 6.6
 device               xrv9k-controller
 local-user           admin
 vendor               Cisco
 max-download-threads 1  <<< xr should only have 1 thread
!
devices device xrv9k-controller
 device-type netconf ned-id netconf
 no device-type cli protocol ssh
!
admin@ncs# devices device xrv9k-controller connect            
result true
info (admin) Connected to xrv9k-controller - 192.168.0.6:830

Fetch Yang module and download

admin@ncs# netconf-ned-builder project xr 6.6 fetch-module-list 
admin@ncs# netconf-ned-builder project xr 6.6 module Cisco-IOS-XR-* * select
admin@ncs# show netconf-ned-builder project xr 6.6 module statu
NAME                                       REVISION    STATUS               
----------------------------------------------------------------------------
Cisco-IOS-XR-Subscriber-infra-subdb-oper   2018-09-28  selected,downloaded  
Cisco-IOS-XR-aaa-aaacore-cfg               2018-09-04  selected,downloaded  
Cisco-IOS-XR-aaa-diameter-base-mib-cfg     2015-11-09  selected,downloaded  
Cisco-IOS-XR-aaa-diameter-cfg              2019-03-28  selected,downloaded  
......

Building netconf ned and export:

admin@ncs# netconf-ned-builder project xr 6.6 build-ned 
admin@ncs# show netconf-ned-builder project xr 6.6 build-status 
build-status success
admin@ncs# show netconf-ned-builder project xr 6.6 ned-directory-path 
ned-directory-path /opt/ncs-520-run/state/netconf-ned-builder/xr-nc-6.6
admin@ncs# netconf-ned-builder project xr 6.6 export-ned to-directory /tmp
tar-file /tmp/ncs-5.2.0.1-xr-nc-6.6.tar.gz

Copy to package directory, untar file is ok:

[root@nso tmp]# mv -f ncs-5.2.0.1-xr-nc-6.6.tar.gz /opt/ncs-520-run/packages/
[root@nso tmp]# ls  /opt/ncs-520-run/packages/
cisco-iosxr  cn-to-dc  dc-to-cn  ncs-5.2.0.1-xr-nc-6.6.tar.gz  rpl

Package reload and update netconf ned:

admin@ncs# packages reload
admin@ncs# show packages package oper-status 
                                                                                         PACKAGE                                                                   
                          PROGRAM                                                        META     FILE                                                             
                          CODE     JAVA           BAD NCS  PACKAGE  PACKAGE  CIRCULAR    DATA     LOAD                                                             
NAME                  UP  ERROR    UNINITIALIZED  VERSION  NAME     VERSION  DEPENDENCY  ERROR    ERROR  ERROR INFO                                                
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
cisco-iosxr-cli-7.13  X   -        -              -        -        -        -           -        -      -                                                         
cn-to-dc              -   -        -              -        -        -        -           -        X      [cn-to-dc-template.xml:2 Unknown servicepoint: cn-to-dc]  
dc-to-cn              -   -        -              -        -        -        -           -        X      [dc-to-cn-template.xml:2 Unknown servicepoint: dc-to-cn]  
rpl                   X   -        -              -        -        -        -           -        -      -                                                         
xr-nc-6.6             X   -        -              -        -        -        -           -        -      -                                                         

admin@ncs# config 
Entering configuration mode terminal
admin@ncs(config)# devices device xrv9k-controller 
admin@ncs(config-device-xrv9k-controller)# device-type netconf ned-id xr-nc-6.6
admin@ncs(config-device-xrv9k-controller)# port 830
admin@ncs(config)# commit
Commit complete.
admin@ncs(config)# exit
admin@ncs# devices device xrv9k-controller sync-from 
result true

Create a service module of python base

Will put detail info for custom service module at next article~ 🙂

[root@nso opt]# cd ncs-520-run/packages/
[root@nso opt]# python -V
Python 2.7.5
[root@nso packages]# ncs-make-package --service-skeleton python sr
[root@nso packages]# cd sr
[root@nso sr]# tree
.
├── package-meta-data.xml
├── python
│   └── sr
│       ├── __init__.py
│       └── main.py
├── README
├── src
│   ├── Makefile
│   └── yang
│       └── sr.yang
├── templates
└── test
    ├── internal
    │   ├── lux
    │   │   ├── Makefile
    │   │   └── service
    │   │       ├── dummy-device.xml
    │   │       ├── dummy-service.xml
    │   │       ├── Makefile
    │   │       ├── pyvm.xml
    │   │       └── run.lux
    │   └── Makefile
    └── Makefile

9 directories, 14 files
本文出自 Frank's Blog

版权声明:


本文链接:New install NSO and Connect with XR by CLI/Netconf NED
版权声明:本文为原创文章,仅代表个人观点,版权归 Frank Zhao 所有,转载时请注明本文出处及文章链接
你可以留言,或者trackback 从你的网站

留言哦

blonde teen swallows load.xxx videos