Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

1- create or copy the create in:     /var/db/scripts/op/jlk_ping.slax

2- config:  "set system scripts op file jlk_ping.slax"

3- run the script:  


Code Block
titlejlk_ping.slax
collapsetrue
version 1.0;

/* 
 * ping an ip addr
 * 
 * op jlk_ping.slax
 */

ns junos = "http://xml.juniper.net/junos/*/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";

import "../import/junos.xsl";


match / 
{
    <op-script-results> 
    {
        /* execute the 'ping' command and store the result */
        var $query = { <command> 'ping 12.12.0.2 routing-instance vrouter1 count 10'; }
        var $result = jcs:invoke($query);              

        /* print a header */
        <output>"done";

    }
}

...