Take Specific Value Inside BGP Community
Erin Shepherd
bird-users at erinshepherd.net
Tue Feb 20 01:03:59 CET 2024
It's a bit non-obvious, but you can do this with a loop. For example we basically replicate the Euro-IX routeserver announcement control communities inside our network, and we use the following function to translate them when exporting routes to a (supporting) route server
# Translate Euro-IX common communities for use by a route server
function translate_routeserver_communities(
int dest_asn
)
{
lclist announce_controls = filter(bgp_large_community, [(OURAS, 0..1, *)]);
for lc c in announce_controls do {
bgp_large_community.add((dest_asn, c.data1, c.data2));
}
lclist prepends = filter(bgp_large_community, [(OURAS, 101..103, *)]);
for lc c in prepends do {
bgp_large_community.add((dest_asn, c.data1, c.data2));
}
}
(I think we could combine those into one with a filter(bgp_large_community, [(OURAS, 0..1, *), (OURAS, 101..103, *)])? This code originally looked slightly different and at the time combining these wasn't posible.
Note that this doesn't strip the input communities - we do that as a separate step later where we strip all non-informational communities
- Erin
On Tue, 20 Feb 2024, at 00:30, Ilham Maulana wrote:
> Hi,
>
>
> Is it possible in bird to copy specific value inside BGP Community?
>
> Example:
>
> Route 1, Community (a,b,*c*) -> inbound
> Route 2, Community (a,b,*d*) -> inbound
> --
> Route 1, Community (k,l,*c*) -> outbound
> Route 2, Community (k,l,*d*) -> outbound
>
> The specific value I want to preserve is c and d, and it is dynamic variable.
>
> whatever c and d inbound, copy to c and d outbound.
>
> Thanks.
> Ilham
> 5f622eb5-c189-4e05-8584-e4a1d2071a6b
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20240220/b6475d74/attachment.htm>
More information about the Bird-users
mailing list