Are there considerations in future to pass bgp_neighbour object to filter, to discriminate on neighbor address, ifname, asn, etc? JunOS allows this. This would allow me to keep single 'define backup_int = "XYZ". On ingress I'd match against protocol, on egress I'd match against bgp_neighbour.ifname. So only thing I'd define for backup/primary selection is single const, which could be included in a single line config file.
Something like this:
filter bgp_primary_out { if ifname = "lo" then { if bgp_neighbor.ifname = backup_int then bgp_path.prepend(local_as); accept; } reject; }
filter bgp_primary_in { if proto = backup_int then bgp_local_pref = 50; if net = default_candidate_net then accept; reject; }
Probably yes (or something like that) . See this thread. http://bird.network.cz/pipermail/bird-users/2018-January/011881.html
Anyway, it should be possible to 'define default_candidate_ip = default_candidate_net.ip;' and then use the constant as IP.
This works. Curiously won't work if the next-hop is default_candidate_net.ip; Actually have to assign own constant to it.
Yes, you have to assign an own constant for it due to current configuration syntax restrictions. It may change in future. M.