Blog Viewer

Scripting How-To: Converting a Junos XML Configuration to a Junos OS CLI Configuration

By Erdem posted 03-30-2016 14:21

  

You could craft a template that makes a best-effort conversion from a Junos XML configuration to a Junos OS CLI configuration as shown in the following example:


From:

 

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

To:

 

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


Alternatively, you could load the Junos XML configuration into a device running Junos OS and pull out the Junos OS CLI configuration. Other configuration schemas might be available but they may not give you what you are looking for.

 

Note: Junos OS does not use XSLT to convert a Junos XML configuration into a Junos OS CLI configuration, and the processing that it does use (which is proprietary) is not exposed outside of the source code.


#JUNOS
#cli
#ScriptingHow-To
#xml
#How-To

Permalink