Understanding Junos Snapshot Administrator Reference Variables
Junos Snapshot Administrator provides special variables that
can be used within test case err statements
to reference a specific data element as defined by an id statement XPath expression or to reference a data
element in a specific snapshot. Available variables include:
$ID.num—Variable mapped to a specific
idstatement that can be used in place of XPath expressions in the test case.$PRE—Anchor variable that is prepended to an XPath expression and that references data elements from the first snapshot.
$POST—Anchor variable that is prepended to an XPath expression and that references data elements from the second snapshot.
In the following example, the err statements use $ID.1 to reference the connection-id element, $ID.2 to reference the ../local-site-id element,
and $ID.3 to reference the ancestor::instance/instance-name element.
vpls-list {
command show vpls connections up;
iterate instance//connection {
id connection-id;
id ../local-site-id;
id ancestor::instance/instance-name;
list-not-less {
info Check VPLS connections - all back up;
err " VPLS connection missing on service %s", $ID.3;
err " Site: %s, connection-id: %s", $ID.2, $ID.1;
err " Remote-PE: %s", remote-pe;
err " local-interface: %s", local-interface/interface-name;
}
}
}
The following example prepends the $PRE and $POST variables to neighbor-address in the test case err statements to reference
the value of the OSPF neighbor address from the first and second snapshots,
respectively.
ospf-check {
command show ospf neighbor;
iterate ospf-neighbor {
id interface-name;
no-diff neighbor-address {
info OSPF neighbor change check;
err "OSPF interface %s neighbor changed!", interface-name;
err " was going to %s, now going to %s", $PRE/neighbor-address, $POST/neighbor-address;
}
}
}