functions question
Oleg
lego12239 at yandex.ru
Fri Apr 13 11:46:54 CEST 2012
On Fri, Apr 13, 2012 at 11:09:58AM +0200, Jaroslav Jir??sek wrote:
> Hello,
Hello.
> and I want to do something like this:
>
> function add_community(pair set peer_community)
> {
> bgp_community.add(peer_community); # doesnt work,
> incompatible types
> return true;
> }
>
> and call it like this:
>
> add_community([ (11111, 4444), (11111, 5555), (2222, 6666) ])
>
>
> is it possible?
Not directly like this. But if you have few known communites, you can do
next hardcode:
function add_community(pair set comm)
{
if ( (123,555) ~ comm ) then
bgp_community.add((123,555));
if ( (123,666) ~ comm ) then
bgp_community.add((123,666));
if ( (123,777) ~ comm ) then
bgp_community.add((123,777));
if ( (123,888) ~ comm ) then
bgp_community.add((123,888));
}
This is ugly, but if you have little count of communities this is not annoying
solution.
More information about the Bird-users
mailing list