Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

ignore-null Flag

Syntax

Description

The JSNAPy ignore-null: True flag instructs the tool to skip tests where nodes for any of the specified XPaths for the test are absent in the snapshot output. If you instead omit ignore-null and a node is absent, the test fails with an error message that the node is not found.

You can use the ignore-null flag with both check and snapcheck operations. In the test file, you can apply the ignore-null flag at two levels. You can include the global ignore-null flag to apply the flag to all test cases within a given tests: section. You can also include the ignore-null flag for individual test cases.

Parameters

ignore-null

Set to True to skip tests where the nodes for any of the specified XPaths in the test are absent in the snapshot output.

Usage Examples

The following JSNAPy test parses show chassis fpc command output. The tests check that the cpu-total value is less than 8 and the beta-cpu-total value is greater than 2. In this example, the beta-cpu-total element does not exist in the output. By setting ignore-null to True, JSNAPy skips the test case when the node is absent instead of reporting an error.

The following example is identical to the previous example except that it applies the ignore-null flag to only the is-gt test instead of both tests.

Sample Output

Output with ignore-null: True

When you include ignore-null: True, JSNAPy skips the test when the node is not found. In the following output, JSNAPy skips the is-gt test because the beta-cpu-total node is absent.

If you include the -v command option to set the verbosity to include debug messages, the output includes the SKIPPING!! Node message for the is-gt test.

Output with ignore-null Flag Omitted

If you omit the ignore-null: True flag and a node is absent, then the test case fails and generates an error for the absent node.

Release Information

Flag introduced in Junos Snapshot Administrator in Python Release 1.1.0.