<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
Hi,<div><br></div><div>Thanks for the reply.</div><div><br></div><div>Here's what i'm going to do.</div><div>--------------------------</div><div><div><span style="font-family: Myanmar Text">function is_to_some_ixp_comm()</span></div><div><span style="font-family: Myanmar Text">int <b>peeras</b>;</span></div><div><span style="font-family: Myanmar Text">{</span></div><div><span style="font-family: Myanmar Text"> peeras = ([(65535, 1000, *)]<b>.data2</b>);</span></div><div><span style="font-family: Myanmar Text"><br></span></div><div><span style="font-family: Myanmar Text"> if bgp_large_community ~ ([( 65535,1000,<b>peeras</b>)]) then {</span></div><div><span style="font-family: Myanmar Text"> bgp_large_community.delete([(65535,*,*)]);</span></div><div><span style="font-family: Myanmar Text"> bgp_large_community.add (( 64512,101,<b>peeras</b> ));</span></div><div><span style="font-family: Myanmar Text"> accept;</span></div><div><span style="font-family: Myanmar Text"> }</span></div><div><span style="font-family: Myanmar Text">}</span></div><div>-------------------------------------</div><div>i want to copy third community value from if statement, and adding it another community.</div><div>but that function gives me error.</div><div><br></div><div> <b>No methods defined for type set</b><br></div><div><br></div><div>is that possible using bird?</div><div><br></div><div>Thanks.</div><div class="mb_sig"></div><blockquote class="history_container" type="cite" style="border-left-style:solid;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">
<p style="color: #AAAAAA; margin-top: 10px;">On 20/02/2024 07:45:30, Erin Shepherd <bird-users@erinshepherd.net> wrote:</p><div style="font-family:Arial,Helvetica,sans-serif"><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"></img><br></div></blockquote><div><br></div></div></blockquote>
</div></div><img class="mailbird" width="1" height="1" style="border:0; width:1; height:1; display: none;" src="https://tracking.getmailbird.com/OpenTrackingPixel/?messageId=Mailbird-8a0840dc-f772-4ae0-a653-6103289b079a@gmail.com&senderHash=82F3C66996009B46D1850120FE9664DF34D8FFCF310C1F26B07883A219B3B122&recipientHash=B59D11DB025569EFF56015527C092AB782D1D6E655DA6AF0126664EE77545784&internalId=1761b69b-29ed-422f-a8cd-a3393aca56eb" alt="6e8681c1-f1d3-45a8-97bb-365e7ee8f797">