summaryrefslogtreecommitdiff
path: root/roles/uvok_bird/files/clear_functions.conf
blob: 76a2ead79d0f977f799e4dde547c30d2fd1ed3b3 (plain)
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
# managed by Ansible

function clean_own_communities() {
    bgp_large_community.delete([(CLEARNET_ASN, *, *)]);
}

function clearnet_import_ixp(int ixp_id) {
    clean_own_communities();
    bgp_large_community.add((CLEARNET_ASN, LC_INFO, INFO_IXP_RS));
    bgp_large_community.add((CLEARNET_ASN, LC_IXP_ID, ixp_id));
}

function clearnet_import_transit() {
    clean_own_communities();
    bgp_large_community.add((CLEARNET_ASN, LC_INFO, INFO_TRANSIT));
}

function clearnet_import_peer() {
    clean_own_communities();
    bgp_large_community.add((CLEARNET_ASN, LC_INFO, INFO_PEER));
}

function clearnet_is_ixp() {
    if (CLEARNET_ASN, LC_INFO, INFO_IXP_RS) ~ bgp_large_community then {
        return true;
    }
    return false;
}

function clearnet_add_filter(int filter_reason) {
    bgp_large_community.add((CLEARNET_ASN, LC_FILTERED, filter_reason));
    # ensure route never gets selected as "best"
    # (for direct peer connections: if that happened, no other route
    # would go from unfiltered to transit table).
    bgp_local_pref = 0;
}