Add settings for single node group gateway

Change-Id: I85a66d5d30fd8690af8822ba66c18e9b27d44b62
Partial-Bug: #1624507
This commit is contained in:
Przemysław Szypowicz 2016-10-03 12:56:48 +02:00 committed by Illia Polliul
parent f723a107cf
commit d8d88e4a3a
3 changed files with 25 additions and 10 deletions

View File

@ -42,7 +42,11 @@ class contrail {
if $routes {
$gateway = $routes[0]['via']
} else {
$gateway = false
if ($settings['contrail_single_gateway']) {
$gateway = $settings['contrail_single_gateway']
} else {
$gateway = false
}
}
$address = pick(get_network_role_property('neutron/mesh', 'ipaddr'), get_network_role_property('contrail/vhost0', 'ipaddr'))

View File

@ -1,19 +1,21 @@
auto vhost0
iface vhost0 inet static
pre-up /opt/contrail/bin/if-vhost0
address <%= scope.lookupvar('contrail::address') %>/<%= scope.lookupvar('contrail::netmask_short') %>
address <%= scope.lookupvar('::contrail::address') %>/<%= scope.lookupvar('::contrail::netmask_short') %>
network_name contrail
<% if scope.lookupvar('contrail::phys_dev_mtu') -%>
mtu <%= scope.lookupvar('contrail::phys_dev_mtu') %>
<% if scope.lookupvar('::contrail::phys_dev_mtu') -%>
mtu <%= scope.lookupvar('::contrail::phys_dev_mtu') %>
<% end -%>
<% if scope.lookupvar('contrail::gateway') -%>
<% scope.lookupvar('contrail::gateways').each do |gw| -%>
<% if scope.lookupvar('::contrail::gateway') -%>
<% scope.lookupvar('::contrail::gateways').each do |gw| -%>
post-up ip route add <%= gw %>/32 via <%= scope.lookupvar('contrail::gateway') %> dev vhost0
<% end -%>
<% scope.lookupvar('contrail::routes').each do |route| -%>
<% if scope.lookupvar('::contrail::routes') -%>
<% scope.lookupvar('::contrail::routes').each do |route| -%>
post-up ip route add <%= route['net'] %> via <%= route['via'] %> dev vhost0
<% end -%>
<% end -%>
<% if scope.lookupvar('contrail::compute_dpdk_enabled') -%>
<% end -%>
<% if scope.lookupvar('::contrail::compute_dpdk_enabled') -%>
post-up ip link set vhost0 address <%= @dpdk_dev_mac %>
<% end -%>

View File

@ -22,10 +22,19 @@ attributes:
regex:
source: '^(?!(?:0(?:\.0){3}|255(?:\.255){3}))(?:\d|1?\d\d|2[0-4]\d|25[0-5])(?:\.(?:\d|1?\d\d|2[0-4]\d|25[0-5])){3}(?:,\s*(?!(?:0(?:\.0){3}|255(?:\.255){3}))(?:\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 list"
contrail_single_gateway:
value: ''
label: 'GW IP for Private net'
description: 'IP address of gateway in private net, only for single node deployment.'
weight: 40
type: "text"
regex:
source: '(^$)|(^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$)'
error: "Invalid IP address"
contrail_external:
value: '10.100.1.0/24'
label: 'External IP CIDR'
description: 'The CIDR for Contrail external network'
label: 'Floating IP CIDR'
description: 'The CIDR for floating network'
weight: 50
type: "text"
regex: