When you work with Netconf, sometimes you could face the issue “resource denied: Sync is in progress” This error can be solved by locking & unlocking the config for each call. Read on to see how you can do this in Python & Go.
What is Netconf?
Netconf, or Network Configuration Protocol, is a powerful network management protocol developed by the Internet Engineering Task Force (IETF). With its ability to manipulate and control device configuration data using XML-based data encoding, it surpasses traditional CLI-based configurations in terms of scalability, programmability, and precision.
It leverages a RPC-like mechanism for communication between clients and servers, and supports various operations like ‘get’, ’edit-config’, ‘copy-config’, ‘delete-config’, etc., providing a comprehensive set of tools for network configuration tasks.
Moreover, it’s well-suited for managing devices in large-scale networks as it can easily handle bulk configurations and changes. Using Netconf can also greatly minimize the risk of network configuration errors, thanks to its transaction-oriented configuration changes that allow for atomic commit and rollback of configuration changes. If you’re striving for enhanced network automation, programmability, and error-free configuration management, utilizing Netconf is a must.
When can you face the “resource denied: Sync is in progress” error?
When you do multiple config changes in short succession, you can run into the “resource denied: Sync is in progress” error. This will happen because the configuration store is still syncing and not ready for another configuration change.
Example full error
|
|
How to solve it?
The proper way to solve this issue, or to be more specific, to ensure to never run into it, is always to lock & unlock the datastore. Before & after each RPC Call, you should lock and unlock your datastore.
Python Example
If you are using python and the ncclient library you can simple use the following code
|
|
Go Example
If you are using Go and the Juniper Netconf Library then you have to implement the locking & unlocking yourself.
This is a basic example, but should help to point you into the right direct.
|
|
Additional Information
- This issue was also discussed in the Cisco Community
- Go code by Matthias