Hi, I've got the following script which stops at the --More-- prompt and will not progress past. The script will work with smaller commands like show arp, but anything longer it just stops and waits. In the session_log.txt every command I try stops at the --More-- prompt.
from netmiko import ConnectHandler
switches = {
'device_type': 'cisco_ios',
'host': '10.1.1.30',
'username': 'username',
'password': 'password',
'secret': 'secret',
'session_log': 'session_log.txt',
}
net_connect = ConnectHandler(**switches)
net_connect.enable()
output = net_connect.send_command("show run")
print(output)
net_connect.disconnect()
Pretty old(slow) switch by any chance? Your script works nicely against a 3560CX I've got handy here at home. Can you try ramping the delay factor up to see if that helps?
output = net_connect.send_command("show run", delay_factor=2)
You can read more about that here
It's a newer 2960X, so definitely not old. I tried adding the delay_factor and it's the exact same problem, session_log.txt stops at --More-- prompt. Here's the contents of the session_log.txt:
Switch>
Switch>enable
Password:
Switch#
Switch#
Switch#show run
Building configuration...
Current configuration : 8911 bytes
!
! Last configuration change at 03:37:35 MDT Tue Mar 26 2019 by user
! NVRAM config last updated at 03:37:36 MDT Tue Mar 26 2019 by user
!
version 15.2
no service pad
service tcp-keepalives-in
service timestamps debug datetime msec localtime
service timestamps log datetime msec localtime
service password-encryption
service sequence-numbers
no service dhcp
!
hostname Switch
!
boot-start-marker
boot-end-marker
!
logging buffered 32768 informational
no logging console
enable secret 5 1$YIN$nA0iwmJKvje3eiSmoem$22dLO$l
--More--
Once the script hits the --More-- and waits for a few seconds, it writes the session_log.txt and just hangs.
The --More-- shouldn't be in the output as Netmiko executes terminal length 0 at login. Can you login manually using the same exact account you are using in your script and then execute terminal length 0?
Does your AAA/TACACS+ allow this to be executed for that user?
Kirk
Also is there anything else in the session_log.txt before what you posted as multiple other items should be in the log before that.
Kirk
Thank you very much, this is a new environment I'm working in and it looks like they set a privilege level of 0 on the vty lines. I changed it to 1 to allow the user to run terminal length 0 upon logging in (before entering privileged exec mode) and it works great.
I apologize for the rookie question but I appreciate your time. Thanks again.
Most helpful comment
The
--More--shouldn't be in the output as Netmiko executesterminal length 0at login. Can you login manually using the same exact account you are using in your script and then executeterminal length 0?Does your AAA/TACACS+ allow this to be executed for that user?
Kirk