Automation

last person joined: 4 days ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  Write Result Tree as XML to STDOUT

    Posted 07-23-2015 11:14

    Hello,

    I'm writing a fairly complicated script and need to see the result tree in XML format to make sure my elements are correct. How do I have <ouput> print to STDOUT in XML instead of it just printing the values in the tree? Is there another function that I should be using instead?

     

    Thanks!

     

    Mark



  • 2.  RE: Write Result Tree as XML to STDOUT
    Best Answer

    Posted 07-23-2015 11:37

    If I understand what you’re askcing why not just use “copy-of” to express your nodeset in the code.    

    e.g.

    var $results = somefunc();

    copy-of $results;

     

    Then when you run the script pipe it through “|display xml”.   (I'm assuming this is on a Junos device, not juise on a host.)

     

    Or did I misinterpret the question?

    /doug  

     



  • 3.  RE: Write Result Tree as XML to STDOUT

    Posted 07-23-2015 11:49

    Thanks for the suggestion, Doug! Yes, I'm running this on a Junos device. Though I'm running it as an op script and it requires user input during its execution. | display xml seems to inhibit its ability to accept user input and the script hangs.  Any other suggestions?

     

    Thanks!

    -M



  • 4.  RE: Write Result Tree as XML to STDOUT

    Posted 07-23-2015 12:32

    I've alter the code to bypass the user input. It provides exactly what I'm looking for. Thanks for the tip!

     

    Regards,

    Mark