netmiko & huawei

2021-02-10 08:20

阅读:439

from netmiko import ConnectHandler
import logging
logging.basicConfig(filename="test.log", level=logging.DEBUG)
huawei = {‘device_type‘: ‘huawei‘, ‘ip‘: ‘10.10.30.253‘, ‘username‘: ‘root@default‘, ‘password‘: ‘Admin123_.‘,‘port‘: 22}
#huawei = {‘device_type‘: ‘huawei_vrpv8‘, ‘ip‘: ‘10.10.30.253‘, ‘username‘: ‘root@default‘, ‘password‘: ‘Admin123_.‘,‘port‘: 22}
net_connect = ConnectHandler(**huawei)
sshConfirm = net_connect.find_prompt()
print(‘login ‘ + sshConfirm)
#current_view = net_connect.find_prompt()
#print(current_view)
commands = [‘dis arp‘]
output = net_connect.send_config_set(commands)
## not support commit
#output += net_connect.commit()
print(output)
net_connect.disconnect()
[root@bogon ironic]#


评论


亲,登录后才可以留言!