Network-related changes

Network settings for contrail controllers updated.
Contrail controllers default route changed to public network gateway.
Metadata shared secret support added to contrail vrouter config.

Change-Id: I2311509f051b95bdfb657d27fd53261e625c4810
This commit is contained in:
Oleksandr Martsyniuk 2015-04-07 17:15:20 +03:00
parent af6617de7c
commit 225db4d574
6 changed files with 41 additions and 24 deletions

View File

@ -1,8 +1,20 @@
Contrail
============
Mirantis Fuel Contrail plugin
=============================
Compatible versions:
- Mirantis Fuel 6.1
- Juniper Contrail 2.01
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
cd fuel-plugin-contrail/
fpb --build .
- Check if file contrail-1.0-1.0.0-0.noarch.rpm was created.

View File

@ -7,20 +7,7 @@ case $operatingsystem
$pkgs = ['python-crypto','python-netaddr','python-paramiko','ifenslave-2.6','patch',
'openjdk-7-jre-headless','contrail-fabric-utils','contrail-setup']
$pip_pkgs = ['ecdsa-0.10','Fabric-1.7.0']
#####################################
# Workaround for fuel bug 1438127
exec {'remove_default_gw':
command => '/sbin/ip route del default',
}
->
exec {'add_default_gw':
command => "/sbin/ip route add default via ${contrail::master_ip}",
before => Class['Contrail::Package'],
}
#####################################
}
CentOS:
{
$pkgs = ['python-netaddr','python-paramiko','patch',
@ -35,8 +22,9 @@ class { 'contrail::network':
ifname => $contrail::ifname,
netmask => $contrail::netmask_short,
public_addr => $contrail::public_addr,
public_netmask => $contrail::public_prefix,
public_if => $contrail::public_if
public_netmask => $contrail::public_netmask,
public_if => $contrail::public_if,
public_gw => $contrail::public_gw
} ->
class { 'contrail::ssh':

View File

@ -37,16 +37,19 @@ $address=get_ip_from_range($private_first,$private_last,$netmask_short,$uid,'fir
# Public address
$neutron_settings=hiera('quantum_settings')
$public_cidr=$neutron_settings['predefined_networks']['net04_ext']['L3']['subnet']
$public_tmp=split($public_cidr,'/')
$public_netmask=$public_tmp[1] # netmask prefix here
$public_first=get_first_ip($public_cidr)
$public_last=get_last_ip($public_cidr)
$public_tmp=split($public_cidr,'/')
$public_prefix=$public_tmp[1] # netmask prefix here
$public_addr=get_ip_from_range($public_first,$public_last,$public_prefix,$uid,'last')
$public_addr=get_ip_from_range($public_first,$public_last,$public_netmask,$uid,'last')
$public_if=$settings['contrail_public_if']
$public_gw=$neutron_settings['predefined_networks']['net04_ext']['L3']['gateway']
$contrail_mgmt_vip=get_last_ip(get_network_role_property('management', 'cidr'))
$metadata_secret=$neutron_settings['metadata']['metadata_proxy_shared_secret']
$contrail_node_basename='contrail'
$deployment_node="${contrail_node_basename}-1"

View File

@ -5,12 +5,16 @@ class contrail::network (
$netmask,
$public_addr = undef,
$public_netmask = undef,
$public_if = undef
$public_if = undef,
$public_gw = undef
) {
Exec {
path => '/bin:/sbin:/usr/bin:/usr/sbin',
}
# Remove interface from the bridge
exec {"remove_${ifname}":
path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ],
command => "brctl delif br-aux ${ifname}",
returns => [0,1] # Idempotent
} ->
@ -31,11 +35,20 @@ class contrail::network (
l23network::l3::ifconfig {$public_if:
interface => $public_if,
ipaddr => "${public_addr}/${public_netmask}",
before => Exec["ifup-${public_if}"],
}
}
# l23network::l3::ifconfig does not brings the interface up. Bug? Check it later
exec {"ifup-${public_if}":
command => "/sbin/ip link set up dev ${public_if}",
command => "ip link set up dev ${public_if}",
} ->
exec {'remove_default_gw':
command => '/sbin/ip route del default',
returns => [0,2] # Idempotent
} ->
# contrail controllers must be available from outer nets
exec {"add-default-route-via-${public_gw}":
command => "ip route add default via ${public_gw}",
}
}
'compute':{

View File

@ -12,6 +12,7 @@ max_control_nodes=2
type=kvm
[FLOWS]
[METADATA]
metadata_proxy_secret=<%= scope.lookupvar('contrail::metadata_secret') %>
[NETWORKS]
control_network_ip=<%= scope.lookupvar('contrail::address') %>
[VIRTUAL-HOST-INTERFACE]

View File

@ -23,7 +23,7 @@ case node['role']
role_os << 'os_ctrl_'+mgm_ip.count.to_s
when 'base-os'
priv_ip << scope.function_get_ip_from_range([ scope.lookupvar('contrail::private_first'),scope.lookupvar('contrail::private_last'),scope.lookupvar('contrail::netmask_short'),node['uid'],'first'])
public_ip_baseos << scope.function_get_ip_from_range([ scope.lookupvar('contrail::public_first'),scope.lookupvar('contrail::public_last'),scope.lookupvar('contrail::public_prefix'),node['uid'],'last'])
public_ip_baseos << scope.function_get_ip_from_range([ scope.lookupvar('contrail::public_first'),scope.lookupvar('contrail::public_last'),scope.lookupvar('contrail::public_netmask'),node['uid'],'last'])
mgm_ip_baseos << node['internal_address']
# Also find out a deployment node
if node['user_node_name'] == scope.lookupvar('contrail::deployment_node')