Skip to content
This repository was archived by the owner on Nov 28, 2024. It is now read-only.
This repository was archived by the owner on Nov 28, 2024. It is now read-only.

Paramiko Timeout issue #73

Description

@WindfuryARS

I got a problem regarding "paramiko.buffered_pipe.PipeTimeout". My script could have expected output while I'm executing it on my MAC

from netmiko import ConnectHandler
from datetime import datetime
import time
import getpass


def getPTPstate(username,pw):
    cisco = {
        'device_type': 'cisco_nxos',
        'host': "10.122.164.139",
        'username': username,
        'password': pw
    }
    all_device = [cisco]
    
    for i in all_device:
        net_connect = ConnectHandler(**i)
        output1 = net_connect.send_command("show ptp clock | in Identity | awk  '{print $4}'").strip("\n")
        output2 = net_connect.send_command('show switchname').replace(" ","").strip()
        print(output2 + "'s PTP GM is " + output1)


getPTPstate("admin","cisco!123")

$ python3 /Users/hancai/Desktop/ptplogin.py
F340.09.16-93180YC-FX-CD1_N93-1's PTP GM is 00:de:fb:ff:fe:fa:47:87

Somehow, it would return incorrect output if I was running same script in another server. I suppose there is performance issue in server, do we have any way to extend Timeout value?

$ python3 ptplogin.py
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/paramiko/channel.py", line 699, in recv
out = self.in_buffer.read(nbytes, self.timeout)
File "/usr/local/lib/python3.7/site-packages/paramiko/buffered_pipe.py", line 164, in read
raise PipeTimeout()
paramiko.buffered_pipe.PipeTimeout

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/netmiko/base_connection.py", line 541, in _read_channel_expect
new_data = self.remote_conn.recv(MAX_BUFFER)
File "/usr/local/lib/python3.7/site-packages/paramiko/channel.py", line 701, in recv
raise socket.timeout()
socket.timeout

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "ptplogin.py", line 24, in
getPTPstate("admin","cisco!123")
File "ptplogin.py", line 19, in getPTPstate
output1 = net_connect.send_command("show ptp clock | in Identity | awk '{print $4}'").strip("\n")
File "/usr/local/lib/python3.7/site-packages/netmiko/base_connection.py", line 1366, in send_command
new_data = self.read_until_pattern(pattern=re.escape(cmd))
File "/usr/local/lib/python3.7/site-packages/netmiko/base_connection.py", line 618, in read_until_pattern
return self._read_channel_expect(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/netmiko/base_connection.py", line 552, in _read_channel_expect
"Timed-out reading channel, data not available."
netmiko.ssh_exception.NetmikoTimeoutException: Timed-out reading channel, data not available.

``

``

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions