-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrfc8212-throw.slax
35 lines (28 loc) · 1.21 KB
/
rfc8212-throw.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
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 configuration {
if( $junos-context/script-type == "commit" ) {
/* EBGP peers runnign IP/VPM must apply the export policy! "vpn-apply-export" */
for-each (protocols/bgp/group/neighbor[count(family/inet-vpn)>0][!vpn-apply-export && !../vpn-apply-export]) {
var $group = ../name;
var $neighbor = name;
<xnm:error> {
<edit-path> "[edit protocols bgp group " _ $group _ " neighbor " _ $neighbor _ "]";
<message> "EBGP peers running IP/VPN (1/128) must apply export policy (vpn-apply-export)";
}
}
/* EBGP peers must specify both import and export policy */
for-each (protocols/bgp/group[type=="external"]/neighbor[count(export)==0 && count(../export)==0] |
protocols/bgp/group[type=="external"]/neighbor[count(import)==0 && count(../import)==0]) {
var $group = ../name;
var $neighbor = name;
<xnm:error> {
<edit-path> "[edit protocols bgp group " _ $group _ " neighbor " _ $neighbor _ "]";
<message> "EBGP peers must specify import and export policy. See RFC 8212.";
}
}
}
}