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