Friday, April 2, 2021

Netmiko Help - error handling or if/then statement??

Using netmiko and has worked great. Recently I've been creating larger groups of devices and combining devices of multiple L2/L3. The issue is when one of the loops hits a device that doesn't accept the command the script stops. Any help is appreciated and here is a simple example:

The script has many calling functions and how can I force the script to continue even if the return from the network device is '% Invalid input detected at '^' marker.'

table = net_connect.send_command("showcommand not exist")
for line in table:
 data = {'IP Address': [entry['address'] for entry in mac_table],
'MAC Address': [entry['mac'] for entry in mac_table],
'Interface': [entry['interface'] for entry in mac_table]
            }



No comments:

Post a Comment