On Mon, Mar 19, 2012 at 12:43:40PM +0100, Ondrej Zajicek wrote:
On Fri, Mar 09, 2012 at 12:53:32AM +0400, Oleg wrote:
The code: comm = filter(bgp_community, allowed); bgp_community.delete([(myas,*)]); bgp_community.add(comm);
could be done if comm would be clist and adding clist to clist would be implemented (which i could add, this is simple).
This would be nice! I'm ready to git-pull :-).
Implemented in commit 0888a737b045b48106edbd28ba3cd62fcc8c191e,
Also allows number ~ bgppath match.
It works! Now my function is: function filter_communities(pair set allowed) clist comm; pair set def_allowed; { def_allowed = [(myas,1000), (myas,1001), (myas,1002)]; if ( (0,0) ~ allowed ) then allowed = def_allowed; comm = filter(bgp_community, allowed); bgp_community.delete([(myas,*)]); bgp_community.add(comm); if ! ( comm ~ [(0,0)..(65535,65535)] ) then if ( (myas,1000) ~ allowed ) then bgp_community.add((myas,1000)); } One question. Is "! ( comm ~ [(0,0)..(65535,65535)] )" construction fast?