Junos Automation (Scripting)
Highlighted
Junos Automation (Scripting)

Convert Junos XML Configuration to CLI Statement

[ Edited ]
‎06-15-2014 12:21 PM

Hello! Is it possible to see how JUNOS convert junos xml to Junos cli ?

 

For example:

 

from such:

<protocols>
  <bgp>
    <group>
      <name>23</name>
      <import>policy1</import>
    </group>
   </bgp>
</protocols>

 to such:

protocols {
  bgp {
    group 23 {
      import policy1;
     }
    }
   }

 

I assume that JUNOS use XSLT .  Where can i see this xsl file which is superimposed on  the current xml file 

1 REPLY 1
Highlighted
Junos Automation (Scripting)
Solution
Accepted by topic author vlazarev
‎08-26-2015 01:27 AM

Re: Convert Junos XML Configuration to CLI Statement

‎06-17-2014 10:35 AM

Junos doesn't use XSLT to convert the XML configuration into the text configuration, and the processing that it does use (which I believe is proprietary) is not exposed outside of the source code.

 

You can craft a template that makes a best effort conversion like you showed in your post, or you can load it into a Junos box and pull out the text configuration. I'm not aware of any other alternative. I guess there are the config schemas as well, but I don't think that will give you what you're looking for.