Troubleshooting Junos PyEZ Errors When Configuring Devices Running Junos OS
The following sections outline errors that you might encounter when using Junos PyEZ to configure devices running Junos OS. These sections also present potential causes and solutions for each error.
Troubleshooting Timeout Errors
Description: The Junos PyEZ code generates an RpcTimeoutError message or a TimeoutExpiredError message and fails to update the device configuration.
RpcTimeoutError(host: dc1a.example.com, cmd: commit-configuration, timeout: 30)
The default time for a NETCONF RPC to time out is 30 seconds. Large configuration changes might exceed this value causing the operation to time out before the configuration can be uploaded and committed.
To accommodate configuration changes that might require
a commit time that is longer than the default timeout interval, set
the timeout interval to an appropriate value and rerun the code. To
configure the interval, either set the
timeout property to an appropriate value,
or include the
timeout=seconds argument in the
set() method when you load and commit configuration
data on a device. For example:
dev = Device(host="host") dev.open() dev.timeout = 300 with Config(dev, mode='exclusive') as cu: cu.load(path="junos-config.conf", merge=True) cu.commit(timeout=360) dev.close()
Troubleshooting Configuration Lock Errors
Description: The Junos PyEZ code generates a LockError message indicating that the configuration cannot be locked.
LockError(severity: error, bad_element: None, message: configuration database modified)
A configuration lock error can occur for the following reasons:
Another user has an exclusive lock on the configuration.
Another user made changes to the shared configuration database but has not yet committed the changes.
The user executing the Junos PyEZ code does not have permissions to configure the device.
If another user has an exclusive lock on the configuration or has modified the configuration, wait until the lock is released or the changes are committed, and execute the code again. If the cause of the issue is that the user does not have permissions to configure the device, either execute the program with a user who has the necessary permissions, or if appropriate, configure the device running Junos OS to give the current user the necessary permissions to make the changes.
Troubleshooting Configuration Change Errors
Description: The Junos PyEZ code generates a ConfigLoadError message indicating that the configuration cannot be modified due to a permissions issue.
ConfigLoadError(severity: error, bad_element: scripts, message: permission denied)
This error message might be generated when the user executing the Junos PyEZ code has permission to alter the configuration, but does not have permission to alter the desired portion of the configuration.
Either execute the program with a user who has the necessary permissions, or if appropriate, configure the device running Junos OS to give the current user the necessary permissions to make the changes.