'Netmiko "Timed-out reading channel, data not available." for Juniper
I am using netmiko ConnectionHandler to push simple config to a Juniper device. But not sure why its throwing "Timed-out reading channel, data not available." this error. Here is the exact command im using, can someone please help me understand what am i doing wrong?
device = ConnectHandler(device_type="juniper",
host="ip_of_device",
username=username,
password=passwd,
session_timeout=120,
verbose=True)
cmdlist = ['routing-instances {', ' SERVICES {', ' instance-type vrf;', ' no-vrf-advertise;', ' vrf-table-label;', ' }', '}', '']
device.send_config_set(cmdlist, exit_config_mode=False)
Solution 1:[1]
I have faced with the similar error. When I have checked the configuration of the device through CLI, I have seen that the configuration I sent via Netmiko was already configured in network device. So that, I chose to avoid this error using try-except method and mark the devices into a box where the issue is seen. If it is the case, you can also proceed it accordingly. See a sample config:
from netmiko.ssh_exception import NetMikoTimeoutException
for ip in ip_list:
<snipped>
try:
net_connect.send_config_set(cmdlist)
except (NetMikoTimeoutException):
print("The device is faulty:" + ip)
continue
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Baris Ozensel |