Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Troubleshoot Junos PyEZ Connection Errors

Troubleshoot Refused Connection Errors

Problem

Description

When using Junos PyEZ to manage remote Junos devices, the code generates an error that the connection was refused. For example:

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 Junos device. 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 Junos device, 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.

Troubleshoot Junos PyEZ Connection Errors in Onbox Event Scripts

Problem

Description

When using Junos PyEZ in an onbox Python event script, the code generates a ConnectError message referencing user "nobody". For example:

Cause

To prevent the execution of unauthorized Python code, by default, Junos devices execute Python event scripts using the access privileges of the generic, unprivileged user and group nobody.

Solution

To execute event scripts using the access privileges of a specific user, you must configure the python-script-user statement for that event script and specify a user. The configured user must have a local user account on the device.

Note:

You cannot configure Python event scripts to execute with root access privileges.

For example: