GRE segmentation type support extended
Improvements: - private IP address assignments from Fuel's neutron/mesh network - additional static routes handling Change-Id: I40997b3f0086c96678c3fb550a42c154de4f3dbc
This commit is contained in:
parent
0fbe242ef1
commit
f04d2802e5
|
@ -1,21 +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.
|
|
||||||
|
|
||||||
# A helper to run pip
|
|
||||||
define contrail::exec_pip ( $path ){
|
|
||||||
exec { "Install-pip-package-${name}":
|
|
||||||
path => '/usr/local/bin/:/usr/bin:/bin',
|
|
||||||
command => "pip install --upgrade --no-deps --index-url='' ${path}/${name}.tar.gz",
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -46,17 +46,16 @@ $asnum = $settings['contrail_asnum']
|
||||||
# Network configuration
|
# Network configuration
|
||||||
prepare_network_config($network_scheme)
|
prepare_network_config($network_scheme)
|
||||||
$ifname = get_private_ifname()
|
$ifname = get_private_ifname()
|
||||||
$private_first = $settings['contrail_private_start']
|
$address=get_network_role_property('neutron/mesh', 'ipaddr')
|
||||||
$private_last = $settings['contrail_private_end']
|
$cidr=get_network_role_property('neutron/mesh', 'cidr')
|
||||||
# "cidr" is actually a network address with subnet, i.e. 192.168.150.0/24
|
$netmask=get_network_role_property('neutron/mesh', 'netmask')
|
||||||
$cidr = $settings['contrail_private_cidr']
|
$netmask_short=netmask_to_cidr($netmask)
|
||||||
$netmask=cidr_to_netmask($cidr) # returns i.e. "255.255.255.0"
|
|
||||||
$netmask_short=netmask_to_cidr($netmask) # returns i.e. "/24"
|
|
||||||
$address=get_ip_from_range($private_first,$private_last,$netmask_short,$uid,'first')
|
|
||||||
|
|
||||||
$default_gw = hiera('management_vrouter_vip')
|
$default_gw = hiera('management_vrouter_vip')
|
||||||
$private_gw = $settings['contrail_private_gw']
|
$private_gw = $settings['contrail_private_gw']
|
||||||
|
|
||||||
$contrail_mgmt_vip=get_last_ip(get_network_role_property('management', 'cidr'))
|
$contrail_mgmt_vip=get_last_ip(get_network_role_property('management', 'cidr'))
|
||||||
|
$contrail_private_vip=get_last_ip(get_network_role_property('neutron/mesh', 'cidr'))
|
||||||
|
|
||||||
$contrail_node_basename='contrail'
|
$contrail_node_basename='contrail'
|
||||||
$deployment_node="${contrail_node_basename}-1"
|
$deployment_node="${contrail_node_basename}-1"
|
||||||
|
@ -64,7 +63,7 @@ $deployment_node="${contrail_node_basename}-1"
|
||||||
$contrail_node_num = inline_template("<%-
|
$contrail_node_num = inline_template("<%-
|
||||||
rv=0
|
rv=0
|
||||||
@nodes.each do |node|
|
@nodes.each do |node|
|
||||||
if node['user_node_name'] =~ /^#{@contrail_node_basename}-.*/
|
if (node['user_node_name'] =~ /^#{@contrail_node_basename}-.*/ and node['role'] == 'base-os')
|
||||||
rv+=1
|
rv+=1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,11 +20,12 @@ class contrail::network (
|
||||||
$default_gw = undef
|
$default_gw = undef
|
||||||
) {
|
) {
|
||||||
$br_file = $operatingsystem ? {
|
$br_file = $operatingsystem ? {
|
||||||
'Ubuntu' => ['/etc/network/interfaces.d/ifcfg-br-aux', '/etc/network/interfaces.d/ifcfg-br-mesh'],
|
'Ubuntu' => '/etc/network/interfaces.d/ifcfg-br-mesh',
|
||||||
'CentOS' => ['/etc/sysconfig/network-scripts/ifcfg-br-aux', '/etc/sysconfig/network-scripts/ifcfg-br-mesh'],
|
'CentOS' => '/etc/sysconfig/network-scripts/ifcfg-br-mesh',
|
||||||
}
|
}
|
||||||
|
$gateways = split($contrail::settings['contrail_gateways'], ',')
|
||||||
|
|
||||||
define contrail::add_route ( $destination, $gateway ) {
|
define contrail::network::add_route ( $destination, $gateway ) {
|
||||||
exec {"check_route_to_${name}":
|
exec {"check_route_to_${name}":
|
||||||
command => "ip route del ${name}",
|
command => "ip route del ${name}",
|
||||||
onlyif => "ip route | grep ${name}",
|
onlyif => "ip route | grep ${name}",
|
||||||
|
@ -36,60 +37,46 @@ class contrail::network (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file { $br_file: ensure => absent } ->
|
|
||||||
# Remove interface from the bridge
|
|
||||||
exec {"remove_${ifname}_aux":
|
|
||||||
command => "brctl delif br-aux ${ifname}",
|
|
||||||
returns => [0,1] # Idempotent
|
|
||||||
} ->
|
|
||||||
exec {"remove_${ifname}_mesh":
|
|
||||||
command => "brctl delif br-mesh ${ifname}",
|
|
||||||
returns => [0,1] # Idempotent
|
|
||||||
}
|
|
||||||
->
|
|
||||||
exec {'flush_addr_br_mesh':
|
|
||||||
command => 'ip addr flush dev br-mesh',
|
|
||||||
returns => [0,1] # Idempotent
|
|
||||||
}
|
|
||||||
case $node_role {
|
case $node_role {
|
||||||
'base-os':{
|
'base-os':{
|
||||||
$gateways = split($contrail::settings['contrail_gateways'], ',')
|
|
||||||
class { 'l23network': use_ovs => false }
|
class { 'l23network': use_ovs => false }
|
||||||
l23network::l3::ifconfig {$ifname:
|
case $contrail::private_gw {
|
||||||
interface => $ifname,
|
'': { notify { 'No gateway for private network':} }
|
||||||
ipaddr => "${address}/${netmask}",
|
default: {
|
||||||
require => File[$br_file],
|
contrail::network::add_route { $gateways:
|
||||||
}
|
destination => $gateways,
|
||||||
exec {'remove_default_gw':
|
gateway => $contrail::private_gw,
|
||||||
command => '/sbin/ip route del default',
|
}
|
||||||
returns => [0,2] # Idempotent
|
}
|
||||||
} ->
|
|
||||||
exec {"add-default-route-via-${default_gw}":
|
|
||||||
command => "ip route add default via ${default_gw}",
|
|
||||||
} ->
|
|
||||||
contrail::add_route { $gateways:
|
|
||||||
destination => $gateways,
|
|
||||||
gateway => $contrail::private_gw,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'compute':{
|
'compute':{
|
||||||
case $operatingsystem
|
file { $br_file: ensure => absent } ->
|
||||||
{
|
# Remove interface from the bridge
|
||||||
Ubuntu:
|
exec {"remove_${ifname}_mesh":
|
||||||
{
|
command => "brctl delif br-mesh ${ifname}",
|
||||||
file {'/etc/network/interfaces.d/ifcfg-vhost0':
|
returns => [0,1] # Idempotent
|
||||||
ensure => present,
|
} ->
|
||||||
content => template('contrail/ubuntu-ifcfg-vhost0.erb'),
|
exec {'flush_addr_br_mesh':
|
||||||
}
|
command => 'ip addr flush dev br-mesh',
|
||||||
|
returns => [0,1] # Idempotent
|
||||||
|
}
|
||||||
|
case $operatingsystem {
|
||||||
|
'Ubuntu': {
|
||||||
|
file {'/etc/network/interfaces.d/ifcfg-vhost0':
|
||||||
|
ensure => present,
|
||||||
|
content => template('contrail/ubuntu-ifcfg-vhost0.erb'),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
CentOS:
|
'CentOS': {
|
||||||
{
|
exec {"remove_bridge_from_${ifname}_config":
|
||||||
file {'/etc/sysconfig/network-scripts/ifcfg-vhost0':
|
command => "sed -i '/BRIDGE/d' /etc/sysconfig/network-scripts/ifcfg-${ifname}",
|
||||||
ensure => present,
|
|
||||||
content => template('contrail/centos-ifcfg-vhost0.erb'),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
file {'/etc/sysconfig/network-scripts/ifcfg-vhost0':
|
||||||
|
ensure => present,
|
||||||
|
content => template('contrail/centos-ifcfg-vhost0.erb'),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default: { notify { "Node role ${node_role} not supported": } }
|
default: { notify { "Node role ${node_role} not supported": } }
|
||||||
|
|
|
@ -18,13 +18,20 @@ class contrail::package (
|
||||||
$pip_install = undef,
|
$pip_install = undef,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
define contrail::package::exec_pip ( $path ){
|
||||||
|
exec { "Install-pip-package-${name}":
|
||||||
|
path => '/usr/local/bin/:/usr/bin:/bin',
|
||||||
|
command => "pip install --upgrade --no-deps --index-url='' ${path}/${name}.tar.gz",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($install) {
|
if ($install) {
|
||||||
|
|
||||||
package { $install:
|
package { $install:
|
||||||
ensure => present,
|
ensure => present,
|
||||||
}
|
}
|
||||||
if ($pip_install) {
|
if ($pip_install) {
|
||||||
exec_pip { $pip_install:
|
contrail::package::exec_pip { $pip_install:
|
||||||
path => '/opt/contrail/python_packages',
|
path => '/opt/contrail/python_packages',
|
||||||
require => Package[$install],
|
require => Package[$install],
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ log_level=SYS_NOTICE
|
||||||
log_local=1
|
log_local=1
|
||||||
headless_mode=true
|
headless_mode=true
|
||||||
[DISCOVERY]
|
[DISCOVERY]
|
||||||
server=<%= scope.lookupvar('contrail::private_first') %>
|
server=<%= scope.lookupvar('contrail::contrail_private_vip') %>
|
||||||
max_control_nodes=2
|
max_control_nodes=2
|
||||||
[DNS]
|
[DNS]
|
||||||
[HYPERVISOR]
|
[HYPERVISOR]
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[DISCOVERY]
|
[DISCOVERY]
|
||||||
server=<%= scope.lookupvar('contrail::private_first') %>
|
server=<%= scope.lookupvar('contrail::contrail_private_vip') %>
|
||||||
port=5998
|
port=5998
|
|
@ -23,7 +23,7 @@ case node['role']
|
||||||
role_os << 'os_ctrl_'+mgm_ip.count.to_s
|
role_os << 'os_ctrl_'+mgm_ip.count.to_s
|
||||||
when 'base-os'
|
when 'base-os'
|
||||||
if node['user_node_name'] =~ /^#{contrail_node_basename}-.*/
|
if node['user_node_name'] =~ /^#{contrail_node_basename}-.*/
|
||||||
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'])
|
priv_ip << node['private_address']
|
||||||
mgm_ip_baseos << node['internal_address']
|
mgm_ip_baseos << node['internal_address']
|
||||||
# Also find out a deployment node
|
# Also find out a deployment node
|
||||||
if node['user_node_name'] == scope.lookupvar('contrail::deployment_node')
|
if node['user_node_name'] == scope.lookupvar('contrail::deployment_node')
|
||||||
|
@ -116,7 +116,7 @@ env.openstack = {
|
||||||
env.ha = {
|
env.ha = {
|
||||||
'internal_vip' : '<%= os_management_vip %>',
|
'internal_vip' : '<%= os_management_vip %>',
|
||||||
'external_vip' : '<%= os_public_vip %>',
|
'external_vip' : '<%= os_public_vip %>',
|
||||||
'contrail_internal_vip' : '<%= scope.lookupvar('contrail::private_first') %>',
|
'contrail_internal_vip' : '<%= scope.lookupvar('contrail::contrail_private_vip') %>',
|
||||||
'contrail_external_vip' : '<%= scope.lookupvar('contrail::contrail_mgmt_vip') %>',
|
'contrail_external_vip' : '<%= scope.lookupvar('contrail::contrail_mgmt_vip') %>',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ attributes:
|
||||||
# Show contrail only in supported network config
|
# Show contrail only in supported network config
|
||||||
metadata:
|
metadata:
|
||||||
restrictions:
|
restrictions:
|
||||||
- condition: "not (cluster:net_provider == 'neutron' and (networking_parameters:segmentation_type == 'vlan' or networking_parameters:segmentation_type == 'gre'))"
|
- condition: "not (cluster:net_provider == 'neutron' and networking_parameters:segmentation_type == 'gre')"
|
||||||
message: "Please use Neutron, the only network type supported with Contrail plugin."
|
message: "Please use Neutron with GRE segmentation, the only network type supported with Contrail plugin."
|
||||||
contrail_asnum:
|
contrail_asnum:
|
||||||
value: '64512'
|
value: '64512'
|
||||||
label: 'AS Number'
|
label: 'AS Number'
|
||||||
|
@ -13,46 +13,19 @@ attributes:
|
||||||
regex:
|
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]))$'
|
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"
|
error: "Invalid AS number"
|
||||||
contrail_private_cidr:
|
|
||||||
value: '10.109.3.0/24'
|
|
||||||
label: 'Private network CIDR'
|
|
||||||
description: 'CIDR for private network used in Contrail inter-node communication'
|
|
||||||
weight: 20
|
|
||||||
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}(?:\/(?:[1-2]\d|[8-9]))$'
|
|
||||||
error: "Invalid network CIDR"
|
|
||||||
contrail_private_start:
|
|
||||||
value: '10.109.3.5'
|
|
||||||
label: 'Private IP range start'
|
|
||||||
description: 'First IP address of contrail private network. NOTE: First one will be used as VIP address for controller HA'
|
|
||||||
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_private_end:
|
|
||||||
value: '10.109.3.254'
|
|
||||||
label: 'Private IP range end'
|
|
||||||
description: 'Last IP address of contrail private network'
|
|
||||||
weight: 40
|
|
||||||
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_private_gw:
|
contrail_private_gw:
|
||||||
value: '10.109.3.1'
|
value: ''
|
||||||
label: 'Gateway for Private network'
|
label: 'Gateway for Private network'
|
||||||
description: 'The IP address of gateway for contrail private network to reach BGP routers'
|
description: 'The IP address of gateway for contrail private network to reach BGP routers. Empty if not needed.'
|
||||||
weight: 40
|
weight: 40
|
||||||
type: "text"
|
type: "text"
|
||||||
regex:
|
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}$'
|
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"
|
error: "Invalid IP address"
|
||||||
contrail_gateways:
|
contrail_gateways:
|
||||||
value: '10.109.3.2,10.110.1.1'
|
value: '10.109.3.254,10.110.1.1'
|
||||||
label: 'GW IP'
|
label: 'GW IP'
|
||||||
description: 'Comma separated IP addresses of BGP peers'
|
description: 'Comma separated IP addresses of BGP peers.'
|
||||||
weight: 50
|
weight: 50
|
||||||
type: "text"
|
type: "text"
|
||||||
regex:
|
regex:
|
||||||
|
|
Loading…
Reference in New Issue