from netmiko import ConnectHandler
from datetime import datetime
JTN_CORE={"device_type":"cisco_ios","ip":"172.16.5.254","username":"test","password":"#"}
JTS_CORE={"device_type":"cisco_ios","ip":"172.16.4.254","username":"test","password":""}
start_time=datetime.now()
time=str(start_time)
all_devices=[JTN_CORE,JTS_CORE]
all_devices_filename=["JTN_CORE"+time,"JTS_CORE"+time,]
i=0
for a_device in all_devices:
net_connect=ConnectHandler(**a_device)
showrun=str(net_connect.send_command("show run"))
file=all_devices_filename[i]
i=i+1
f=open(file,'w')
f.write(showrun)
f.close
end_time=datetime.now()
total_time=end_time-start_time
print total_time 以上就是使用python自动获取cisco配置信息的详细内容,更多请关注Gxl网其它相关文章!
查看更多关于使用python自动获取cisco配置信息的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did85686