<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
Hi sir,<div><br></div><div>Thank you for the explanation</div><div><br></div><div>Your script works.</div><div><br></div><div>Just started using bird 6 month ago, and found out it is super cool.</div><div><br></div><div><span style="font-size: 13.3333px">Many thanks.</span><br></div><div><br></div><div>Best Regard,<br><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 15:43:06, Alexander Zubkov <green@qrator.net> wrote:</p><div style="font-family:Arial,Helvetica,sans-serif"><div dir="ltr"><div>Hi,</div><div><br></div><div>This statement is wrong:</div><div><br></div><div>peeras = ([(65535, 1000, *)].data2);</div><div><br></div><div>You try to pick "data2" from the communty set (= comunity filter). Filter itself does not contain values. You need to apply it to some community list first. Still you'll get a community list as a result. But you can pick "data2" only from a single community. If you have or expect only one community matching the filter and can ignore other values, you can use min/max operators to take a single community from the list. But be aware that an empty list will yield you an error here, so you need to check fist that there is something there. Please also pay attention that you use a legacy syntax for definition of block variables and function.</div><div><br></div><div>Not sure that I fully got you idea, but you can check this piece of code:</div><div><br></div><div>if (bgp_large_community ~ [(65535, 1000, *)]) then {<br></div><div> int peeras = filter(bgp_large_community, [(65535, 1000, *)]).min.data2;<br></div><div> bgp_large_community.delete([(65535, *, *)]);</div><div> bgp_large_community.add(( 64512, 101, peeras ));</div><div> accept; # not sure if it is good to accept/reject in a function<br></div><div>}<br><br></div><div>Regards,</div><div>Alexander<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 20, 2024 at 9:12 AM Ilham Maulana <<a href="mailto:ilhamsupernatural@gmail.com">ilhamsupernatural@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div id="m_6911303325467261047__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0);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></div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-top:20px;margin-left:0px;padding-left:10px">
<p style="color:rgb(170,170,170);margin-top:10px">On 20/02/2024 07:45:30, Erin Shepherd <<a href="mailto:bird-users@erinshepherd.net" target="_blank">bird-users@erinshepherd.net</a>> 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 style="font-family:menlo,consolas,monospace,sans-serif"># Translate Euro-IX common communities for use by a route server</span><span style="font-family:menlo,consolas,monospace,sans-serif"><br></span></div><div><span style="font-family:menlo,consolas,monospace,sans-serif">function translate_routeserver_communities(</span><span style="font-family:menlo,consolas,monospace,sans-serif"><br></span></div><div><span style="font-family:menlo,consolas,monospace,sans-serif"> int dest_asn</span><span style="font-family:menlo,consolas,monospace,sans-serif"><br></span></div><div><span style="font-family:menlo,consolas,monospace,sans-serif">)</span><span style="font-family:menlo,consolas,monospace,sans-serif"><br></span></div><div><span style="font-family:menlo,consolas,monospace,sans-serif">{</span><span style="font-family:menlo,consolas,monospace,sans-serif"><br></span></div><div><span style="font-family:menlo,consolas,monospace,sans-serif"> lclist announce_controls = filter(bgp_large_community, [(OURAS, 0..1, *)]);</span><span style="font-family:menlo,consolas,monospace,sans-serif"><br></span></div><div><span style="font-family:menlo,consolas,monospace,sans-serif"> for lc c in announce_controls do {</span><span style="font-family:menlo,consolas,monospace,sans-serif"><br></span></div><div><span style="font-family:menlo,consolas,monospace,sans-serif"> bgp_large_community.add((dest_asn, c.data1, c.data2));</span><span style="font-family:menlo,consolas,monospace,sans-serif"><br></span></div><div><span style="font-family:menlo,consolas,monospace,sans-serif"> }</span><span style="font-family:menlo,consolas,monospace,sans-serif"><br></span></div><div><span style="font-family:menlo,consolas,monospace,sans-serif"><br></span></div><div><span style="font-family:menlo,consolas,monospace,sans-serif"> lclist prepends = filter(bgp_large_community, [(OURAS, 101..103, *)]);</span><span style="font-family:menlo,consolas,monospace,sans-serif"><br></span></div><div><span style="font-family:menlo,consolas,monospace,sans-serif"> for lc c in prepends do {</span><span style="font-family:menlo,consolas,monospace,sans-serif"><br></span></div><div><span style="font-family:menlo,consolas,monospace,sans-serif"> bgp_large_community.add((dest_asn, c.data1, c.data2));</span><span style="font-family:menlo,consolas,monospace,sans-serif"><br></span></div><div><span style="font-family:menlo,consolas,monospace,sans-serif"> }</span><span style="font-family:menlo,consolas,monospace,sans-serif"><br></span></div><div><span 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 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="m_6911303325467261047qt"><div id="m_6911303325467261047qt-__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: rgb(0,0,0);text-align: left" dir="ltr"><div>Hi,<br></div><div><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 style="font-size: 13.3333px">Route 2, Community (a,b,<b>d</b>) -> inbound</span><br></div><div><span 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 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 style="font-size: 13.3333px"></span><br></div><div style="font-size: 13.3333px"><span 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 style="font-size: 13.3333px"></span><br></div><div style="font-size: 13.3333px"><span 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 style="font-size: 13.3333px"></span><br></div><div style="font-size: 13.3333px"><span style="font-size: 13.3333px">Thanks.</span><br></div><div style="font-size: 13.3333px">Ilham<br></div></div><div><img width="1" height="1" style="border-width: 0px; border-style: none; border-color: currentcolor; width: 1px; height: 1px; display: none;" alt="5f622eb5-c189-4e05-8584-e4a1d2071a6b"></img><br></div></blockquote><div><br></div></div></blockquote>
</div></div><img width="1" height="1" style="border: 0px; display: none;" alt="6e8681c1-f1d3-45a8-97bb-365e7ee8f797"></img>
</blockquote></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-da7a5e59-e426-41e5-86b3-27826144b050@gmail.com&senderHash=82F3C66996009B46D1850120FE9664DF34D8FFCF310C1F26B07883A219B3B122&recipientHash=B59D11DB025569EFF56015527C092AB782D1D6E655DA6AF0126664EE77545784&internalId=1a3d9aab-e951-4a80-a589-83fb49f11fe4" alt="156a60bf-0c1a-4ddb-9b41-23525d390373">