Skip to end of metadata
Go to start of metadata
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:
set system scripts op file jlk_ping.slax
root@QFX5110-2> file show /var/db/scripts/op/jlk_ping.slax
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";
}
}
|
root@QFX5110-2> show configuration routing-instances
vrouter1 {
instance-type virtual-router;
interface ge-0/0/2.0;
}
vrouter2 {
instance-type virtual-router;
interface ge-0/0/10.0;
}
root@QFX5110-2> show configuration interfaces
ge-0/0/2 {
unit 0 {
family inet {
address 12.12.0.1/30;
}
}
}
ge-0/0/10 {
unit 0 {
family inet {
address 12.12.0.2/30;
}
}
}
set interfaces ge-0/0/2 unit 0 family inet address 12.12.0.1/30
set interfaces ge-0/0/10 unit 0 family inet address 12.12.0.2/30
set routing-instances vrouter1 instance-type virtual-router
set routing-instances vrouter1 interface ge-0/0/2.0
set routing-instances vrouter2 instance-type virtual-router
set routing-instances vrouter2 interface ge-0/0/10.0
|
---|