Troubleshoot Junos PyEZ Errors When Configuring Junos Devices
The following sections outline errors that you might encounter when using Junos PyEZ to configure Junos devices. These sections also present potential causes and solutions for each error.
Troubleshoot Timeout Errors
Problem
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)
Cause
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.
Solution
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 Device
timeout
property to an appropriate value,
or include the timeout=seconds
argument in the commit()
or 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()
Troubleshoot Configuration Lock Errors
Problem
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)
Cause
A configuration lock error can occur for the following reasons:
Another user has an exclusive lock on the configuration.
-
The shared configuration database has uncommitted changes.
The user executing the Junos PyEZ code does not have permissions to configure the device.
Solution
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 Junos device to give the current user the necessary permissions to make the changes.
Troubleshoot Configuration Change Errors
Problem
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)
Cause
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.
Solution
Either execute the program with a user who has the necessary permissions, or if appropriate, configure the Junos device to give the current user the necessary permissions to make the changes.