from netmiko import *
import os
import time
net_connect = ConnectHandler(device_type='hp_comware',host='1.1.0.1', username='h3c',password='xxxx') #链接交换机
file_obj = open('vlanlist.txt')
all_lines = file_obj.readlines()
for line in all_lines:
cmd = "int"+' '+line
config_commands = [cmd, 'undo ip policy-based-route','ip policy-based-route Internet']
cmds_print = net_connect.send_config_set(config_commands)
print(cmds_print)
time.sleep(1)
file_obj.close()