Automation
Automation

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

by Administrator Administrator on ‎03-30-2016 02:21 PM - edited on ‎08-23-2017 11:32 AM by Administrator Administrator (2,531 Views)

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.