简体   繁体   中英

How to reboot the cisco switch with Netmiko SSH (Python)?

from netmiko import ConnectHandler

cisco = {
'device_type': 'cisco_ios',
'ip': ip,
'username': username,
'password': password,
}

net_connect = ConnectHandler(**cisco)
net_connect.send_command('wr')
net_connect.send_command('reload')

CLI on cisco switch after issuing 'reload' command, outputs - "Proceed with reload? [confirm]"

I know I have to handle this output, but I don't know how. Please help!

net_connect.send_command('reload', expect_string='confirm')
net_connect.send_command('\n')

I find the solution, but I'm not sure if this is the right way

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM