52 lines
2.4 KiB
Plaintext
52 lines
2.4 KiB
Plaintext
function update_latency(int link_latency) {
|
|
bgp_community.add((64511, link_latency));
|
|
if (64511, 9) ~ bgp_community then { bgp_community.delete([(64511, 1..8)]); }
|
|
else if (64511, 8) ~ bgp_community then { bgp_community.delete([(64511, 1..7)]); }
|
|
else if (64511, 7) ~ bgp_community then { bgp_community.delete([(64511, 1..6)]); }
|
|
else if (64511, 6) ~ bgp_community then { bgp_community.delete([(64511, 1..5)]); }
|
|
else if (64511, 5) ~ bgp_community then { bgp_community.delete([(64511, 1..4)]); }
|
|
else if (64511, 4) ~ bgp_community then { bgp_community.delete([(64511, 1..3)]); }
|
|
else if (64511, 3) ~ bgp_community then { bgp_community.delete([(64511, 1..2)]); }
|
|
else if (64511, 2) ~ bgp_community then { bgp_community.delete([(64511, 1..1)]); }
|
|
}
|
|
|
|
function update_bandwidth(int link_bandwidth) {
|
|
bgp_community.add((64511, link_bandwidth));
|
|
if (64511, 21) ~ bgp_community then { bgp_community.delete([(64511, 22..29)]); }
|
|
else if (64511, 22) ~ bgp_community then { bgp_community.delete([(64511, 23..29)]); }
|
|
else if (64511, 23) ~ bgp_community then { bgp_community.delete([(64511, 24..29)]); }
|
|
else if (64511, 24) ~ bgp_community then { bgp_community.delete([(64511, 25..29)]); }
|
|
else if (64511, 25) ~ bgp_community then { bgp_community.delete([(64511, 26..29)]); }
|
|
else if (64511, 26) ~ bgp_community then { bgp_community.delete([(64511, 27..29)]); }
|
|
else if (64511, 27) ~ bgp_community then { bgp_community.delete([(64511, 28..29)]); }
|
|
else if (64511, 28) ~ bgp_community then { bgp_community.delete([(64511, 29..29)]); }
|
|
}
|
|
|
|
function update_crypto(int link_crypto) {
|
|
bgp_community.add((64511, link_crypto));
|
|
if (64511, 31) ~ bgp_community then { bgp_community.delete([(64511, 32..34)]); }
|
|
else if (64511, 32) ~ bgp_community then { bgp_community.delete([(64511, 33..34)]); }
|
|
else if (64511, 33) ~ bgp_community then { bgp_community.delete([(64511, 34..34)]); }
|
|
}
|
|
|
|
function update_flags(int link_latency; int link_bandwidth; int link_crypto) {
|
|
update_latency(link_latency);
|
|
update_bandwidth(link_bandwidth);
|
|
update_crypto(link_crypto);
|
|
}
|
|
|
|
function update_region4() {
|
|
if is_self_net4() then {
|
|
bgp_community.add((64511, REGION_GEO));
|
|
bgp_community.add((64511, REGION_COUNTRY));
|
|
}
|
|
}
|
|
|
|
function update_region6() {
|
|
if is_self_net6() then {
|
|
bgp_community.add((64511, REGION_GEO));
|
|
bgp_community.add((64511, REGION_COUNTRY));
|
|
}
|
|
}
|
|
|