And some docs for it.
On Tue, Dec 28, 2021 at 12:12 AM Alexander Zubkov <[email protected]> wrote:
>
> Updated both patches. The first one now adds/modifies operators
> .asn/.data/.data1/.data2 instead of '@'. And the second one is only
> changed because of patch conflicts.
>
> On Fri, Dec 17, 2021 at 8:38 PM Alexander Zubkov <[email protected]> wrote:
> >
> > I like the second variant a bit more.
> >
> > On Fri, Dec 17, 2021, 18:13 Ondrej Zajicek <[email protected]> wrote:
> >>
> >> On Fri, Dec 17, 2021 at 04:38:11PM +0100, Alexander Zubkov wrote:
> >> > I can adapt the patch if you wish, just write which variant you want to
> >> > use.
> >>
> >> I am thinking about two variants:
> >>
> >> global / local (for standard community), global / local1 / local2 (for
> >> large one).
> >>
> >> asn / data (for standard community), asn / data1 / data2 (for large one).
> >>
> >> Just pick one, this can be easily changed during merging.
> >>
> >> --
> >> Elen sila lumenn' omentielvo
> >>
> >> Ondrej 'Santiago' Zajicek (email: [email protected])
> >> OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
> >> "To err is human -- to blame it on a computer is even more so."
commit 44d8fd9a93a3db6f69e20737dd0ba00c2921ce8a
Author: Alexander Zubkov <[email protected]>
Date: Tue Dec 28 01:42:42 2021 +0100
Doc: Document community components access operators
diff --git a/doc/bird.sgml b/doc/bird.sgml
index 4e4804de..d1059cb1 100644
--- a/doc/bird.sgml
+++ b/doc/bird.sgml
@@ -1292,6 +1292,9 @@ in the foot).
The same syntax can also be used to construct a pair from two arbitrary
integer expressions (for example <cf/(1+2,a)/).
+ Operators <cf/.asn/ and <cf/.data/ can be used to extract corresponding
+ components of a pair: <cf>(<m/asn/, <m/data/)</cf>.
+
<tag><label id="type-quad">quad</tag>
This is a dotted quad of numbers used to represent router IDs (and
others). Each component can have a value from 0 to 255. Literals of
@@ -1382,6 +1385,10 @@ in the foot).
pairs, LCs can be constructed using expressions for its parts, (e.g.
<cf/(myas, 10+20, 3*10)/, where <cf/myas/ is an integer variable).
+ Operators <cf/.asn/, <cf/.data1/, and <cf/.data2/ can be used
+ to extract corresponding components of LCs:
+ <cf>(<m/asn/, <m/data1/, <m/data2/)</cf>.
+
<tag><label id="type-set">int|pair|quad|ip|prefix|ec|lc|enum set</tag>
Filters recognize four types of sets. Sets are similar to strings: you
can pass them around but you can't modify them. Literals of type <cf>int
commit c9ae4bb36cd2902f3927fcdfcf4d78f551566fe3
Author: Alexander Zubkov <[email protected]>
Date: Tue Dec 28 02:03:42 2021 +0100
Doc: Document min/max operators for lists
diff --git a/doc/bird.sgml b/doc/bird.sgml
index d1059cb1..59bbd05a 100644
--- a/doc/bird.sgml
+++ b/doc/bird.sgml
@@ -1532,7 +1532,7 @@ in the foot).
Clist is similar to a set, except that unlike other sets, it can be
modified. The type is used for community list (a set of pairs) and for
cluster list (a set of quads). There exist no literals of this type.
- There are three special operators on clists:
+ There are special operators on clists:
<cf><m/C/.len</cf> returns the length of clist <m/C/.
@@ -1559,6 +1559,15 @@ in the foot).
<cf><m/C/.add(<m/P/);</cf> if <m/C/ is appropriate route attribute (for
example <cf/bgp_community/). Similarly for <cf/delete/ and <cf/filter/.
+ <cf><m/C/.min</cf> returns the minimum element of clist <m/C/.
+
+ <cf><m/C/.max</cf> returns the maximum element of clist <m/C/.
+
+ Operators <cf/.min/, <cf/.max/ can be used together with <cf/filter/
+ to extract the community from the specific subset of communities
+ (e.g. localpref or prepend) without the need to check every possible
+ value (e.g. <cf/filter(bgp_community, (23456, 1000..1099)).min/).
+
<tag><label id="type-eclist">eclist</tag>
Eclist is a data type used for BGP extended community lists. Eclists
are very similar to clists, but they are sets of ECs instead of pairs.