Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Announcement: Try the Ask AI chatbot for answers to your technical questions about Juniper products and solutions.

close
header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
Junos PyEZ Developer Guide
Table of Contents Expand all
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

Troubleshoot Junos PyEZ Errors When Configuring Junos Devices

date_range 11-May-24

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.

content_copy zoom_out_map
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:

content_copy zoom_out_map
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.

content_copy zoom_out_map
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.

content_copy zoom_out_map
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.

footer-navigation