Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Example: Creating the Junos Snapshot Administrator Configuration File

 

This example creates a basic sample Junos Snapshot Administrator configuration file.

Requirements

  • Junos Snapshot Administrator Release 1.0 is installed on the server.

Overview

This example creates a Junos Snapshot Administrator configuration file with one test section named re0-master. The re0-master test section retrieves and parses the XML output from the Junos OS operational mode command show chassis routing-engine. A sample of the XML output from a dual Routing Engine device is shown here:

For a dual Routing Engine device, the test case checks the XML output to determine if the Routing Engine in slot 0 is the primary Routing Engine. The test section uses the item route-engine[slot = '0'] expression to select the route-engine element that has the child element slot value of "0". The test case uses the is-equal test operator to compare the value of the mastership-state child element with the string value "master". If the test case returns true, the Routing Engine in slot 0 is the primary Routing Engine. If the test case returns false, the code reports two error statements.

The mandatory do section includes the names of all test sections that should be executed when Junos Snapshot Administrator references this configuration file. For this example, the do section contains only re0-master.

Configuration

The Junos Snapshot Administrator configuration consists of a mandatory do section and one or more test sections.

Configuring Test Sections

Step-by-Step Procedure

The Junos Snapshot Administrator configuration consists of test sections that define the commands and evaluation criteria that are used in a snapshot or snapshot comparison. To configure a test section:

  1. Name the test section using a unique and descriptive string.
  2. Add the command statement, and specify the Junos OS operational mode command that the code executes to retrieve the desired XML data.
  3. Add the iterate or item statement followed by the XPath expression that selects the desired elements.
  4. If the test section compares elements from two snapshots, add the id statement specifying a unique ID to map the first snapshot data item to the second snapshot data element.

    This example does not require an id statement.

  5. Create the test case condition used during the check.
  6. Within the test case code block, add the info statement describing the test case or normal operating conditions.
  7. Within the test case code block, add one or more err statements, which are executed if the test case fails.

Configuring the "do" Section

Step-by-Step Procedure

The Junos Snapshot Administrator configuration file must begin with a do code block that defines the test sections to be used in the snapshot.

  1. At the beginning of the configuration file, add the do code block.
  2. Add the name of each test section that will be used in the snapshot.

Results