Is it possible to convert YAML file into a YANG file?

Is there any possibility to convert a YAML based file into a YANG file???
Any code or convertor or tool?

Thanks,
Tush

I’m not aware of any direct YAML to YANG translation tools but you could do it in two steps via XML. You can use pyang to translate from XML to YANG and there are several tools you can use to translate from YAML to XML.

I don’t know how successful this will be, though I’m not enough of an YAML expert to say for sure but I suspect you’ll run into to incompatibilities along the way.

But pyang can convert Yang into yin (Xml based)…but not vice versa I guess.

-f FORMAT, --format=FORMAT
Convert to FORMAT. Supported formats are: tree,
sample-xml-skeleton, yin, depend, jtox, yang, jnc,
jsonxsl, jstree, dsdl, name, uml, omni, capability\

Thanks,
Tush

The input to pyang can be either YANG or YIN - pass in the XML-file and select YANG as output.