<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>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<br></div><div><br></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"># Translate Euro-IX common communities for use by a route server</span><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><br></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">function translate_routeserver_communities(</span><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><br></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> int dest_asn</span><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><br></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">)</span><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><br></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">{</span><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><br></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> lclist announce_controls = filter(bgp_large_community, [(OURAS, 0..1, *)]);</span><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><br></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> for lc c in announce_controls do {</span><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><br></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> bgp_large_community.add((dest_asn, c.data1, c.data2));</span><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><br></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> }</span><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><br></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><br></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> lclist prepends = filter(bgp_large_community, [(OURAS, 101..103, *)]);</span><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><br></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> for lc c in prepends do {</span><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><br></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> bgp_large_community.add((dest_asn, c.data1, c.data2));</span><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><br></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> }</span><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"><br></span></div><div><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">}</span><br></div><div><br></div><div>(I think we could combine those into one with a <span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">filter(bgp_large_community, [(OURAS, 0..1, *), (OURAS, 101..103, *)])</span>? This code originally looked slightly different and at the time combining these wasn't posible.<br></div><div><br></div><div>Note that this doesn't strip the input communities - we do that as a separate step later where we strip all non-informational communities<br></div><div><br></div><div>- Erin<br></div><div><br></div><div>On Tue, 20 Feb 2024, at 00:30, Ilham Maulana wrote:<br></div><blockquote type="cite" id="qt" style=""><div id="qt-__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;color:rgb(0, 0, 0);text-align:left;" dir="ltr"><div>Hi,<br></div><div class="qt-mb_sig"><br></div><div><br></div><div>Is it possible in bird to copy specific value inside BGP Community?<br></div><div><br></div><div>Example:<br></div><div><br></div><div>Route 1, Community (a,b,<b>c</b>) -> inbound<br></div><div><span class="size" style="font-size:13.3333px;">Route 2, Community (a,b,<b>d</b>) -> inbound</span><br></div><div><span class="size" style="font-size:13.3333px;">--</span><br></div><div><div style="font-size:13.3333px;">Route 1, Community (k,l,<b>c</b>) -> outbound<br></div><div style="font-size:13.3333px;"><span class="size" style="font-size:13.3333px;">Route 2, Community (k,l,<b>d</b>) -> outbound</span><br></div></div><div style="font-size:13.3333px;"><span class="size" style="font-size:13.3333px;"></span><br></div><div style="font-size:13.3333px;"><span class="size" style="font-size:13.3333px;">The specific value I want to preserve is c and d, and it is dynamic variable.</span><br></div><div style="font-size:13.3333px;"><span class="size" style="font-size:13.3333px;"></span><br></div><div style="font-size:13.3333px;"><span class="size" style="font-size:13.3333px;">whatever c and d inbound, copy to c and d outbound.</span><br></div><div style="font-size:13.3333px;"><span class="size" style="font-size:13.3333px;"></span><br></div><div style="font-size:13.3333px;"><span class="size" style="font-size:13.3333px;">Thanks.</span><br></div><div style="font-size:13.3333px;">Ilham<br></div></div><div><img class="qt-mailbird" width="1" height="1" style="border-top-width:0px;border-top-style:none;border-top-color:currentcolor;border-right-width:0px;border-right-style:none;border-right-color:currentcolor;border-bottom-width:0px;border-bottom-style:none;border-bottom-color:currentcolor;border-left-width:0px;border-left-style:none;border-left-color:currentcolor;border-image-outset:0;border-image-repeat:stretch;border-image-slice:100%;border-image-source:none;border-image-width:1;width:1px;height:1px;display:none;" src="https://tracking.getmailbird.com/OpenTrackingPixel/?messageId=Mailbird-497b15f1-3c9d-43e1-a555-a2406f221a93@gmail.com&senderHash=82F3C66996009B46D1850120FE9664DF34D8FFCF310C1F26B07883A219B3B122&recipientHash=B59D11DB025569EFF56015527C092AB782D1D6E655DA6AF0126664EE77545784&internalId=32de7c9c-b87c-4ef0-b19f-d75298ab8f94" alt="5f622eb5-c189-4e05-8584-e4a1d2071a6b"><br></div></blockquote><div><br></div></body></html>