netconfyang

CLI to YANG XML from local input


I have a huge cli conf file that I'd like to convert to YANG xml

....
system
 host-name hostname.com
 system-ip 8.8.8.8
 site-id 1
 organization-name "Organization name"
 sp-organization-name "Organization name"
 vbond vbond.net
 ....
!

There are utilities like netconf-console2 that will fetch the configs from a router and display them as YANG XML

netconf-console2 --host=192.168.0.2 -u admin -p PASSWORD --port 830 --get-config

I was wondering if I could use the same utility to convert the conf from a local input, something like:

netconf-console2 --file localConf.cf

Not sure if that is even possible or if there is an alternative to netconf-console2 for this.


Solution

  • There's no "YANG XML". There are YANG models (a lot of them), and you can think of sets of these YANG models as database schemas. Then there is some configuration data which is structured according to a set of some YANG models. This data can be serialized into JSON, or XML (and in future, to other formats as well). However, before you can do that, you have to know about that set of YANG models which the data corresponds to. What YANG models are you trying to use?