Automation

last person joined: 14 hours ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  Op script on MX480 - commit in private mode

    Posted 03-18-2015 03:51

    Hi all,

     

    I'm writing an op script that should make some configuration changes and commit them.

    It works fine when using jcs:load-configuration, but the problem is that it works in exclusive mode only.

     

    In production environment I would need to use private mode, because often there are multiple users making changes simultaneously.

     

    Is it possible?

     

    Thank you,

     

     

     



  • 2.  RE: Op script on MX480 - commit in private mode
    Best Answer

    Posted 03-18-2015 07:33

    Yes, you can do it yourself in private mode.  Something like this:

     

    var $connection = jcs:open();

     

    var $edit-private = <open-configuration> { <private>; }

     

    /* adding the log message is optional, but considerate */

    var $commit-config = <commit-configuration> { <log> "Changed by script: " _ $script; }

     

    var $configuration = <load-configuration> {

         <configuration> {

            /* stuff goes here */

        }

     

    /* please check/report on errors or warnings on each of $res1-4 */

    var $res1 = jcs:execute( $connection, $edit-private );    /* open private session */

    var $res2 = jcs:execute( $connection, $configuration );   /* load your config change */
    var $res3 = jcs:execute( $connection, $commit-config );  /* commit your config */
    var $res4  = jcs:execute( $connection, 'close-configuration' );  /* close up */


    expr jcs:close( $connection );    /* may not be needed if script is exiting here */


    }

     

     

     

    hope that helps

    /doug



  • 3.  RE: Op script on MX480 - commit in private mode

    Posted 03-18-2015 08:36

    Hi Doug,

     

    Thank you very much for your reply. I'll try this tomorrow and let you know if it worked for me.

     

    Cheers,

    Marcin



  • 4.  RE: Op script on MX480 - commit in private mode

    Posted 03-19-2015 07:17

    Hi Doug,

     

    I wrote my op script today and it works fine on SRX. I will test it on MX soon, but I expect should work fine as well.

     

    Thanks for your help!

     

     



  • 5.  RE: Op script on MX480 - commit in private mode

    Posted 03-19-2015 12:53

    You're quite welcome.  Glad to help!

    /doug