Event Policy - Slax Event Script Call Off
Event Policy - Slax Event Script Call Off
ns junos = "http://xml.juniper.net/junos/*/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
import "../import/junos.xsl";
var $arguments = {
<argument> {
<name> "interface";
<description> "Uplink Interface to be Tracked";
}
}
param $interface;
match / {
/*
* Open connection with mgd
*/
var $con = jcs:open();
if (not($con)) {
call emit-error($message = "Not able to connect to local mgd");
}
var $ge-rpc = {
<get-configuration> {
<configuration> {
<interfaces>;
}
}
}
var $getConfig = jcs:invoke($ge-rpc);
-1-
new 5 Tuesday, August 21, 2018 5:18 PM
var $load-config-rpc = <load-configuration action = "merge" format = "xml"> {
<configuration> {
<interfaces> {
for-each ($getConfig/interfaces/interface[starts-with(name, "ge-")]) {
if (not(name == $interface)) {
<interface> {
<name> name;
<junos:comment> "/* Disabled by Event Script */";
<disable>;
}
}
}
}
}
}
-2-