Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Understanding Junos Snapshot Administrator in Python Test Operators

Junos Snapshot Administrator in Python (jsnapy) enables you to capture and audit runtime environment snapshots of your networked devices running Junos OS. The jsnapy configuration file defines the scope of a snapshot and specifies the test files to use for either a single snapshot or a comparison of two snapshots. The --snapcheck option takes a single snapshot and evaluates the results, and the --check option compares the results of two separate snapshots. Within the test file, you specify the commands to be run on the Junos device, the XPath from which to start, an optional id value, and the tests to run against the command output. The test cases use test operators to either evaluate data elements in a single snapshot or compare data elements in two separate snapshots.

Jsnapy provides numerous relational operators that test for existence, equality, inequality, size, and inclusion in or exclusion from a specific range or list. Specific operators work with different operand types including strings, numbers, and XML elements. You should construct test cases using test operators that pertain to the type of check being performed. For a list of available operators, see Junos Snapshot Administrator in Python Test Operators Summary.

Junos Snapshot Administrator in Python uses a few test operators, delta, list-no-less, list-no-more, and no-diff, to compare elements or element values in two separate snapshots. Test cases using these test operators are executed when you use the --check option. When you use the --snapcheck option, which is specific to a single collection, test cases using these test operators are effectively ignored. Junos Snapshot Administrator in Python outputs a message when a test case is ignored, as shown in the following sample output: