-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfilter_aspa.conf
45 lines (35 loc) · 1.04 KB
/
filter_aspa.conf
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
function is_aspa_invalid_customer() {
int prev_asn = MY_ASN;
for int cur_asn in bgp_path do {
if prev_asn != cur_asn && is_aspa_invalid_pair(prev_asn, cur_asn) then
return true;
prev_asn = cur_asn;
}
return false;
}
function is_aspa_invalid_peer() {
int prev_asn = bgp_path.first;
for int cur_asn in bgp_path do {
if prev_asn != cur_asn && is_aspa_invalid_pair(prev_asn, cur_asn) then
return true;
prev_asn = cur_asn;
}
return false;
}
function is_aspa_invalid_upstream() {
int prev_asn = MY_ASN;
int max_up_ramp = bgp_path.len;
int min_down_ramp = 0;
int i = 0;
for int cur_asn in bgp_path do {
if prev_asn != cur_asn then {
if is_aspa_invalid_pair(cur_asn, cur_asn) && max_up_ramp > i then
max_up_ramp = i;
if is_aspa_invalid_pair(prev_asn, cur_asn) then
min_down_ramp = i;
}
prev_asn = cur_asn;
i = i + 1;
}
return min_down_ramp > max_up_ramp;
}