summaryrefslogtreecommitdiff
path: root/roles/uvok_bird/files/clear_functions.conf
blob: b0fda903d0658d9c7fe6637fac0f602b701bd005 (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
# 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));
}