Hi,
Thanks for the reply.
Here's what i'm going to do.
--------------------------
function is_to_some_ixp_comm()
int peeras;
{
peeras = ([(65535, 1000, *)].data2);
if bgp_large_community ~ ([( 65535,1000,peeras)]) then {
bgp_large_community.delete([(65535,*,*)]);
bgp_large_community.add (( 64512,101,peeras ));
accept;
}
}
-------------------------------------
i want to copy third community value from if statement, and adding it another
community.
but that function gives me error.
No methods defined for type set
is that possible using bird?
Thanks.
On 20/02/2024 07:45:30, Erin Shepherd <[email protected]> wrote:
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]
[6e8681c1-f1d3-45a8-97bb-365e7ee8f797]