一.概述
利用yang-explorer可以很方便以GUI通过netconf配置支持netconf的思科网络设备,并生成python2的代码,方便后续进行自动化的配置的代码参考,下面记录一下新建Centos7虚拟机上安装 yang-explorer的过程。如果按默认的github上面下载安装的话非常慢,需要提前把github的项目导入到码云仓库。
二.准备工作
1.操作系统安装
安装的时候可以选择最小化安装,但是把开发工具勾上,方便后续使用gcc:
2.将github的项目导入码云
三个项目,已经从Github导入,分别是(已经设置为公开仓库):
3.安装pip2,配置国内更新源并update pip
yum -y install epel-release
yum install python-pip
mkdir ~/.pip
cd ~/.pip
vi pip.conf
pip install --upgrade pip
pip install --upgrade setuptools
三.开始安装
1.安装virtualenv和graphviz
pip install virtualenv
pip install graphviz
2.下载yang-explorer
3.编辑setup.sh文件
将下载下来的 yang-explorer目录下的setup.sh文件如下行就行修改:
改成
4.运行yang-explorer目录下的setup.sh文件,解决报错:
①解决fatal error: Python.h: No such file or directory
处理方法:yum -y install python-devel
②解决xslt-config命令无法找到的报错
ERROR: /bin/sh: xslt-config: command not found
** make sure the development packages of libxml2 and libxslt are installed **
处理方法:yum install libxslt-devel
5.重新运行yang-explorer目录下的setup.sh文件,出现如下提示,输入y
Warning: Setting up database as root, this is not recommended. Alternatively you can re-run this script as non-root to setup database without root privilege.
Do you want to continue as root ? (n/N)y |
四.修改配置文件
1.修改start.sh文件
HOST='localhost'修改为HOST='192.168.10.141'
2.修改yang-explorer/server/static/YangExplorer.html文件
flashvars.host = window.location.hostname; 修改为 flashvars.host = '192.168.10.141';
flashvars.port = window.location.port; 修改为:flashvars.port =8088
3.运行YangExplorer
bash ./start.sh
五.安装yang包