Can i genarate c code from my own yang file using any confd utility. For example with lnc-tool in libnetconf i can auto genarate c code

Can i genarate c code from my own yang file using any confd utility. For example with lnc-tool in libnetconf i can auto genarate c code.

The short answer is no.

What we have in ConfD is a programmatic model and not a code generation model. The need for code generation is low in the case of ConfD’s model driven approach. The auto-generated code portion as provided by some of the frameworks in the market are already being provided by ConfD in its core engine. What ConfD provides you is the ability to write your instrumentation code at both a fine grained and coarse grained level, or a mix of both in the same application clients. This makes it extremely flexible for your configuration subscription code to receive its updates. This isn’t something that is being supported by those frameworks that come with the auto code generation feature. ConfD can even generate Cisco style CLI commands as part of the subscription updates to integrate with legacy CLI based solutions.

In addition, the automatic skeleton code generation feature that is being provided by some other frameworks is only useful for your initial data model. You end up having to do a lot of manual code merges when changes are being introduced in your data model down the road. We have found this approach to be rather limiting and time consuming when dealing with data model updates and changes.

Thanks waitai for your response. I want to correlate confd with libnetconf known
scenario for me, the libnetconf transAPi module does this

data model->TransAPI generator->*.c code templates->device module

suppose in my data model i have a configurable attribute: leaf admin-state and with TransAPI generator i will get a C callback for this attribute where i can hook my SDK of device module. Does this functionality confd provides or i need to write code to hook SDK APIs.

Can you describe your use case at a high level? How do you plan on using ConfD along with libnetconf?

My use case using libnetconf: Using lnc tool auto generate C callbacks,hook SDK APIs at respective calllback, compile and get libnetconf.so, load with netopeer-manger so that netopper-cli and netopeer-server are intact. From netopeer-cli i will configure port admin state so that the respective call back will be triggred and configs happens with SDK APIs at this call back. I am not planning Confd along with libnetconf. Till now i have used libnetconf and now started with Confd basic version.

Thanks in Advance.

In the case of ConfD, you will need to write code to integrate with your backend code. However, you can use code from our extensive example set as a starting point. You can then modify as necessary.

The best way to learn ConfD is to work with the examples. Once you learn the examples, you can replace the YANG models in the examples with your own and modify the code accordingly to integrate with your backend code. You will soon discover the rich set of capabilities and flexibility of working with ConfD.