u/ParticularAward9704

Netmiko - Stop telnet in Cisco XE after N seconds

I am building a solution which checks port reachability for multiple dns/apps from a source device. So, the solution first logs in to the device and then run telnet to dest host:port. And at a time one can check X number or device:port combination from the source device. The problem I am facing is:

For some DNS the telnet is hard to stop. I want to wait only for 5 seconds if its reachable or not. What I did is I used send_command_timing() with 5 seconds timeout and its working fine. But as soon as I am giving it another telnet its giving

read_channel_timing's absolute timer expired. The network device was continually outputting data for longer than 3 seconds .....

Manually after 4-5 ENTERs it stops. So I decided to do conn.write_channel("\n") 5 times after running telnet. But still no luck.

If you know how to solve this issue, please tell. Last option I will have is after each telnet close the connection and then again reconnect ( but I don't want to go this way ).

reddit.com
u/ParticularAward9704 — 10 days ago