-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvc-delete.slax
44 lines (28 loc) · 1.11 KB
/
vc-delete.slax
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
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";
match / {
<op-script-results> {
<output method = "text"> {
var $rpc = <command> "show virtual-chassis status";
var $out = jcs:invoke($rpc);
for-each ($out//member){
var $fpc = ./fpc-slot;
var $strip-space = translate($fpc, ' ', '');
var $strip-left = translate($strip-space, '( ', '');
var $strip-right = translate($strip-left, ')', '');
var $result = translate($strip-right, 'FPC', 'fpc');
var $dest = concat ($result, ':/var/db/scripts/op/vc-copy.slax');
expr $dest _ "\n";
var $ftp = {
<file-delete> {
<path> "fpc2:/var/db/scripts/op/vc-copy.slax";
}
}
var $exec = jcs:invoke($ftp);
}
}
}
}