Fetching JUNOS config as xml

If you want to fetch a junos device config remotely first configure netconf on the device via;

Then connect to the junos device (IP via an ssh client from a linux host and redirect the output
to a file which is the xml config of the device indeed:

Once you enter your password you won’t see any output from junos. Just paste the RPC
command and press enter and after a while depending on the config side you will see the xml config /tmp/junos_config.xml

3 thoughts on “Fetching JUNOS config as xml

  1. shabbir1282@gmail.com

    I’m learning netconf these days and went through many sites, ncclient i found but that only lets me edit configurations i dont know how to run different operations (show) commands, get system uptime etc, i saw one dispatch method but it only runs one command that is written in example of the ncclient. ncclient doesnt have good documentation i tried to contact the codder but hes not replying.

    Q.1 which framework is good to access?
    Q.2 where do i find a file where all the xml commmand’s supported are written with syntax, e.g. , same as an MIB for SNMP.

    1. rtoodtoo Post author

      I think ruby is doing a better job when it comes to junos interaction. You can follow Jeremy on this page http://workflowsherpas.com/2013/02/06/quickstart-with-ruby/
      for xml commands there is a reference in which you can find every xml equivalent. Your keywords to search in google are “Junos XML API operational reference” and “Junos XML API Configuration reference”, they will take you to the right page.
      I hope this helps a bit.


      1. shabbir1282@gmail.com

        thank you very much for your reply, and i must say OMG i will have to learn ruby now … I can’t i have moved to python with a force, before this i was using perl and php. but thats it now i wont waste my time on learning languages theres lot more productive things to learn and get benefit out of that … 😛 hehehe

        I shall be happier to use paramiko besides ncclient and many others … thanks for your reply Sir.

        thanks for the XML API details.


You have a feedback?