From e14e86bb972852d50409bf882da31ae75cbd296d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samir=20Ibrad=C5=BEi=C4=87?= Date: Tue, 1 Mar 2016 20:51:53 +0900 Subject: [PATCH] Add BGP subnet, local peer IP and remove secondary BGP This adds two extra configuration options required for working BGP setup, BGP subnet CIDR & local GBP perr IP address. I also removes unsupported secondary BGP configuration options. Change-Id: I644b45cfa76d858835980414355df79fa8cfa875 --- .../puppet/manifests/midonet-gateway-bgp.pp | 5 +- .../parser/functions/generate_remote_peers.rb | 3 - environment_config.yaml | 87 ++++++++++--------- 3 files changed, 48 insertions(+), 47 deletions(-) diff --git a/deployment_scripts/puppet/manifests/midonet-gateway-bgp.pp b/deployment_scripts/puppet/manifests/midonet-gateway-bgp.pp index dc72476..92bab05 100644 --- a/deployment_scripts/puppet/manifests/midonet-gateway-bgp.pp +++ b/deployment_scripts/puppet/manifests/midonet-gateway-bgp.pp @@ -13,6 +13,9 @@ $node = filter_nodes($nodes_hash, 'fqdn', $::fqdn) $gw_ip = $node[0]['public_address'] $gw_mask = $node[0]['public_netmask'] $net_hash = public_network_hash($gw_ip, $gw_mask) +$bgp_subnet = split($midonet_settings['bgp_cidr'], '/') +$bgp_subnet_ip = $bgp_subnet[0] +$bgp_subnet_cidr = $bgp_subnet[1] notify {"peers": message => "floating neeet si $remote_peers" @@ -73,7 +76,7 @@ midonet_gateway { $::fqdn: tenant_name => $tenant_name, interface => 'gw-veth-mn', local_as => $midonet_settings['local_as'], - bgp_port => { 'port_address' => $gw_ip, 'net_prefix' => $net_hash['network_address'], 'net_length' => $net_hash['mask']}, + bgp_port => { 'port_address' => $midonet_settings['bgp_ip'], 'net_prefix' => $bgp_subnet_ip, 'net_length' => $bgp_subnet_cidr }, remote_peers => $remote_peers, advertise_net => [{ 'net_prefix' => $f_net_cidr[0], 'net_length' => $f_net_cidr[1]}] } diff --git a/deployment_scripts/puppet/modules/plugin_midonet/lib/puppet/parser/functions/generate_remote_peers.rb b/deployment_scripts/puppet/modules/plugin_midonet/lib/puppet/parser/functions/generate_remote_peers.rb index f90c2c2..74c3327 100644 --- a/deployment_scripts/puppet/modules/plugin_midonet/lib/puppet/parser/functions/generate_remote_peers.rb +++ b/deployment_scripts/puppet/modules/plugin_midonet/lib/puppet/parser/functions/generate_remote_peers.rb @@ -21,9 +21,6 @@ module Puppet::Parser::Functions if not mn_settings['remote_ip1'].empty? and not mn_settings['remote_as1'].empty? result.push({"as" => mn_settings['remote_as1'], "ip" => mn_settings['remote_ip1']}) end - if not mn_settings['remote_ip2'].empty? and not mn_settings['remote_as2'].empty? - result.push({"as" => mn_settings['remote_as2'], "ip" => mn_settings['remote_ip2']}) - end return result end end diff --git a/environment_config.yaml b/environment_config.yaml index 2e72b71..eada51d 100644 --- a/environment_config.yaml +++ b/environment_config.yaml @@ -64,9 +64,9 @@ attributes: # Floating IP range # floating_cidr: value: '' - label: 'Floating Network CIDR' + label: 'Floating Network subnet' description: 'CIDR of the Floating Network. Will override the default settings' - weight: 30 + weight: 20 type: "text" regex: source: '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/(3[012]|[12]?[0-9])$' @@ -76,7 +76,7 @@ attributes: value: '' label: 'Floating Network Gateway IP' description: 'Gateway of the Floating Network. Will override the default settings' - weight: 35 + weight: 21 type: "text" regex: source: '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$' @@ -84,71 +84,72 @@ attributes: floating_ip_range_start: value: '' - label: 'Floating Range start' - description: 'First IP address of the Floating Range. Will override the default settings' - weight: 36 + label: 'Floating Network range start' + description: 'First IP address of the Floating Network range. Will override the default settings' + weight: 22 type: "text" regex: source: '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$' - error: 'Floating range start value must be an IP address' + error: 'Floating Network range start value must be an IP address' floating_ip_range_end: value: '' - label: 'Floating Range end' - description: 'Last IP address of the Floating Range. Will override the default settings' - weight: 37 + label: 'Floating Network range end' + description: 'Last IP address of the Floating Network range. Will override the default settings' + weight: 23 type: "text" regex: source: '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$' - error: 'Floating range last value must be an IP address' + error: 'Floating Network range last value must be an IP address' ## BGP Options ### + bgp_cidr: + value: '' + label: 'BGP routing subnet' + description: 'CIDR of the BGP network' + weight: 30 + type: "text" + regex: + source: '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/(3[012]|[12]?[0-9])$' + error: 'BGP Network must be a CIDR' + + bgp_ip: + value: '' + label: 'BGP local IP address' + description: 'IP address of the first Local BGP peer' + weight: 31 + type: "text" + regex: + source: '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$' + error: 'Local BGP peer must be an IP address' + local_as: value: '' - label: 'Local AS' - description: 'Autonomous System number' - weight: 55 + label: 'BGP local AS' + description: 'Autonomous System Number of the MidoNet Gateway' + weight: 32 type: "text" regex: source: '^([0-9]){5}$' - error: "Local AS must be an integer of 5 digits" - - remote_as1: - value: '' - label: 'BGP peer 1 AS' - description: 'Autonomous System number of the first BGP peer' - weight: 65 - type: "text" - regex: - source: '^([0-9]){5}$' - error: "Remote AS must be an integer of 5 digits" + error: "BGP local AS must be an integer of 5 digits" remote_ip1: value: '' - label: 'BGP peer 1 IP address' - description: 'IP address of the first BGP peer' - weight: 75 + label: 'BGP peer IP address' + description: 'IP address of the BGP peer' + weight: 33 type: "text" regex: source: '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$' error: 'Remote BGP peer must be an IP address' - remote_as2: + remote_as1: value: '' - label: 'BGP peer 2 AS' - description: 'Autonomous System number of the second BGP peer' - weight: 85 + label: 'BGP peer AS' + description: 'Autonomous System Number of the BGP peer' + weight: 34 type: "text" regex: - source: '^$|(^([0-9]){5}$)' - error: "Remote AS must be an integer of 5 digits or empty" + source: '^([0-9]){5}$' + error: "Remote AS must be an integer of 5 digits" - remote_ip2: - value: '' - label: 'BGP peer 2 IP address' - description: 'IP address of the second BGP peer' - weight: 95 - type: "text" - regex: - source: '^$|(^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$)' - error: 'Remote BGP peer must be an IP address or empty'