Archive

‘Programmer’ 分类存档

Install Yangsuite by Docker

Install

docker pull dockerhub.cisco.com/yang-tools-release-docker/yangsuite:latest
docker run -it -p 8480:8480 \
      --mount type=bind,source=/xxx/Documents/Yangsuite_data,target=/home/docker/data \
      dockerhub.cisco.com/yang-tools-release-docker/yangsuite:latest

Detail info:

xxxxx:~ xxxxx$ docker pull dockerhub.cisco.com/yang-tools-release-docker/yangsuite:latest
latest: Pulling from yang-tools-release-docker/yangsuite
4ccdce43d1e0: Already exists 
c95f13c88d92: Already exists 
82656eee95ad: Already exists 
78ff727be57a: Already exists 
448bb314afa5: Already exists 
15677038ac69: Already exists 
22da8daab8e7: Already exists 
9c3a638e7094: Already exists 
2952d6a1d978: Already exists 
bd8c0fd10ad7: Already exists 
680c72e6e1fc: Already exists 
Digest: sha256:31136ac8bca600e0a2a1696ed6798b277e6e7f05652dc1c1f2fd36415b85e930
Status: Image is up to date for dockerhub.cisco.com/yang-tools-release-docker/yangsuite:latest

xxxxx:~ xxxxx$ docker run -it -p 8480:8480 \
>       --mount type=bind,source=/Users/xxxxx/Documents/Yangsuite_data,target=/home/docker/data \
>       dockerhub.cisco.com/yang-tools-release-docker/yangsuite:latest
2018-12-17 01:26:10,395 - yangsuite.paths: INFO: Creating new 'filename' directory path /home/docker/data/logs/
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying sessions.0001_initial... OK
**********************************************************************
Your input is required to define an admin user
**********************************************************************
Username (leave blank to use 'root'): 
Email address: 
Password: 
Password (again): 
The password is too similar to the email address.
This password is too short. It must contain at least 8 characters.
Password: 
Password (again): 
The password is too similar to the email address.
Password: 
Password (again): 
Superuser created successfully.
**********************************************************************
YANG Suite data is stored at /home/docker/data. Be sure to back up this directory!
**********************************************************************
Performing system checks...

System check identified no issues (0 silenced).
December 17, 2018 - 01:26:58
Django version 2.0.8, using settings 'yangsuite.settings.develop'
Starting development server at http://0.0.0.0:8480/

Check Status

xxx:~ xxx$ docker ps -a
CONTAINER ID        IMAGE                                                            COMMAND             CREATED             STATUS                     PORTS                    NAMES
xxxxxxxxxxxx        dockerhub.cisco.com/yang-tools-release-docker/yangsuite:latest   "yangsuite"         6 minutes ago       Up 3 minutes        0.0.0.0:8480->8480/tcp   frosty_wiles

Open Yangsuit

http://0.0.0.0:8480

or

http://127.0.0.1:8480
0

在MacOS中部署Python虚拟开发环境

部署虚拟开发环境

虽然自己不是软件工程师,但有时候为了测试会写一些小程序,所以常常需要在自己电脑上设置开发环境。由于MacOS原生支持Python,所以我们可以不用那么麻烦的设置开发环境。但为了系统的稳定性,还是不要随便增加或变更自带的python,所以开发环境直接用虚拟环境就可以了,大概构架如下:


完整阅读

0

How to convert SPP into text2pcap readable format by python

Introduction

There are some internal tools that can decode SPP packets at former, but they are not work now. In some scenario, customer coudln’t do span on our asr9k, so we only need SPP, then will face to how to decode SPP result.

The article disscuss how to covert SPP original data to text2pcap readable format, then decode by text2pcap. You only do the script that can auto work. Btw, before do that, you need have python2.7 and text2pcap (integrate in wireshark). If you have python3.0 or newer, that maybe have some issue, because some function have a bit different, you need adjust them by yourself.

Solution

Original SPP data:

=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2017.12.04 17:12:19 =~=~=~=~=~=~=~=~=~=~=~=
trace p stop
Tracing stopped with 666 outstanding...
spp-ui> trace print
Packet serial 861
port4/classify:
  length 148 phys_int_index 0 next_ctx 0xdeadbeef time 09:10:41.407
  00: 00 70 72 00 00 08 00 65 7a 00 00 00 ff ff 00 07 
  10: 80 30 00 00 00 00 0f 00 00 00 1f 00 00 00 00 00 
  20: 00 70 05 f2 42 fb 00 00 04 00 01 40 07 01 05 27 
  30: 06 03 0e 06 00 00 00 00 4c 00 00 00 00 00 58 00 
  40: 00 00 00 00 00 00 06 01 00 a1 13 41 92 60 00 b2 
  50: 64 41 8a 4c 08 00 45 c0 00 3e 00 00 00 00 fe 11 
  60: c8 25 12 ac 79 0d 34 df d0 01 02 86 02 86 00 2a 
  70: 75 5a 00 01 00 1e 3f da a4 0f 00 00 01 00 00 14 
  80: 00 00 00 00 04 00 00 04 00 5a c0 00 04 01 00 04 
  90: 3f da a4 0f 00 00 00 00 00 00 00 00 00 00 00 00 
  a0: 00 00 00 17 00 08 05 01 00 00 af c8 00 24 14 01 
  b0: 01 08 3f da d0 46 20 00 01 08 3f da d0 42 20 00 
  c0: 01 08 3f da d0 41 20 00 01 08 3f da d0 07 20 00 
  d0: 00 08 13 01 00 00 08 00 00 20 cf 07 00 00 07 16 
  e0: 4d 50 4c 53 2d 54 45 20 74 6f 20 76 61 72 30 31 
  f0: 2e 6b 6c 70 30 32 00 00 00 0c 0b 07 3f df 04 08 
--------------------------

完整阅读

0

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@10.75.49.25 -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 10.75.49.53 --port 831 --get-config

 

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

0

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 🙂

Iterm2

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.
完整阅读

0