Setting up Juniper junos command aliases

At command prompt, create the file:

root@lab-SRX% vi /var/db/scripts/op/sit.slax

version 1.0;
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 / {
         {

                var $cmd =  'show interfaces terse';
                var $out = jcs:invoke($cmd);
                copy-of ($out);
        }
}

Edit configuration to activate the script:

set system scripts op file sit.slax

Run the alias at CLI:

root@lab-SRX> op sit
<< output of show interfaces terse >>

See more Juniper automation at:
http://forums.juniper.net/jnet/attachments/jnet/Day1Books/6/7/This%20Week%20Applying%20Junos%20Automation_update.pdf

This entry was posted in Networking. Bookmark the permalink.