is-in operator
Syntax
is-in xpath-expression, string-list { info string; err "string"; [err "string"]; }
Description
Junos Snapshot Administrator test operator that determines if an XML element string value is included in the specified list of string values.
Parameters
err string | Statement generated when the test case returns false. |
info string | Description of the test case. |
string-list | Comma-separated list of strings against which to compare the XML element value for inclusion. Enclose each string in quotation marks. |
xpath-expression | XPath expression selecting the elements to evaluate. |
Usage Examples
Given the following XML output from the show rsvp
session
operational mode command:
<rsvp-session-data> <session-type>Ingress</session-type> <count>3</count> <rsvp-session junos:style="brief"> <destination-address>10.255.20.137</destination-address> <source-address>10.255.20.167</source-address> <lsp-state>Dn</lsp-state> <route-count>0</route-count> <rsb-count>0</rsb-count> <resv-style>-</resv-style> <label-in>-</label-in> <label-out>-</label-out> <name>test</name> </rsvp-session> ...
The following test case checks if the RSVP session lsp-state
has a value of either Up
or NotInService
. If the lsp-state
value is not in the specified string list,
the code reports an error.
rsvp-checks { command show rsvp session; iterate rsvp-session-data/rsvp-session { is-in lsp-state, "Up", "NotInService" { info RSVP LSP state is [Up | NotInService]; err " RSVP session to %s has LSP state %s.", destination-address, lsp-state; } } }
Release Information
Operator introduced in Junos Snapshot Administrator Release 1.0.