delta operator
構文(Junos Snapshot Administrator - SLAX)
(item | iterate) xpath-expression {
id id;
delta xpath-expression, delta-value {
info "string";
err "string";
[err "string";]
}
構文(JSNAPy)
- (item | iterate):
xpath: xpath-expression
id: id
tests:
- delta: xpath-expression, delta-value
info: "string"
err: "string"
形容
両方のスナップショットに存在する必要がある、指定されたデータ要素の値の変化を、指定された差分と比較するJunos Snapshot Administratorテストオペレーター。デルタは、絶対、正、または負の割合、または絶対、正、または負の固定値として定義できます。
delta 演算子を使用する場合は、id パラメーターに 1 つ以上の値を含める必要があります。idを指定することで、ツールは最初のスナップショットのデータ項目を 2 番目のスナップショットの同等の項目に正しくマップし、それらを比較できます。
パラメーター
| delta-value | パーセントまたは固定値で表され、要素値の変化が比較されるデルタ値。 パーセンテージで表されます。
固定値として表されます。
|
| err string | テストケースがfalseを返したときに生成されるステートメント。 |
| id id | 最初のスナップショット データ項目を 2 番目のスナップショット データ項目にマップする一意のデータ要素を指定する、データ コンテンツに対する相対的な XPath 式。複数の要素値に基づいて一意の ID を作成するには、次のようにします。
|
| info string | テスト ケースの説明。 |
| xpath-expression | 評価する要素を選択する XPath 式。 |
使用例
次の Junos Snapshot Administrator(SLAX)テスト ケースでは、メンテナンス ウィンドウ後に BGP ルート プレフィックス数を確認します。BGP ピアが復元されたことを確認するために、コードはプレフィックス カウントで差分変化が -10% かどうかをチェックします。つまり、新しいプレフィックス数が元のプレフィックス数の 90% 未満の場合、テストはエラーを報告します。
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;
}
}
}
次のJSNAPyテストケースでは、メンテナンスウィンドウ後にBGPアクティブプレフィックス数を確認します。アクティブなプレフィックス数の変化が 20% を超えると、テストは失敗します。
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"]}}'
リリース情報
Junos Snapshot Administratorリリース1.0で導入されたOperator。