Friday, March 6, 2020

How do I execute commands in netmiko in the dumbest possible way?

hello, how can I do something like this:

#!/usr/bin/env python from netmiko import Netmiko from getpass import getpass device1 = { "host": "x.x.x.x", "username": "user", "password": "pass", "device_type": "device", } net_connect = Netmiko(**device1) command = "conf t" command2 = "exit" print() print(net_connect.find_prompt()) output = net_connect.send_command(command) print(net_connect.find_prompt()) output = net_connect.send_command(command2) net_connect.disconnect() print(output) print() 

I have tried this but it seems to get into a loop. As you see I would prefer it to be done in a dumb sequential way.



No comments:

Post a Comment