diff --git a/lib/puppet/functions/add_brackets.rb b/lib/puppet/functions/add_brackets.rb new file mode 100644 index 000000000..342b823dc --- /dev/null +++ b/lib/puppet/functions/add_brackets.rb @@ -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 diff --git a/manifests/profile/base/neutron/plugins/ml2/opendaylight.pp b/manifests/profile/base/neutron/plugins/ml2/opendaylight.pp index e690e169e..a1f0e1ffa 100644 --- a/manifests/profile/base/neutron/plugins/ml2/opendaylight.pp +++ b/manifests/profile/base/neutron/plugins/ml2/opendaylight.pp @@ -51,6 +51,10 @@ # for more details. # 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 ( $odl_port = hiera('opendaylight::odl_rest_port'), $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), $internal_api_fqdn = hiera('cloud_name_internal_api'), $step = Integer(hiera('step')), + $enable_ipv6 = hiera('enable_ipv6', false), ) { if $step >= 4 { if $enable_internal_tls { if empty($internal_api_fqdn) { fail('Internal API FQDN is Empty') } $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 { if empty($odl_url_ip) { fail('OpenDaylight API VIP is Empty') } $odl_url_addr = $odl_url_ip diff --git a/manifests/profile/base/neutron/plugins/ovs/opendaylight.pp b/manifests/profile/base/neutron/plugins/ovs/opendaylight.pp index f365b1792..d0856af0c 100644 --- a/manifests/profile/base/neutron/plugins/ovs/opendaylight.pp +++ b/manifests/profile/base/neutron/plugins/ovs/opendaylight.pp @@ -76,6 +76,10 @@ # will be created with correct permissions, inorder to support vhostuser # 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 ( $odl_port = hiera('opendaylight::odl_rest_port'), $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_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), + $enable_ipv6 = hiera('enable_ipv6', false), ) { 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 $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 - $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 { $tls_certfile = $certificate_specs['service_certificate'] $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 { $tls_certfile = 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': diff --git a/releasenotes/notes/add-support-for-IPv6-deployment-988400c781b92066.yaml b/releasenotes/notes/add-support-for-IPv6-deployment-988400c781b92066.yaml new file mode 100644 index 000000000..67ee7034f --- /dev/null +++ b/releasenotes/notes/add-support-for-IPv6-deployment-988400c781b92066.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Add support to enable ODL deployment on IPv6 networks \ No newline at end of file