netmiko & huawei
2021-02-10 08:20
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]#
文章标题:netmiko & huawei
文章链接:http://soscw.com/index.php/essay/53491.html