
router id <%= @ipaddress_trp1 %>;

<% if @debug %>debug protocols all;
<% end -%>
# We are only going to export routes from Calico interfaces.
# Currently, 'tap*' is used by the OpenStack implimentation
# and 'cali*' is used by the docker implimentation.
# dummy1 is the interface that bare metal "service" addresses
# should be bound to if they should be exported.
# This will need to be updated as we add new interface names.
#
# Also filter out default, just in case.
#
# We should automate the build of this out of variables when
# we have time.

filter export_bgp {
  if (ifname ~ "tap*") then {
    if  net != 0.0.0.0/0 then accept;
  }
  reject;
}

# Configure synchronization between BIRD's routing tables and the
# kernel.
protocol kernel {
  learn;          # Learn all alien routes from the kernel
  device routes;  # protect kernel device routes from being overwritten or removed by IGP routes
  persist;        # Don't remove routes on bird shutdown
  scan time 2;    # Scan kernel routing table every 2 seconds
  import all;
  graceful restart;
  export all;     # Default is export none
}

protocol bfd {
  neighbor <%= scope.function_hiera(['netcfg_trp_gateway']) %>;
}

# Watch interface up/down events.
protocol device {
  scan time 2;    # Scan interfaces every 2 seconds
}

protocol direct {
   debug all;
   interface "*";
}

protocol bgp 'rr1_ipv4' {
  description "Connection to BGP route reflector rr1_ipv4";
  local as <%= scope.function_hiera(['bgp_as']) %>;
  neighbor <%= scope.function_hiera(['netcfg_trp_gateway']) %> as <%= scope.function_hiera(['bgp_as']) %>;
  multihop;
  import all;
  graceful restart;
  export filter export_bgp;
  source address <%= @ipaddress_trp1 %>;  # The local address we use for the TCP connection
}

Add bird template for bsd nat box
Add bird template for bsd nat box
