-
Notifications
You must be signed in to change notification settings - Fork 0
/
dhcp_snoop_archive.slax
54 lines (42 loc) · 1.52 KB
/
dhcp_snoop_archive.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
45
46
47
48
49
50
51
52
53
54
/*
This script will save and or load the DHCP snooping database
using the "<save|load> dhcp-security-snoop <filename>" command
Unfortunately, there is no RPC for this command.....
Author: Ken Cope [email protected]
Last modified: 09.03.2022
*/
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";
/* @ISLOCAL = "true" */
var $local = jcs:open();
match / {
<op-script-results> {
/* This only works on the master re - delete all files in home dir */
<output> "These files will be deleted on the master RE";
var $files_rpc = {
<file-list>;
}
var $files_result = jcs:execute($local, $files_rpc);
copy-of $files_result;
/* Save the snooping db - run from shell as there is no RPC for this command */
var $save_rpc = {
<request-shell-execute> {
<command> "cli save dhcp-security-snoop SNOOP-ARCHIVE";
}
}
var $save_result = jcs:execute($local, $save_rpc);
copy-of $save_result;
/* Load the snooping db - run from shell as there is no RPC for this command */
var $load_rpc = {
<request-shell-execute> {
<command> "cli load dhcp-security-snoop SLNOOP-ARCHIVE";
}
}
var $load_result = jcs:execute($local, $load_rpc);
copy-of $load_result;
expr jcs:close($local);
}
}