From 303d8fd785b828f9e8f2d0cd7b779ff9d91ccc37 Mon Sep 17 00:00:00 2001 From: Martin Schuette Date: Tue, 1 Apr 2014 00:05:53 +0200 Subject: [PATCH] bird: add flag $gw_do_ic_peering --- manifests/init.pp | 9 +++++---- templates/etc/bird.conf.erb | 8 ++++++++ templates/etc/bird6.conf.erb | 8 ++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 5df600e..b5ec448 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,4 +1,4 @@ -class ff_gw($mesh_mac, $gw_ipv4, $gw_ipv6, $secret_key, $dhcprange_start, $dhcprange_end) { +class ff_gw($mesh_mac, $gw_ipv4, $gw_ipv6, $secret_key, $dhcprange_start, $dhcprange_end, $gw_do_ic_peering = false) { class { 'ff_gw::apt': } -> class { 'ff_gw::software': } @@ -27,8 +27,9 @@ class ff_gw($mesh_mac, $gw_ipv4, $gw_ipv6, $secret_key, $dhcprange_start, $dhcpr class { 'ff_gw::dnsmasq': } -> class { 'ff_gw::bird': - own_ipv4 => $gw_ipv4, - own_ipv6 => $gw_ipv6, + own_ipv4 => $gw_ipv4, + own_ipv6 => $gw_ipv6, + gw_do_ic_peering => $gw_do_ic_peering, } } @@ -419,7 +420,7 @@ exit 0'; } } -class ff_gw::bird($own_ipv4, $own_ipv6, $version = 'present') { +class ff_gw::bird($own_ipv4, $own_ipv6, $gw_do_ic_peering, $version = 'present') { # read peering data from data file $module_path = get_module_path($module_name) $peeringdata = loadyaml("${module_path}/data/peering.yaml") diff --git a/templates/etc/bird.conf.erb b/templates/etc/bird.conf.erb index de8ff14..ac6cd2e 100644 --- a/templates/etc/bird.conf.erb +++ b/templates/etc/bird.conf.erb @@ -141,3 +141,11 @@ protocol bgp <%= key %> from <%= hash["template"] %> { neighbor <%= hash["ip"] %> as <%= hash["as"] %>; }; <% end -%><% end -%> + +<% if @gw_do_ic_peering -%> +<% @ic_peerings_v4.each_pair do |key, hash| -%><% if hash["ip"] != @own_ipv4 -%> +protocol bgp <%= key %> from <%= hash["template"] %> { + neighbor <%= hash["ip"] %> as <%= hash["as"] %>; +}; +<% end -%><% end -%> +<% end -%> diff --git a/templates/etc/bird6.conf.erb b/templates/etc/bird6.conf.erb index 7b52d4f..1f73075 100644 --- a/templates/etc/bird6.conf.erb +++ b/templates/etc/bird6.conf.erb @@ -77,3 +77,11 @@ protocol bgp <%= key %> from <%= hash["template"] %> { neighbor <%= hash["ip"] %> as <%= hash["as"] %>; }; <% end -%><% end -%> + +<% if @gw_do_ic_peering -%> +<% @ic_peerings_v6.each_pair do |key, hash| -%><% if hash["ip"] != @own_ipv6 -%> +protocol bgp <%= key %> from <%= hash["template"] %> { + neighbor <%= hash["ip"] %> as <%= hash["as"] %>; +}; +<% end -%><% end -%> +<% end -%>