Netmiko-Muster nicht erkanntPython

Python-Programme
Anonymous
 Netmiko-Muster nicht erkannt

Post by Anonymous »

Ich habe diesen Code mit dem Cisco 2960X-Switch ausgeführt.

Code: Select all

from netmiko import ConnectHandler

network_device= {
"host": "192.168.xxx.xxx",
"username": "xxxx",
"password": "xxxx",
"device_type": "cisco_ios",
"session_log": "netmiko_session.log"
}

connect= ConnectHandler(**network_device)
connect.enable()

interface_name= "GigabitEthernet1/0/10"

def send_command(command):
return connect.send_command(command)
try:
send_command('enable')
send_command('configure terminal')
except Exception as e:
print(e)
print("Failed!")
Aber nachdem ich den folgenden Fehler erhalten habe.

Code: Select all

Pattern not detected: 'Switch\\#' in output.

Things you might try to fix this:
1. Explicitly set your pattern using the expect_string argument.
2. Increase the read_timeout to a larger value.
You can also look at the Netmiko session_log or debug log for more information.

Failed!
Bitte überprüfen Sie unten netmiko_session.log

Code: Select all

Switch#
Switch#terminal width 511
Switch#terminal length 0
Switch#
Switch#enable
Switch#
Switch#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#
Ich habe den Switch-Hostnamen umbenannt. Aber es tritt auch der gleiche Fehler auf.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post