On 03/21/2018 10:00 AM, Saku Ytti wrote: > My config: > > define local_ip = 129.250.14.127; > define default_candidate_net = 129.250.0.0/16; > define default_candidate_ip = 129.250.0.0; > define default_net = 0.0.0.0/0; > include "common.conf"; > > protocol static { > route 0.0.0.0/0 recursive default_candidate_ip; > } > > # ens192 > protocol bgp active from NTT { > neighbor 204.141.224.0; > } > > # ens 224 > protocol bgp backup from NTT { > neighbor 204.141.224.2; > } > > > 1) constant not available everywhere > > a) this works > - define default_candidate_ip = 129.250.0.0; > - route 0.0.0.0/0 recursive default_candidate_ip; > > b) this does not > - define default_route = 0.0.0.0/0; > - route default_route recursive 129.250.0.0; > > Why not? It barfs with 'line 10: IP address expected'
In v1.6.x, nobody implemented it. In v2, it should work. > 2) passing variables from protocols > > I'm thinking how to tell which neighbour is backup which is primary. My > thoughts > > a) 'import (backup, bgp_in) > => no way to define >1 filter? > > b) 'bool backup = true' > => no way to set variables in protocols > > c) 'define backup = true' > => no way to set constants in protocols > > d) ''import bgp_in(true)' > => no way to pass variables to filters > > I resorted to matching to protocol name, and call the backup group > backup. But I'd really prefer way to give neighbour or protocol some > information I can use in filter to discriminate. Try 'import where yourCustomImportFunction(arg1, arg2, arg3, ... argN)'. > Are constants considered strings? If so, should the strings have some > methods, like split, sub, []? I bit needlessly need to define > 129.250.0.0 and 129.250.0.0/16 as one is used as static route next-hop > another is used as filter to permit prefix. I could just maybe say > 'default_candidate_net.split('/')[0]'. Try 'default_candidate_net.ip' and 'default_candidate_net.len'. Both of them are available only in filters. Anyway, it should be possible to 'define default_candidate_ip = default_candidate_net.ip;' and then use the constant as IP. M.