Troubleshooting Junos PyEZ Connection Errors
Problem
Description:
When using Junos PyEZ to manage devices running Junos OS, the code generates an error that the connection was refused. For example:
jnpr.junos.exception.ConnectRefusedError
Cause
NETCONF is not enabled on the device or the number of connections exceeds the limit.
The most likely cause for a refused connection error is that NETCONF over SSH is not enabled on the device running Junos OS. To quickly test whether NETCONF is enabled, verify that the user account can successfully start a NETCONF session with the device.
Solution
If NETCONF is not enabled on the device running Junos OS, enable NETCONF.
If the number of NETCONF sessions exceeds the limit, increase the maximum number of permitted sessions up to 250. The default is 75.