Add support for ODL-OVS IPv6 deployment

Make necessary changes for proper deployment
of ODL on IPv6 network.

Change-Id: Id7a0986f886a81b2041987b0d5a95edf2160e05e
Depends-On: Idd257cf4666b853eb4c52861f9f400b6dbdeeadb
Partial-Bug: #1783196
(cherry picked from commit 66292a5886)
This commit is contained in:
Janki Chhatbar 2018-08-02 15:55:52 +05:30 committed by Janki Chhatbar
parent e44b525066
commit 78b51d075d
4 changed files with 47 additions and 3 deletions

View File

@ -0,0 +1,14 @@
Puppet::Functions.create_function(:add_brackets) do
dispatch :add_brackets do
param 'String', :odl_ip
end
def add_brackets(odl_ip)
if odl_ip =~ /\[.*\]/
return odl_ip
else
bracketed_ip = "[#{odl_ip}]"
return bracketed_ip
end
end
end

View File

@ -51,6 +51,10 @@
# for more details. # for more details.
# Defaults to hiera('step') # Defaults to hiera('step')
# #
# [*enable_ipv6*]
# (Optional) Whether all IPs are IPv6 address or not.
# Defaults to hiera(''enable_ipv6', false)
#
class tripleo::profile::base::neutron::plugins::ml2::opendaylight ( class tripleo::profile::base::neutron::plugins::ml2::opendaylight (
$odl_port = hiera('opendaylight::odl_rest_port'), $odl_port = hiera('opendaylight::odl_rest_port'),
$odl_username = hiera('opendaylight::username'), $odl_username = hiera('opendaylight::username'),
@ -60,12 +64,17 @@ class tripleo::profile::base::neutron::plugins::ml2::opendaylight (
$enable_internal_tls = hiera('enable_internal_tls', false), $enable_internal_tls = hiera('enable_internal_tls', false),
$internal_api_fqdn = hiera('cloud_name_internal_api'), $internal_api_fqdn = hiera('cloud_name_internal_api'),
$step = Integer(hiera('step')), $step = Integer(hiera('step')),
$enable_ipv6 = hiera('enable_ipv6', false),
) { ) {
if $step >= 4 { if $step >= 4 {
if $enable_internal_tls { if $enable_internal_tls {
if empty($internal_api_fqdn) { fail('Internal API FQDN is Empty') } if empty($internal_api_fqdn) { fail('Internal API FQDN is Empty') }
$odl_url_addr = $internal_api_fqdn $odl_url_addr = $internal_api_fqdn
} elsif $enable_ipv6 {
# NOTE: Works when both tls and v6 are true as fqdn doesnot need [ ] around it, only v6 IP needs
# Needs testing with both TLS and v6 enabled.
$odl_url_addr = add_brackets($odl_url_ip)
} else { } else {
if empty($odl_url_ip) { fail('OpenDaylight API VIP is Empty') } if empty($odl_url_ip) { fail('OpenDaylight API VIP is Empty') }
$odl_url_addr = $odl_url_ip $odl_url_addr = $odl_url_ip

View File

@ -76,6 +76,10 @@
# will be created with correct permissions, inorder to support vhostuser # will be created with correct permissions, inorder to support vhostuser
# client mode. # client mode.
# #
# [*enable_ipv6*]
# (Optional) Whether all IPs are IPv6 address or not.
# Defaults to hiera(''enable_ipv6', false)
#
class tripleo::profile::base::neutron::plugins::ovs::opendaylight ( class tripleo::profile::base::neutron::plugins::ovs::opendaylight (
$odl_port = hiera('opendaylight::odl_rest_port'), $odl_port = hiera('opendaylight::odl_rest_port'),
$odl_check_url = hiera('opendaylight_check_url'), $odl_check_url = hiera('opendaylight_check_url'),
@ -89,6 +93,7 @@ class tripleo::profile::base::neutron::plugins::ovs::opendaylight (
$vhostuser_socket_group = hiera('tripleo::profile::base::neutron::plugins::ovs::opendaylight::vhostuser_socket_group', 'qemu'), $vhostuser_socket_group = hiera('tripleo::profile::base::neutron::plugins::ovs::opendaylight::vhostuser_socket_group', 'qemu'),
$vhostuser_socket_user = hiera('tripleo::profile::base::neutron::plugins::ovs::opendaylight::vhostuser_socket_user', 'qemu'), $vhostuser_socket_user = hiera('tripleo::profile::base::neutron::plugins::ovs::opendaylight::vhostuser_socket_user', 'qemu'),
$vhostuser_socket_dir = hiera('neutron::plugins::ovs::opendaylight::vhostuser_socket_dir', undef), $vhostuser_socket_dir = hiera('neutron::plugins::ovs::opendaylight::vhostuser_socket_dir', undef),
$enable_ipv6 = hiera('enable_ipv6', false),
) { ) {
if $step >= 3 { if $step >= 3 {
@ -108,17 +113,29 @@ class tripleo::profile::base::neutron::plugins::ovs::opendaylight (
if empty($odl_url_ip) { fail('OpenDaylight API VIP is Empty') } if empty($odl_url_ip) { fail('OpenDaylight API VIP is Empty') }
if $enable_ipv6 {
$odl_api_ips_parsed = $odl_api_ips.map |$odl_api_ip| {
add_brackets($odl_api_ip)
}
$odl_url_ip_parsed = add_brackets($odl_url_ip)
} else {
$odl_api_ips_parsed = $odl_api_ips
$odl_url_ip_parsed = $odl_url_ip
}
# Build URL to check if ODL is up before connecting OVS # Build URL to check if ODL is up before connecting OVS
$opendaylight_url = "${conn_proto}://${odl_url_ip}:${odl_port}/${odl_check_url}" $opendaylight_url = "${conn_proto}://${odl_url_ip_parsed}:${odl_port}/${odl_check_url}"
if $enable_internal_tls { if $enable_internal_tls {
$tls_certfile = $certificate_specs['service_certificate'] $tls_certfile = $certificate_specs['service_certificate']
$tls_keyfile = $certificate_specs['service_key'] $tls_keyfile = $certificate_specs['service_key']
$odl_ovsdb_str = join(regsubst($odl_api_ips, '.+', 'ssl:\0:6640'), ' ') $odl_ovsdb_str = join(regsubst($odl_api_ips_parsed, '.+', 'ssl:\0:6640'), ' ')
} else { } else {
$tls_certfile = undef $tls_certfile = undef
$tls_keyfile = undef $tls_keyfile = undef
$odl_ovsdb_str = join(regsubst($odl_api_ips, '.+', 'tcp:\0:6640'), ' ') $odl_ovsdb_str = join(regsubst($odl_api_ips_parsed, '.+', 'tcp:\0:6640'), ' ')
} }
class { '::neutron::plugins::ovs::opendaylight': class { '::neutron::plugins::ovs::opendaylight':

View File

@ -0,0 +1,4 @@
---
features:
- |
Add support to enable ODL deployment on IPv6 networks