add global route controller

production
186526 2023-01-09 22:46:30 +08:00
parent a9de9d9a89
commit 04edb208ee
5 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,3 @@
function pub_route_controller_specific() {
if 4837 ~ bgp_path && (200536, 120, 221) ~ bgp_large_community && REGION ~ [200..299] then bgp_local_pref = 114514;
}

View File

@ -98,6 +98,7 @@ function transit_import_filter(int ASN) {
pub_preprocess_communities(); pub_preprocess_communities();
bgp_local_pref = 400 - bgp_path.len * 10; bgp_local_pref = 400 - bgp_path.len * 10;
if LOCAL_ASN ~ bgp_path then bgp_local_pref = 1; if LOCAL_ASN ~ bgp_path then bgp_local_pref = 1;
pub_route_controller_specific();
return true; return true;
} }

View File

@ -4,6 +4,7 @@ function downstream_import_filter(int ASN) {
pub_add_communities(ASN, 20); pub_add_communities(ASN, 20);
pub_preprocess_communities(); pub_preprocess_communities();
bgp_local_pref = 500 - bgp_path.len * 10; bgp_local_pref = 500 - bgp_path.len * 10;
pub_route_controller_specific();
return true; return true;
} }

View File

@ -1,7 +1,7 @@
function net186_import_filter(int POPID) function net186_import_filter(int POPID)
int viaRegion; int viaRegion;
bgppath public_bgp_path; bgppath public_bgp_path;
{ {
public_bgp_path = delete(bgp_path, [4200000000..4225479999]); public_bgp_path = delete(bgp_path, [4200000000..4225479999]);
if (LOCAL_ASN, 122, REGION) !~ bgp_large_community then bgp_large_community.add((LOCAL_ASN, 122, REGION)); if (LOCAL_ASN, 122, REGION) !~ bgp_large_community then bgp_large_community.add((LOCAL_ASN, 122, REGION));
@ -10,6 +10,8 @@ function net186_import_filter(int POPID)
else if bgp_large_community ~ [(LOCAL_ASN, 110, 1), (LOCAL_ASN, 110, 10)] then bgp_local_pref = 400; else if bgp_large_community ~ [(LOCAL_ASN, 110, 1), (LOCAL_ASN, 110, 10)] then bgp_local_pref = 400;
else bgp_local_pref = 300; else bgp_local_pref = 300;
pub_route_controller_specific();
viaRegion = 0; viaRegion = 0;
# Route is via Europe & Africa & Middle East # Route is via Europe & Africa & Middle East
if bgp_large_community ~ [(LOCAL_ASN, 122, 100), (LOCAL_ASN, 122, 300..310), (LOCAL_ASN, 122, 600), (LOCAL_ASN, 121, 100), (LOCAL_ASN, 121, 300..310), (LOCAL_ASN, 121, 600)] || POP ~ [100, 300..310, 600] then viaRegion = viaRegion + 1; if bgp_large_community ~ [(LOCAL_ASN, 122, 100), (LOCAL_ASN, 122, 300..310), (LOCAL_ASN, 122, 600), (LOCAL_ASN, 121, 100), (LOCAL_ASN, 121, 300..310), (LOCAL_ASN, 121, 600)] || POP ~ [100, 300..310, 600] then viaRegion = viaRegion + 1;

View File

@ -13,6 +13,7 @@ function direct_peer_import_filter(int ASN) {
pub_add_communities(ASN, 0); pub_add_communities(ASN, 0);
pub_preprocess_communities(); pub_preprocess_communities();
bgp_local_pref = 500 - bgp_path.len * 10; bgp_local_pref = 500 - bgp_path.len * 10;
pub_route_controller_specific();
return true; return true;
} }