paramiko / paramiko/paramiko

Netmiko & Paramiko Tracebacks net_connect.send_config_set(lines)

Open
#1,616 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9.9k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

Hello,

Getting the below Error , trying to configure multiple switches but most the script fails after configuring only 1 switch.
And sometimes it doesn't configure at all throws the tracebacks when running the script.
Look at it looks like some timeout issue.

SW5-Access#
Traceback (most recent call last):
File "/home/auritro/.local/lib/python3.6/site-packages/paramiko/channel.py", line 699, in recv
out = self.in_buffer.read(nbytes, self.timeout)
File "/home/auritro/.local/lib/python3.6/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 "/home/auritro/.local/lib/python3.6/site-packages/netmiko/base_connection.py", line 541, in _read_channel_expect
new_data = self.remote_conn.recv(MAX_BUFFER)
File "/home/auritro/.local/lib/python3.6/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 "netmiko3.py", line 48, in
output = net_connect.send_config_set(lines)
File "/home/auritro/.local/lib/python3.6/site-packages/netmiko/base_connection.py", line 1735, in send_config_set
new_output = self.read_until_pattern(pattern=pattern)
File "/home/auritro/.local/lib/python3.6/site-packages/netmiko/base_connection.py", line 618, in read_until_pattern
return self._read_channel_expect(*args, **kwargs)
File "/home/auritro/.local/lib/python3.6/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.

Here is the script -
auritro@auritro-python:~$ cat netmiko3.py
#!/usr/bin/env python3

from netmiko import ConnectHandler

iosv_l2_s1 = {
'device_type': 'cisco_ios',
'ip': '192.168.122.71',
'username': 'auritro',
'password': 'auritro',
}

iosv_l2_s2 = {
'device_type': 'cisco_ios',
'ip': '192.168.122.72',
'username': 'auritro',
'password': 'auritro',
}

iosv_l2_s3 = {
'device_type': 'cisco_ios',
'ip': '192.168.122.73',
'username': 'auritro',
'password': 'auritro',
}

iosv_l2_s4 = {
'device_type': 'cisco_ios',
'ip': '192.168.122.74',
'username': 'auritro',
'password': 'auritro',
}

iosv_l2_s5 = {
'device_type': 'cisco_ios',
'ip': '192.168.122.75',
'username': 'auritro',
'password': 'auritro',
}

with open('iosv_l2_config') as f:
lines = f.read().splitlines()
print(lines)

all_devices = [iosv_l2_s5, iosv_l2_s4, iosv_l2_s3, iosv_l2_s2, iosv_l2_s1]

for devices in all_devices:
net_connect = ConnectHandler(**devices)
output = net_connect.send_config_set(lines)
print(output)

Kindly provide your guidance.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported netmiko3.py call to send_config_set(lines), then compare the traceback paths in paramiko/channel.py and paramiko/base_connection.py. Reproduce the timeout with the supplied multi-device script and determine whether the result identifies a Paramiko defect; a complete report would need a confirmed cause and a specific change or test target.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.