Constants can't contain other constants?
Hi everyone, I'm presently investigating BIRD as a (much appreciated!) replacement for Quagga and running in to some behaviour that isn't clear from reading the documentation. I'm looking at ways to consistently template BGP communities received from / sent to peers across multiple routers, and have attempted this: define test_international = (test_asn, 90); define test_national = (test_asn, 100); define test_ix = (test_asn, 200); define test_bilat = (test_asn, 300); define test_customer = (test_asn, 400); define test_infrastructure = (test_asn, 500); define test_send_to_transit = [test_blackhole]; define test_send_to_ix = []; define test_send_to_customer = [ test_international, test_national, test_ix, test_bilat, test_customer, test_infrastructure ]; With a view to later making a call to 'filter' in the BGP export filter facing the test customer: bgp_community.filter(test_send_to_customer); However loading this configuration in BIRD produces an error: bird> configure Reading configuration from /etc/bird/bird.conf /etc/bird/template/common.conf, line 84: Number expected Line 84 being the line shown above "define test_send_to_transit = [test_blackhole];". This suggests to me that one cannot define a constant including another existing constant in this manner? If so, is the best approach instead to define constants for individual communities and use re-usable 'functions' to group them logically? Suggestions heartily appreciated :) -- Michael
On Thu, 21 Aug 2014 17:12:04 +1200, Michael Fincham wrote:
Line 84 being the line shown above "define test_send_to_transit = [test_blackhole];".
Before anyone points out the obvious error, I've just noticed I missed these lines from the configuration I included in my first e-mail: define test_asn = 64511; define test_blackhole = (test_asn, 666); -- Michael
On Thu, Aug 21, 2014 at 05:12:04PM +1200, Michael Fincham wrote:
Hi everyone,
I'm presently investigating BIRD as a (much appreciated!) replacement for Quagga and running in to some behaviour that isn't clear from reading the documentation.
I'm looking at ways to consistently template BGP communities received from / sent to peers across multiple routers, and have attempted this:
define test_international = (test_asn, 90); define test_national = (test_asn, 100); define test_ix = (test_asn, 200); define test_bilat = (test_asn, 300); define test_customer = (test_asn, 400); define test_infrastructure = (test_asn, 500); ... This suggests to me that one cannot define a constant including another existing constant in this manner?
Well, you could generally use constants in constants (you are using test_asn in your example), just the set literals are a bit complicated and do not allow constants for whole pair.
If so, is the best approach instead to define constants for individual communities and use re-usable 'functions' to group them logically?
You could use: define val_blackhole = 666; define test_send_to_transit = [(test_asn, val_blackhole)]; -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
Hi Ondrej, On Thu, 21 Aug 2014 10:38:08 +0200, Ondrej Zajicek wrote:
Well, you could generally use constants in constants (you are using test_asn in your example), just the set literals are a bit complicated and do not allow constants for whole pair.
Thanks for the very swift reply! This makes sense. I think for what I'm doing here it'll actually be simpler just to define functions that do the filtering, and call them from the filters. -- Michael
participants (2)
-
Michael Fincham -
Ondrej Zajicek