I reckon you are using IOS, which is a bit more tricky to automate (compared to other platforms).
Not impossible, but you’ll have a few challenges.
In addition to what @cro pointed out, I would add (some background you may be already aware of):
- IOS does not have any kind of API, so the only thing available is screen scraping. Which is as bad as it sounds like.
Yes, unfortunately that’s all we can do on this device.
Others, such as Juniper, Arista or Nexus are much more reliable from this point of view.
Even IOS-XR is slightly better, but not much.
While Kirk Byers is doing a great job here, there are quite a few problems, see for example:
- the "Socket is closed” error is caused by the device terminating the SSH session.
By default IOS drops the SSH connection if idle more than 1/2/5 minutes(?)
I don’t remember exactly the value, as I haven’t used an IOS device in a very long time
(and I hope I will never again - but perhaps I am biased).
Idle does not refer to the state of the SSH session itself,
but IOS considers the connection idle when there are no commands issued over a period of time.
Can you increase SSH idle timeout to the maximum possible?
- The pull request referenced below has been merged today, but it will be included only in the next major release,
Nitrogen - probably in a couple of months. Meantime, I have a pretty elegant solution with a runner.
but as more and more people ask, I will provide it tomorrow & I will let you know.
Cheers,
Mircea