dampen() Function (Python, SLAX, and XSLT)
命名 空间
http://xml.juniper.net/junos/commit-scripts/1.0 http://xml.libslax.org/slax
Python 语法
result = jcs.dampen(tag-string, max, interval)
SLAX 语法
var $result = prefix:dampen(tag-string, max, interval);
XSLT 语法
<xsl:variable name="result" select="prefix:dampen(tag-string, max, interval)"/>
描述
防止在脚本中重复执行同一操作。
如果对函数的调用jcs:dampen()
数超过时间间隔interval
中的调用数,max
则dampen()
函数将返回false
。否则,函数将true
返回。函数参数包括用于区分对函数的不同调用的jcs:dampen()
任意字符串。此标记存储在设备上的 /var/run 目录中。
与 prefix 命名空间 URI 关联的应在样式表的前缀到命名空间映射中定义。
参数
interval |
时间间隔,以分钟为单位。 |
max |
在函数返回 |
tag-string |
用于区分对函数的不同调用的 |
返回值
result |
基于使用给定标记且在指定时间内的 |
使用示例
在以下示例中,如果 jcs:dampen()
带有标记 “mytag1” 的函数在 10 分钟间隔内被调用不到三次,则函数将返回 true
。如果在 10 分钟内多次调用该函数,则函数将 false
返回。
if (jcs:dampen('mytag1', 3, 10)) { /* Code for situations when jcs:dampen() with */ /* the tag 'mytag1' is called less than three times */ /* within 10 minutes */ } else { /* Code for situations when jcs:dampen() with */ /* the tag 'mytag1' exceeds the three call maximum */ /* limit within 10 minutes */ }
版本信息
在 Junos OS 9.4 版中引入的功能。
支持 Junos OS 12.2 版中 http://xml.libslax.org/slax 添加的 slax 命名空间。
QFX 系列交换机和 ACX 系列、MX 系列、PTX 系列和 T 系列路由器上 Junos OS 16.1R1 版中添加了对 Python 的支持。
在 Junos OS 17.1R1 版中添加了 ACX500、ACX1000、ACX1100、ACX2000、ACX2100、ACX2200 和 ACX4000 路由器以及 EX 系列交换机的 Python 支持。
在 Junos OS 17.3R1 版本中添加了对 SRX1500、SRX4100、SRX4200、SRX5400、SRX5600 和 SRX5800 设备和 vSRX 实例的 Python 支持。
ACX5048 和 ACX5096 路由器上 Junos OS 18.3R1 版中添加了对 Python 的支持。