Ich habe diesen Code mit Cisco 2960x Switch ausgeführt. < /p>
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!")
< /code>
Aber nachdem ich einen Fehler unterliegt. < /p>
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!
< /code>
Bitte überprüfen Sie unten bei netmiko_Session.log < /p>
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)#
< /code>
Ich habe Switch -Hostname umbenannt. Aber auch der gleiche Fehler.
Netmiko -Muster nicht erkannt ⇐ Python
-
- Similar Topics
- Replies
- Views
- Last post