GW for Private network removed from plugin settings

Default environment settings expect BGP peers to be
in the Private cluster network.
In case of using multiple cluster networks,
Fuel Node groups feature must be used.
Plugin puppet code updated to use gateway for Private
network set via Fuel network settings.

Change-Id: Icaf016dc6f8c3f64b97aa3249d06a2987940279b
This commit is contained in:
Oleksandr Martsyniuk 2015-10-28 18:15:37 +02:00 committed by Illia Polliul
parent f2d34d0e85
commit 77e06009f2
11 changed files with 24 additions and 88 deletions

View File

@ -3,18 +3,18 @@ Mirantis Fuel Contrail plugin
Compatible versions:
- Mirantis Fuel 6.1
- Juniper Contrail 2.20
- Mirantis Fuel 7.0
- Juniper Contrail 3.0
How to build plugin:
- Install fuel plugin builder (fpb)
- Clone plugin repo and run fpb there:
git clone https://github.com/stackforge/fuel-plugin-contrail
git clone https://github.com/openstack/fuel-plugin-contrail
cd fuel-plugin-contrail/
fpb --build .
- Check if file contrail-1.0-1.0.1-1.noarch.rpm was created.
- Check if file contrail-3.0-3.0.0-1.noarch.rpm was created.

View File

@ -19,7 +19,7 @@ Exec { path => '/bin:/sbin:/usr/bin:/usr/sbin', refresh => 'echo NOOP_ON_REFRESH
class { 'contrail::network':
node_role => $node_role,
address => $contrail::address,
ifname => $contrail::ifname,
ifname => $contrail::phys_dev,
netmask => $contrail::netmask_short,
} ->

View File

@ -21,7 +21,7 @@ if $contrail::node_name =~ /^contrail.\d+$/ {
class { 'contrail::network':
node_role => $node_role,
address => $contrail::address,
ifname => $contrail::ifname,
ifname => $contrail::phys_dev,
netmask => $contrail::netmask_short,
default_gw => $contrail::default_gw,
}

View File

@ -1,33 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
require 'yaml'
module Puppet::Parser::Functions
newfunction(:get_private_ifname, :type => :rvalue, :doc => <<-EOS
Returns interface selected as "Private network" in web UI
EOS
) do |args|
ifname = String.new
yml = YAML.load(File.open("/etc/astute.yaml"))
yml['network_scheme']['transformations'].each do |entry|
if entry['bridge'] == "br-aux" or entry['bridge'] == "br-mesh"
ifname = entry['name']
end
end
return ifname.to_s
end
end

View File

@ -49,11 +49,13 @@ $mos_mgmt_vip=hiera('management_vip')
$asnum = $settings['contrail_asnum']
$external = $settings['contrail_external']
$route_target = $settings['contrail_route_target']
$gateways = split($settings['contrail_gateways'], ',')
# Network configuration
prepare_network_config($network_scheme)
$ifname = get_private_ifname()
$private_if=get_network_role_property('neutron/mesh', 'interface')
$phys_dev=get_network_role_property('neutron/mesh', 'phys_dev')
$interface=get_network_role_property('neutron/mesh', 'interface')
$gateway=$network_scheme['endpoints'][$interface]['gateway']
$address=get_network_role_property('neutron/mesh', 'ipaddr')
$cidr=get_network_role_property('neutron/mesh', 'cidr')
$netmask=get_network_role_property('neutron/mesh', 'netmask')
@ -64,9 +66,6 @@ $mgmt_cidr=get_network_role_property('management', 'cidr')
$mgmt_netmask=get_network_role_property('management', 'netmask')
$mgmt_netmask_short=netmask_to_cidr($mgmt_netmask)
$default_gw = hiera('management_vrouter_vip')
$private_gw = $settings['contrail_private_gw']
$contrail_mgmt_vip=get_last_ip(hiera('management_network_range'))
$contrail_private_vip=get_last_ip(hiera('private_network_range'))

View File

@ -19,39 +19,16 @@ class contrail::network (
$netmask,
$default_gw = undef
) {
$br_file = $operatingsystem ? {
$br_file = $::operatingsystem ? {
'Ubuntu' => '/etc/network/interfaces.d/ifcfg-br-mesh',
'CentOS' => '/etc/sysconfig/network-scripts/ifcfg-br-mesh',
}
$gateways = split($contrail::settings['contrail_gateways'], ',')
define contrail::network::add_route ( $destination, $gateway ) {
exec {"check_route_to_${name}":
command => "ip route del ${name}",
onlyif => "ip route | grep -E ^${name}' via'.*",
before => L23network::L3::Route[$name],
}
l23network::l3::route {$name:
destination => $name,
gateway => $gateway,
}
}
case $node_role {
'base-os':{
sysctl::value { 'net.ipv4.conf.all.rp_filter': value => '0' }
sysctl::value { 'net.ipv4.conf.default.rp_filter': value => '0' }
sysctl::value { 'net.ipv4.conf.br-mesh.rp_filter': value => '0' }
sysctl::value { 'net.ipv4.conf.br-mgmt.rp_filter': value => '0' }
class { 'l23network': use_ovs => false }
case $contrail::private_gw {
'': { notify { 'No gateway for private network':} }
default: {
contrail::network::add_route { $gateways:
destination => $gateways,
gateway => $contrail::private_gw,
}
}
sysctl::value {
'net.ipv4.conf.all.rp_filter': value => '2';
'net.ipv4.conf.default.rp_filter': value => '2';
}
}
'compute':{
@ -65,7 +42,7 @@ class contrail::network (
command => 'ip addr flush dev br-mesh',
returns => [0,1] # Idempotent
}
case $operatingsystem {
case $::operatingsystem {
'Ubuntu': {
file {'/etc/network/interfaces.d/ifcfg-vhost0':
ensure => present,

View File

@ -19,8 +19,6 @@ class contrail::provision ( $node_role ) {
path => '/usr/bin:/bin:/sbin',
}
$gateways = split($contrail::settings['contrail_gateways'], ',')
define contrail::provision::prov_ext_bgp {
exec { "prov_external_bgp_${name}":
command => "python /opt/contrail/utils/provision_mx.py \
@ -51,7 +49,7 @@ then exit 1; fi",
creates => '/opt/contrail/prov_control_bgp-DONE',
}
if $contrail::node_name == $contrail::deployment_node {
contrail::provision::prov_ext_bgp { $gateways:
contrail::provision::prov_ext_bgp { $contrail::gateways:
require => [Exec['wait_for_api'],Exec['prov_control_bgp']],
} ->
exec { 'prov_metadata_services':

View File

@ -5,7 +5,7 @@ kmod=vrouter
pname=contrail-vrouter-agent
LIBDIR=/usr/lib64
DEVICE=vhost0
dev=<%= scope.function_get_private_ifname([]) %>
dev=<%= scope.lookupvar('contrail::phys_dev') %>
vgw_subnet_ip=__VGW_SUBNET_IP__
vgw_intf=__VGW_INTF_LIST__
LOGFILE=--log-file=/var/log/contrail/vrouter.log

View File

@ -18,8 +18,10 @@ control_network_ip=<%= scope.lookupvar('contrail::address') %>
[VIRTUAL-HOST-INTERFACE]
name=vhost0
ip=<%= scope.lookupvar('contrail::address') %>/<%= scope.lookupvar('contrail::netmask_short') %>
physical_interface=<%= scope.function_get_private_ifname([]) %>
gateway=<%= scope.lookupvar('contrail::private_gw') %>
physical_interface=<%= scope.lookupvar('contrail::phys_dev') %>
<% if scope.lookupvar('contrail::gateway') != :undef -%>
gateway=<%= scope.lookupvar('contrail::gateway') %>
<% end -%>
[GATEWAY-0]
[GATEWAY-1]
[SERVICE-INSTANCE]

View File

@ -1,5 +1,7 @@
auto vhost0
iface vhost0 inet static
address <%= scope.lookupvar('contrail::address') %>/<%= scope.lookupvar('contrail::netmask_short') %>
<% if scope.lookupvar('contrail::gateway') != :undef -%>
gateway <%= scope.lookupvar('contrail::gateway') %>
<% end -%>
network_name contrail

View File

@ -24,15 +24,6 @@ attributes:
regex:
source: '^(?:(6553[0-5])|(655[0-2]\d)|(65[0-4]\d{2})|(6[0-4]\d{3})|([1-5]\d{4})|([1-9]\d{1,3})|([1-9]))$'
error: "Invalid AS number"
contrail_private_gw:
value: ''
label: 'Gateway for Private network'
description: 'The IP address of gateway for contrail private network to reach BGP peers. Empty if not needed.'
weight: 30
type: "text"
regex:
source: '^((?:\d|1?\d\d|2[0-4]\d|25[0-5])(?:\.(?:\d|1?\d\d|2[0-4]\d|25[0-5])){3})|(?:^)$'
error: "Invalid IP address"
contrail_gateways:
value: '10.109.3.250'
label: 'GW IP'