delta operator
Syntax (Junos Snapshot Administrator - SLAX)
(item | iterate) xpath-expression {
id id;
delta xpath-expression, delta-value {
info "string";
err "string";
[err "string";]
}Syntax (JSNAPy)
- (item | iterate):
xpath: xpath-expression
id: id
tests:
- delta: xpath-expression, delta-value
info: "string"
err: "string"Description
Junos Snapshot Administrator test operator that compares the change in value of a specified data element, which must be present in both snapshots, to a specified delta. You can define the delta as an absolute, positive, or negative percentage, or as an absolute, positive, or negative fixed value.
When you use the delta operator, you must include the
id parameter with one or more values. By providing an
id, the tool can correctly map the data item in the first snapshot
to the equivalent item in the second snapshot and compare them.
Parameters
| delta-value |
Delta value expressed as a percentage or fixed value and against which the change in the element value is compared. Expressed as a percentage:
Expressed as a fixed value:
|
| err string |
Statement generated when the test case returns false. |
| id id |
XPath expression relative to the data content that specifies a unique data element that maps the first snapshot data item to the second snapshot data item. To create a unique ID based on multiple element values:
|
| info string |
Description of the test case. |
| xpath-expression |
XPath expression selecting the elements to evaluate. |
Usage Examples
The following Junos Snapshot Administrator (SLAX) test cases check the BGP route prefix count after a maintenance window. To ensure that the BGP peers were restored, the code checks the prefix counts for a delta change of -10%. That is, if the new prefix count is less than 90% of the original prefix count, the test reports an error.
bgp-checks {
command show bgp summary;
iterate bgp-rib {
id name;
delta total-prefix-count, -10% {
info BGP total prefix count should not change by more than -10%;
err " BGP rib: %s total prefix count has exceeded threshold", name;
err " pre-check: %s, post-check: %s", $PRE/total-prefix-count, $POST/total-prefix-count;
}
delta active-prefix-count, -10% {
info BGP active prefix count should not change by more than -10%;
err " BGP rib: %s total prefix count has exceeded threshold", name;
err " pre-check: %s, post-check: %s", $PRE/active-prefix-count, $POST/active-prefix-count;
}
}
}
The following JSNAPy test case checks the BGP active prefix count after a maintenance window. If the active prefix count changes by more than 20 percent, the test fails.
bgp-summary:
- command: show bgp summary
- iterate:
xpath: '/bgp-information/bgp-peer/bgp-rib'
id: name, ../peer-address
tests:
- delta: active-prefix-count, 20%
err: ' ERROR: The number of active prefixes in the BGP table has changed more than 20%. name: {{id_0}} and peer-address: {{id_1}} [Before = {{pre["active-prefix-count"]}} / After = {{post["active-prefix-count"]}}]'
info: 'Checking BGP peer active prefix count (tolerance 20%) name is <{{id_0}}> and peer-address: {{id_1}} pre: {{pre["active-prefix-count"]}} post:{{post["active-prefix-count"]}}'Release Information
Operator introduced in Junos Snapshot Administrator Release 1.0.