Example Output
user@cli> op pingsweep remote-host waffy min-size 1400 max-size 1600 step 100
Executing command: ping waffy size 1400 count 1 do-not-fragment
Ping Success!!!
Executing command: ping waffy size 1500 count 1 do-not-frament
Ping Success!!!
Executing command: ping waffy size 1600 count 1 do-not-frament
Ping Failed!!!
SLAX Script Contents
/*
* Op script to send series of pings to remote-host, each one increasing in
* size, may be useful for troubleshooting MTU/MSS issues.
*
* Size of the packet starts from $min-size, increases by $step and
* ends at $max-size
*
* E.g
* user1@chennai> op pingsweep remote-host waffy min-size 1400 max-size 1600
* step 100
* Executing command: ping waffy size 1400 count 1 do-not-fragment
* Ping Success!!!
* Executing command: ping waffy size 1500 count 1 do-not-fragment
* Ping Failed!!!
* Executing command: ping waffy size 1600 count 1 do-not-fragment
* Ping Failed!!!
*/
version 1.1;
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";
var $arguments = {
<argument> {
<name> "remote-host";
<description> "Host name or ip-address to ping";
}
<argument> {
<name> "min-size";
<description> "Minimum packet size";
}
<argument> {
<name> "max-size";
<description> "Maximum packet size";
}
<argument> {
<name> "step";
<description> "Packet size difference";
}
}
param $remote-host;
param $min-size;
param $max-size;
param $step;
match / {
call ping($remote-host, $cur-size = $min-size, $max-size, $step);
}
template ping ($remote-host, $cur-size, $max-size, $step) {
if ($cur-size <= $max-size) {
var $ping-rpc = {
<ping> {
<host> $remote-host;
<size> $cur-size;
<count> 1;
<do-not-fragment>;
}
}
expr jcs:output("Executing command: ping ", $remote-host, " size ",
$cur-size, " count 1 do-not-fragment");
var $ping-out = jcs:invoke($ping-rpc);
if ($ping-out/ping-success) {
expr jcs:output("Ping Success!!!");
} else {
expr jcs:output("Ping Failed!!!");
}
call ping($remote-host, $cur-size = $cur-size + $step, $max-size,
$step);
}
}
XML Script Contents
<?xml version="1.0"?>
<script>
<title>op-pingsweep.slax</title>
<author>rsankar</author>
<synopsis>
Send a series of ping to remote-host, useful for troubleshooting MTU/MSS issues
</synopsis>
<coe>op</coe>
<type>diagnose</type>
<description>
This script performs pings to remote-host, which may be useful for troubleshooting MTU/MSS issues.
Size of the packet starts from $min-size, increases by $step and ends at $max-size.
</description>
<example>
<title>Sample Output</title>
<description>Output of "op pingsweep" command</description>
<output>example-1.output</output>
</example>
<xhtml:script xmlns:xhtml="http://www.w3.org/1999/xhtml"
src="../../../../../web/leaf.js"
type="text/javascript"/>
</script>