IPv6 support for ODL-OVS deployment
Add feature to also set OVS manager to the IPv6 address of ODL based on "enable_ipv6" flag value. Change-Id: I88d369082de1ce71cdeddf69287867c0af6d9e07 Closes-Bug: #1783067
This commit is contained in:

committed by
Janki Chhatbar

parent
2ba6c855bf
commit
c4e58a8f44
@@ -106,7 +106,8 @@ class neutron::plugins::ovs::opendaylight (
|
|||||||
$enable_tls = false,
|
$enable_tls = false,
|
||||||
$tls_key_file = undef,
|
$tls_key_file = undef,
|
||||||
$tls_cert_file = undef,
|
$tls_cert_file = undef,
|
||||||
$tls_ca_cert_file = undef
|
$tls_ca_cert_file = undef,
|
||||||
|
$enable_ipv6 = false,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include ::neutron::deps
|
include ::neutron::deps
|
||||||
@@ -136,26 +137,10 @@ class neutron::plugins::ovs::opendaylight (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if $odl_ovsdb_iface =~ /^tcp/ {
|
warning('TLS enabled, overriding all protocols')
|
||||||
warning('TLS enabled but odl_ovsdb_iface set to tcp. Will override to ssl')
|
$odl_ovsdb_iface_proto = 'ssl'
|
||||||
$odl_ovsdb_iface_parsed = regsubst($odl_ovsdb_iface, 'tcp:', 'ssl:', 'G')
|
$ovsdb_server_iface_proto = 'pssl'
|
||||||
} else {
|
$odl_check_url_proto = 'https'
|
||||||
$odl_ovsdb_iface_parsed = $odl_ovsdb_iface
|
|
||||||
}
|
|
||||||
|
|
||||||
if $ovsdb_server_iface =~ /^ptcp/ {
|
|
||||||
warning('TLS enabled but ovsdb_server_iface set to ptcp. Will override to pssl')
|
|
||||||
$ovsdb_server_iface_parsed = regsubst($ovsdb_server_iface, '^ptcp', 'pssl')
|
|
||||||
} else {
|
|
||||||
$ovsdb_server_iface_parsed = $ovsdb_server_iface
|
|
||||||
}
|
|
||||||
|
|
||||||
if $odl_check_url =~ /^http:/ {
|
|
||||||
warning('TLS enabled but odl_check_url set to http. Will override to https')
|
|
||||||
$odl_check_url_parsed = regsubst($odl_check_url, '^http:', 'https:')
|
|
||||||
} else {
|
|
||||||
$odl_check_url_parsed = $odl_check_url
|
|
||||||
}
|
|
||||||
|
|
||||||
$cert_data = convert_cert_to_string($tls_cert_file)
|
$cert_data = convert_cert_to_string($tls_cert_file)
|
||||||
$rest_data = @("END":json/L)
|
$rest_data = @("END":json/L)
|
||||||
@@ -177,8 +162,8 @@ class neutron::plugins::ovs::opendaylight (
|
|||||||
}
|
}
|
||||||
|-END
|
|-END
|
||||||
|
|
||||||
$ovsdb_arr = split($odl_ovsdb_iface_parsed, ' ')
|
$ovsdb_arr = split($odl_ovsdb_iface, ' ')
|
||||||
$odl_rest_port = regsubst($odl_check_url_parsed, '^.*:([0-9]+)/.*$', '\1')
|
$odl_rest_port = regsubst($odl_check_url, '^.*:([0-9]+)/.*$', '\1')
|
||||||
$ovsdb_arr.each |$ovsdb_uri| {
|
$ovsdb_arr.each |$ovsdb_uri| {
|
||||||
|
|
||||||
$odl_ip = regsubst($ovsdb_uri, 'ssl:(.+):[0-9]+', '\1')
|
$odl_ip = regsubst($ovsdb_uri, 'ssl:(.+):[0-9]+', '\1')
|
||||||
@@ -195,15 +180,26 @@ class neutron::plugins::ovs::opendaylight (
|
|||||||
require => Exec['Wait for NetVirt OVSDB to come up']
|
require => Exec['Wait for NetVirt OVSDB to come up']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
else {
|
||||||
$odl_ovsdb_iface_parsed = $odl_ovsdb_iface
|
$odl_ovsdb_iface_proto = 'tcp'
|
||||||
$ovsdb_server_iface_parsed = $ovsdb_server_iface
|
$ovsdb_server_iface_proto = 'ptcp'
|
||||||
$odl_check_url_parsed = $odl_check_url
|
$odl_check_url_proto = 'http'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $enable_ipv6 {
|
||||||
|
$ovsdb_server_ip = '[::1]'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ovsdb_server_ip = '127.0.0.1'
|
||||||
|
}
|
||||||
|
|
||||||
|
$odl_ovsdb_iface_parsed = regsubst($odl_ovsdb_iface, 'tcp', $odl_ovsdb_iface_proto, 'G')
|
||||||
|
$ovsdb_server_iface_parsed = "${ovsdb_server_iface_proto}:6639:${ovsdb_server_ip}"
|
||||||
|
$odl_check_url_parsed = regsubst($odl_check_url, 'http', $odl_check_url_proto)
|
||||||
|
|
||||||
exec { 'Wait for NetVirt OVSDB to come up':
|
exec { 'Wait for NetVirt OVSDB to come up':
|
||||||
command => "curl -k -o /dev/null --fail --silent --head -u ${odl_username}:${odl_password} ${odl_check_url_parsed}",
|
command => "curl -g -k -o /dev/null --fail --silent --head -u ${odl_username}:${odl_password} ${odl_check_url_parsed}",
|
||||||
tries => $retry_count,
|
tries => $retry_count,
|
||||||
try_sleep => $retry_interval,
|
try_sleep => $retry_interval,
|
||||||
path => '/usr/sbin:/usr/bin:/sbin:/bin',
|
path => '/usr/sbin:/usr/bin:/sbin:/bin',
|
||||||
|
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Added logic to support IPv6 deployment on underlay network
|
||||||
|
with ODL. The logic is implemented such that both TLS and
|
||||||
|
IPv6 can be enabled or either of them or none.
|
@@ -17,6 +17,7 @@ describe 'neutron::plugins::ovs::opendaylight' do
|
|||||||
:vhostuser_mode => 'server',
|
:vhostuser_mode => 'server',
|
||||||
:enable_hw_offload => false,
|
:enable_hw_offload => false,
|
||||||
:enable_tls => false,
|
:enable_tls => false,
|
||||||
|
:enable_ipv6 => false,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -116,7 +117,7 @@ describe 'neutron::plugins::ovs::opendaylight' do
|
|||||||
:enable_tls => true,
|
:enable_tls => true,
|
||||||
:tls_key_file => 'dummy.pem',
|
:tls_key_file => 'dummy.pem',
|
||||||
:tls_cert_file => 'dummy.crt',
|
:tls_cert_file => 'dummy.crt',
|
||||||
:odl_ovsdb_iface => 'tcp:127.0.0.1:6640 tcp:172.0.0.1:6640'})
|
:odl_ovsdb_iface => 'ssl:127.0.0.1:6640 ssl:172.0.0.1:6640'})
|
||||||
end
|
end
|
||||||
it_configures 'with TLS and ODL HA'
|
it_configures 'with TLS and ODL HA'
|
||||||
it {is_expected.to contain_vs_ssl('system').with(
|
it {is_expected.to contain_vs_ssl('system').with(
|
||||||
@@ -127,6 +128,15 @@ describe 'neutron::plugins::ovs::opendaylight' do
|
|||||||
'before' => 'Exec[Set OVS Manager to OpenDaylight]'
|
'before' => 'Exec[Set OVS Manager to OpenDaylight]'
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
|
context 'with IPv6 enabled' do
|
||||||
|
before do
|
||||||
|
params.merge!({
|
||||||
|
:enable_ipv6 => true,
|
||||||
|
:odl_ovsdb_iface => 'tcp:[::1]:6640',
|
||||||
|
})
|
||||||
|
end
|
||||||
|
it_configures 'with IPv6 enabled'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples_for 'with default parameters' do
|
shared_examples_for 'with default parameters' do
|
||||||
@@ -170,6 +180,9 @@ describe 'neutron::plugins::ovs::opendaylight' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
shared_examples_for 'with TLS enabled' do
|
shared_examples_for 'with TLS enabled' do
|
||||||
|
before do
|
||||||
|
params.merge!({ :odl_ovsdb_iface => 'ssl:127.0.0.1:6640' })
|
||||||
|
end
|
||||||
it 'configures OVS for ODL' do
|
it 'configures OVS for ODL' do
|
||||||
is_expected.to contain_exec('Add trusted cert: dummy.crt to https://127.0.0.1:8080')
|
is_expected.to contain_exec('Add trusted cert: dummy.crt to https://127.0.0.1:8080')
|
||||||
is_expected.to contain_exec('Set OVS Manager to OpenDaylight').with(
|
is_expected.to contain_exec('Set OVS Manager to OpenDaylight').with(
|
||||||
@@ -198,6 +211,20 @@ describe 'neutron::plugins::ovs::opendaylight' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
shared_examples_for 'with IPv6 enabled' do
|
||||||
|
it 'configures OVS for ODL' do
|
||||||
|
is_expected.to contain_exec('Wait for NetVirt OVSDB to come up')
|
||||||
|
is_expected.to contain_exec('Set OVS Manager to OpenDaylight').with(
|
||||||
|
:command => "ovs-vsctl set-manager ptcp:6639:[::1] tcp:[::1]:6640"
|
||||||
|
)
|
||||||
|
is_expected.to contain_vs_config('other_config:local_ip')
|
||||||
|
is_expected.not_to contain_vs_config('other_config:provider_mappings')
|
||||||
|
is_expected.to contain_vs_config('external_ids:odl_os_hostconfig_hostid')
|
||||||
|
is_expected.to contain_vs_config('external_ids:hostname')
|
||||||
|
is_expected.to contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'on RedHat platforms' do
|
context 'on RedHat platforms' do
|
||||||
let :facts do
|
let :facts do
|
||||||
@default_facts.merge(test_facts.merge({
|
@default_facts.merge(test_facts.merge({
|
||||||
|
Reference in New Issue
Block a user