forked from dfex/DFEXjunoscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
show-secure-tunnels.slax
36 lines (32 loc) · 1.25 KB
/
show-secure-tunnels.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
/* show-secure-tunnels.slax
* 21 Dec 2015
* Version 1.0
* Ben Dale - ben.dale@gmail.com
*
* Provides a more descriptive output for checking Secure Tunnel (VPN)
* status on an SRX or J-Series router
*
*/
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> {
var $output-format = "%-25s%-12s%-8s%-8s%-40s";
<output> jcs:printf($output-format, "VPN Name", "Interface", "State", "Port", "Remote Gateway");
var $show-vpn-sa = {
<command> "show security ipsec security-associations detail";
}
var $vpn-sa-list = jcs:invoke( $show-vpn-sa );
for-each ($vpn-sa-list/ipsec-security-associations-block) {
<output> jcs:printf($output-format,
sa-vpn-name,
sa-df-bit-policy-name/sa-bind-interface,
sa-block-state,
ipsec-security-associations/sa-port,
sa-remote-gateway);
}
}
}