Automation

last person joined: 4 days ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  XML API vs.

    Posted 05-31-2013 10:26
    For operational commands that map to an API elements, is there any advantage to using the API instead of the command element in a SLAX op script? Jeff L.
    #Slax


  • 2.  RE: XML API vs.
    Best Answer

    Posted 07-09-2013 18:00

    Using the RPC gives you some protection against ambiguities and future CLI changes. If you say:

     

    param $target;

    var $command = <command> "ping " _ $target;

     

    and someone runs your script as "op foo target wait" then you'll get a parse error, since "wait" is a valid CLI token.  But if you said:

     

    var $command = <ping> {

        <host> $target;

    }

     

    then there's no parse issue regardless of your argument.  In most cases, this is a fairly minor issue, but the "belt and suspenders" part of me always wants to avoid errors, so the rigidity of the specific RPC wins over the flexibility of <command> RPC in most of my scripts.

     

    Thanks,

     Phil

     



  • 3.  RE: XML API vs.

    Posted 07-10-2013 04:35

    Phil,

     

    The potential for parsing errors with command line arguments never occured to me. I'll use the RPC.

     

    Thanks for the detailed answer.


    Jeff L.