I use Python 3.7 and Paramiko 2.7.2. All my scripts works perfectly. However when I try to save output from a show
command on Cisco which generates more than 38000 lines, not the entire output is saved.
jhost = paramiko.SSHClient()
jhost.set_missing_host_key_policy(paramiko.AutoAddPolicy())
jhost.connect(host, username=username, password=password, timeout=40)
time.sleep(1)
remote_conn = jhost.invoke_shell()
remote_conn.send("terminal len 0\n")
time.sleep(1)
remote_conn.send("show ip eigrp topology\n")
time.sleep(40)
if remote_conn.recv_ready():
output = remote_conn.recv(999999)
with open(host +'.txt', 'a') as f1:
for line in output.decode("utf-8"):
line = line.replace('\n','')
f1.write(line)
Only around 15000 lines are saved and the file is almost 1MB.
For sure I'm dealing with a Paramiko limitation (window size) but I can't figure it out how to fix it.
Any ideas?