‘Programmer’ 分类存档

How to get correct Yang configuration on ASR9k

Now some customer test netconf-yang on our XR platform. And frequency to check how to get correct yang config(XML), then they test the yang config by their controller to touch with our devices. Now there are several ways to achieve that, summed up to facilitate review:


  • We can ssh 830 to asr9k paltform, then get the configuration, that should correct yang config, you can reference attachment at test-xml-by-ssh.txt
ssh cisco@ -p 830 -s netconf
  • We can build Netconf NED by pioneer in NSO, then sync-from devices, and “devices device 9001-A compare-config outformat xml”, that should correct yang config
  • After install NSO, we can use follow tools to achieve that function too
netconf-console -u cisco -p cisco --host --port 831 --get-config


Btw, please attention “-” and “–” that maybe cause command issue.

Some effective tools tips on Mac platform

Transfer to Mac platform for many years, some effective tools are very useful at normal work. Some tools can transparent to covert to Mac platform, e.g SecureCRT, UltraEdit. But some of better new tools need to be adapted, so I wrote the article and discussed tips of them. That can help some people easy and effective to use the tools. Certainly, please support genuine software 🙂


I like login to linux server by terminal of MacOS, but that tool function very less and couldn’t auto generate logg, so I found another good free tool – Iterm2, that is good terminal console in MacOS. Let me show some tips on Iterm2.

Auto check share memory utilization for IOX by Python


In some scenario, we need to monitor some data in router/switch by automation. This article will show example that how to check share memory utilization. And you can easy to change the script base on your requirement/scenario.


Due to “telnetlib” couldn’t exactly check expect messages by read_until() function (that couldn’t control exactly time when the info return to buffer), so I change to “expect”. And follow Bo’s example Python Expect Demo, and there is a good documents for expect demo from IBM too: 探索 Pexpect,第 2 部分:Pexpect 的实例分析



After installed Centos 6.7 for CISCO WAE, I found python version is 2.6 that is much older, and I need ansible1.9, but Centos default upgrade to ansible2.2… in order to easy management ansible1.9 that is python package, I plan to install PIP. From official website, suggest not use 2.6 under pip, so I need to upgrade python to 2.7 too.

But I found WAE use 2.6 after I succeed upgrade python to 2.7…Summarized the totally steps that will help me review in future.

Upgrade Python

After checked from follow link, python 2.7.9 integrate pip, so install this version 🙂

1. Install some package that require by python

python have multi dependencie

[root@wae ~]# yum install gcc
[root@wae ~]# yum install openssl-devel

2. Install python 2.7.9

[root@wae ~]# wget
[root@wae ~]# mv Python-2.7.9.tgz /opt/
[root@wae ~]# cd /opt/
[root@wae opt]# tar -xvf Python-2.7.9.tgz 
[root@wae opt]# cd Python-2.7.9
[root@wae Python-2.7.9]# ./configure --prefix=/usr/local/python2.7
[root@wae Python-2.7.9]# make
[root@wae Python-2.7.9]# make install


Do action by EEM+TCL after the log happen X Times in Y LC/RSP at ASR9k


We can do more automated action by EEM + TCL on Cisco router, and have more trigger way for syslog pattern trigger, OID trigger, CPU Threshold trigger and so on. That will match IOS platform, no any issue. But in XR platform, each LC/RSP have separate alarm, we maybe have special requirement, e.g:

Some alarms frequency happen, I want to restart the process (base on pid) if the alarm happen 3 times in 5min on each LC, how to do that?

0/3/cpu0: alarm report "C", Pid = zzz
0/1/cpu0: alarm report "A", Pid = xxx
0/2/cpu0: alarm report "B", pid = yyy
0/3/cpu0: alarm report "C", pid = zzz
0/1/cpu0: alarm report "A", pid = xxx
0/1/cpu0: alarm report "A", pid = xxx


We can do interactive script by TCL I/O, create a file in Harddisk/disk which has the history/count of syslog for Lcs. We can read this file using the script whenever the syslog is observed. Based on the number of syslogs the script can take the required action.

The steps will be like this, please check attachment and script flow chart for detail script, in my example, I only dump arp process for testing, please change script base on your requirement, in order to test script, you can add flag to test that, e.g “action_syslog priority info msg “a””: 完整阅读