Accelerated Upgrade Tool for Cisco IOS-XR

AUT是一个脚本,可以实现自动化安装IOS-XR,支持Turboboot,不过看了下AUT的介绍,暂时感觉不出用了这个脚本后会省多少功夫

https://www.youtube.com/watch?v=2DgXPi0Ink4

这个脚本不能在windows下调用,MAC,linux和类Unix系统都可以用
因为脚本用到pexpect模块,这个模块是纯的python模块,依赖pty 模块,pty模块是任何Posix系统标准库的一部分
下面是使用前的一些基本步骤,有兴趣的童鞋可以试试这个脚本

1. 下载后执行,有报错

x-mac:accelerated upgrade frank$ ./accelerated_upgrade -h
-bash: ./accelerated_upgrade: /router/bin/python: bad interpreter: No such file or directory


2. 找到python的目录

x-mac:accelerated upgrade frank$ which python
/usr/bin/python

并用vi进到accelerated_upgrade,修改正确的路径
#!/usr/bin/python

3. 再次执行,发现仍然报错,需要单独安装pexpect:

x-mac:accelerated upgrade frank$ python accelerated_upgrade -h
Traceback (most recent call last):
  File "accelerated_upgrade", line 34, in 
    import pexpect
ImportError: No module named expect

注:pexpect 模块是python的交互模块,可以实现自动化脚本,如telnet,ssh,ftp等。

4. 下载并安装,安装方法可以看文件中的install文件,写的很清楚
http://pexpect.sourceforge.net/pexpect-2.3.tar.gz

bash-3.2# cd pexpect-2.3
bash-3.2# ls
ANSI.py
INSTALL PKG-INFO
doc fdpexpect.py
pxssh.py setup.py
FSM.py
LICENSE README
examples pexpect.py
screen.py

bash-3.2# python setup.py install
running install
running build
running build_py
running install_lib
copying build/lib/ANSI.py -> /Library/Python/2.7/site-packages
copying build/lib/fdpexpect.py -> /Library/Python/2.7/site-packages
copying build/lib/FSM.py -> /Library/Python/2.7/site-packages
copying build/lib/pexpect.py -> /Library/Python/2.7/site-packages
copying build/lib/pxssh.py -> /Library/Python/2.7/site-packages
copying build/lib/screen.py -> /Library/Python/2.7/site-packages
byte-compiling /Library/Python/2.7/site-packages/ANSI.py to ANSI.pyc
byte-compiling /Library/Python/2.7/site-packages/fdpexpect.py to fdpexpect.pyc
byte-compiling /Library/Python/2.7/site-packages/FSM.py to FSM.pyc
byte-compiling /Library/Python/2.7/site-packages/pexpect.py to pexpect.pyc
byte-compiling /Library/Python/2.7/site-packages/pxssh.py to pxssh.pyc
byte-compiling /Library/Python/2.7/site-packages/screen.py to screen.pyc
running install_egg_info
Writing /Library/Python/2.7/site-packages/pexpect-2.3-py2.7.egg-info

5. 回过头来试下AUT,发现已经ok了,下面仅是一部分显示

x-mac:accelerated upgrade frank$ ./accelerated_upgrade -h
Usage: accelerated_upgrade [options]

Options:
  -h, --help            show this help message and exit
  -l LOGIN, --login=LOGIN
                        User name to login to the device. e.g.: -l admin.
  -L LOGIN2, --login2=LOGIN2
                        User name to 2nd login to the device. e.g.: -L admin.
  -p PASSWORD, --passwd=PASSWORD
                        Login password for the device. e.g.: -p passwd'.
  -P PASSWORD2, --passwd2=PASSWORD2
                        2nd Login password for the device. e.g.: -P passwd'.
  -T 'NAME', --tunnel='NAME'
                        List of inetremediate serevers to reach the device.
                        e.g.: -T server-1,server-2

6. ok,找台设备试下脚本就可以了

0
你可以留言,或者trackback 从你的网站

留言哦