all-same operator
语法
all-same xpath-expression, [ [reference-item] ] {
info string;
err "string";
[err "string";]
}
描述
Junos 快照管理器测试操作员,用于检查指定元素的所有内容值是否相同。如果包括可选引用项,操作员将检查指定元素的所有内容值是否与引用项的内容值相同。
参数
| err string | 测试用例返回 false 时生成的语句。 |
| info string | 测试用例的说明。 |
| reference-item | (可选)XPath 表达式,指定引用元素,所有其他元素值都与该元素值进行比较。 |
| xpath-expression | 选择要计算的元素的 XPath 表达式。 |
使用示例
以下示例代码检查所有 OSPF 邻接方是否具有相同的优先级值。如果任何优先级值不同,代码将生成错误消息。
ospf-check {
command show ospf neighbor;
iterate ospf-neighbor {
all-same neighbor-priority {
info OSPF neighbors must have the same priority value;
err "OSPF interface %s has mismatch priority %s", interface-name, neighbor-priority;
}
}
}
以下示例代码检查所有 OSPF 邻接方的优先级值是否与接口 ae19.0 的优先级值相同。如果任何优先级值与参考接口的优先级值不同,代码将生成错误消息。
ospf-check {
command show ospf neighbor;
iterate ospf-neighbor {
all-same neighbor-priority, [interface-name = 'ae19.0'] {
info OSPF neighbors must have the same priority value as ae19;
err "OSPF interface %s has mismatch priority %s", interface-name, neighbor-priority;
}
}
}
发布信息
Junos 快照管理员 1.0 版中引入的运算符。