-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathchassis-beacon.slax
More file actions
63 lines (59 loc) · 1.58 KB
/
Copy pathchassis-beacon.slax
File metadata and controls
63 lines (59 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* chassis-beacon.slax
* January 8 2020
* Version 1.0
* Ben Dale - ben.dale@gmail.com
*
* Issue chassis beacon for a set period of time eg:
*
* op chassis-beacon fpc 2 timeout 10
*
*/
version 1.0;
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> "fpc";
<description> "fpc number for beacon";
}
<argument> {
<name> "timeout";
<description> "timeout (seconds) to show beacon";
}
}
param $fpc;
param $timeout;
match / {
<op-script-results> {
if ($timeout = '') {
<xnm:error> {
<message> "missing mandatory argument 'timeout'";
}
} else if ($fpc =''){
<xnm:error> {
<message> "missing mandatory argument 'fpc'";
} else {
var $beaconon = {
<command> 'request chassis beacon fpc ' _ $fpc _ ' on';
}
var $beaconoff = {
<command> 'request chassis beacon fpc ' _ $fpc _ ' off';
}
var $onresult = jcs:invoke($beaconon);
<output> {
expr "Enabling beacon on FPC ";
expr $fpc;
expr '. ';
}
jcs:sleep($timeout)
var $offresult = jcs:invoke($beaconoff);
<output> {
expr "Disabling beacon on FPC ";
expr $fpc;
expr '. ';
}
}
}
}