ktbyers / netmiko

Multi-vendor library to simplify Paramiko SSH connections to network devices
MIT License
3.6k stars 1.31k forks source link

about netmiko3.3.3 with django project #3267

Open Mic0623 opened 1 year ago

Mic0623 commented 1 year ago

dear ktbyes: when i use netmiko in view.py of my django project, there is only one cisco router have the error. My code and the oserror as follows: with ConnectHandler(**device) as conn: if dev.vendor.lower() == 'cisco': command = ['show running-config', 'show logging', 'show ip int bri', 'show version', 'show ip route', 'show ip eigrp neighbors'] for cmd in command: output = conn.sendcommand(cmd) now = datetime.now() date = f'{now.month}{now.day}_{now.year}' f = open(f'C:\configuration_backup\{dev.ipaddress}{date}_{cmd}.txt', 'w+') f.write(output) result.append(f'{dev.ip_address}backup successfully!') OSerror: search pattern never detected in send_command:QD7609_B_20 \ #

howevery this router's hostname is QD7609_B_20. when i use output = conn.send_command(cmd,expect_string=r"#") the errro changed to : OSerror: search pattern never detected in send_command:#

ktbyers commented 1 year ago

@Mic0623 It is basically saying the expected pattern never came back (or didn't come back in the time expected).

You might want to isolate which command is causing the issue (i.e. test it with single commands).

Netmiko 3.3.3 is pretty old now (over 2 years old). So you will probably need to upgrade to latest version of Netmiko to get much help from me.

Regards, Kirk