

下载后主要有3个文件:
Systems.py 定义了一些不同设备的操作系统及其常见命令。
Connectivity.py 是主要实现功能的代码,其实主要就是使用了python的pexpect模块。
Driver.py是一个示例文件。
[root@safe tratto-master]# cat driver.py
#!/usr/bin/env python
import Connectivity
import Systems
#telnet to a cisco switch
m = Systems.OperatingSystems['IOS']
s = Connectivity.Session("192.168.1.1",23,"telnet",m)
s.login("yourusername", "yourpassword")
# if your need to issue an "enable" command
s.escalateprivileges('yourenablepassword')
s.sendcommand("show clock")
s.sendcommand("show run")
s.logout()
