Till now, only IPv4 deployment of ODL was supported.
With this patch IPv6 will be supported. EXTRA_JAVA_OPTS
property is set accordingly java.net.preferIPv4Stack=true
to allow only IPv4 addresses. java.net.preferIPv6Addresses=true
to allow both IPv4 and IPv6 address.
Change-Id: I760681e447f6bec4f249f75501b9363793b41ccc
Signed-Off-By: Janki Chhatbar <jchhatba@redhat.com>
- Bind karaf shell to ODL bind IP
2018-07-16 Release 8.3.0
- Disable regular polling of OF statistics
+2018-07-23 Release 8.4.0
+- Enable IPv6 deployment
##### `java_opts`
Specifies the Java options to run ODL with as a string. Note, these options
-are in addition to the default Java options set by the karaf/ODL boot scripts.
+are in addition to the default Java options set by the karaf/ODL boot scripts
+and IP version based flag set by 'opendaylight' class.
-Default: `'-Djava.net.preferIPv4Stack=true'`
+Default: `''`
Valid options: A string of valid Java options.
file_line {'Karaf Java Options':
ensure => present,
path => '/opt/opendaylight/bin/karaf',
- line => "EXTRA_JAVA_OPTS=${opendaylight::java_opts}",
+ line => "EXTRA_JAVA_OPTS=${opendaylight::java_options}",
match => '^EXTRA_JAVA_OPTS=.*$',
after => '^PROGNAME=.*$'
}
# [*vpp_routing_node*]
# Sets routing node for VPP deployments. Defaults to ''.
# [*java_opts*]
-# Sets Java options for ODL in a string format. Defaults to '-Djava.net.preferIPv4Stack=true'.
+# Sets Java options for ODL in a string format. Defaults to ''.
# [*manage_repositories*]
# (Boolean) Should this module manage the apt or yum repositories for the
# package installation.
# [*stats_polling_enabled*]
# Enables statistics polling of OpenFlow entities like table, groups.
# Defaults to false
+#
# === Deprecated Parameters
#
# [*ha_node_index*]
$enable_ha = $::opendaylight::params::enable_ha,
$ha_node_ips = $::opendaylight::params::ha_node_ips,
$ha_node_index = $::opendaylight::params::ha_node_index,
+ $java_opts = $::opendaylight::params::java_opts,
$ha_db_modules = $::opendaylight::params::ha_db_modules,
$vpp_routing_node = $::opendaylight::params::vpp_routing_node,
- $java_opts = $::opendaylight::params::java_opts,
$manage_repositories = $::opendaylight::params::manage_repositories,
$username = $::opendaylight::params::username,
$password = $::opendaylight::params::password,
# Build full list of features to install
$features = union($default_features, $extra_features)
+ if $opendaylight::odl_bind_ip =~ Stdlib::Compat::Ipv6 {
+ $enable_ipv6 = true
+ $java_options = join(union(['-Djava.net.preferIPv6Addresses=true'], any2array($opendaylight::java_opts)), ' ')
+ }
+ else {
+ $enable_ipv6 = false
+ $java_options = join(union(['-Djava.net.preferIPv4Stack=true'], any2array($opendaylight::java_opts)), ' ')
+ }
+
class { '::opendaylight::install': }
-> class { '::opendaylight::config': }
~> class { '::opendaylight::service': }
$ha_node_index = 0
$ha_db_modules = { 'default' => false }
$vpp_routing_node = ''
- $java_opts = '-Djava.net.preferIPv4Stack=true'
+ $java_opts = ''
$manage_repositories = true
$username = 'admin'
$password = 'admin'
{
"name": "opendaylight-opendaylight",
- "version": "8.3.0",
+ "version": "8.4.0",
"author": "Daniel Farrell",
"summary": "Puppet module that installs and configures the OpenDaylight SDN controller",
"license": "BSD-2-Clause",
# Call specialized helper fn for polling enablement validations
stats_polling_validations
end
+ end
+
+ describe 'testing different IPv deployments' do
+ context 'IPv6 support tests' do
+ # Call specialized helper fn to install OpenDaylight
+ install_odl(odl_bind_ip: '::1')
+
+ # Call specialized helper fn for polling enablement validations
+ generic_validations(odl_bind_ip: '::1')
+ end
+ context 'IPv4 support test' do
+ # Call specialized helper fn to install OpenDaylight
+ install_odl(odl_bind_ip: '127.0.0.1')
+
+ # Call specialized helper fn for polling enablement validations
+ generic_validations(odl_bind_ip: '127.0.0.1')
+ end
end
end
stats_polling_enablement_tests(stats_polling_enabled:true)
end
end
+
+ describe 'Different IPv support tests' do
+ # Non-OS-type tests assume CentOS 7
+ # See issue #43 for reasoning:
+ # https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
+ osfamily = 'RedHat'
+ operatingsystem = 'CentOS'
+ operatingsystemmajrelease = '7'
+
+ context 'IPv6 deployment' do
+ let(:facts) {{
+ :osfamily => osfamily,
+ :operatingsystem => operatingsystem,
+ :operatingsystemmajrelease => operatingsystemmajrelease,
+ }}
+
+ let(:params) {{
+ :odl_bind_ip => '::1'
+ }}
+
+ # Run shared tests applicable to all supported OSs
+ # Note that this function is defined in spec_helper
+ generic_tests(odl_bind_ip:'::1')
+ end
+
+ context 'IPv4 deployment' do
+ let(:facts) {{
+ :osfamily => osfamily,
+ :operatingsystem => operatingsystem,
+ :operatingsystemmajrelease => operatingsystemmajrelease,
+ }}
+
+ let(:params) {{
+ :odl_bind_ip => '127.0.0.1'
+ }}
+
+ # Run shared tests applicable to all supported OSs
+ # Note that this function is defined in spec_helper
+ generic_tests(odl_bind_ip:'127.0.0.1')
+ end
+ end
end
# Tests that are common to all possible configurations
def generic_tests(options = {})
- java_opts = options.fetch(:java_opts, '-Djava.net.preferIPv4Stack=true')
+ java_opts = options.fetch(:java_opts, '')
+ odl_bind_ip = options.fetch(:odl_bind_ip, '127.0.0.1')
# Confirm that module compiles
it { should compile }
}
it {
+ if odl_bind_ip =~ /.*:.*/
+ java_options = '-Djava.net.preferIPv6Addresses=true'
+ else
+ java_options = '-Djava.net.preferIPv4Stack=true'
+ end
+
should contain_file_line('Karaf Java Options').with(
'ensure' => 'present',
'path' => '/opt/opendaylight/bin/karaf',
- 'line' => "EXTRA_JAVA_OPTS=#{java_opts}",
+ 'line' => "EXTRA_JAVA_OPTS=#{java_options}",
'match' => '^EXTRA_JAVA_OPTS=.*$',
'after' => '^PROGNAME=.*$'
)
# Shared function that handles generic validations
# These should be common for all odl class param combos
def generic_validations(options = {})
- java_opts = options.fetch(:java_opts, '-Djava.net.preferIPv4Stack=true')
-
+ java_opts = options.fetch(:java_opts, [])
# Verify ODL's directory
describe file('/opt/opendaylight/') do
it { should be_directory }
it { should be_grouped_into 'odl' }
end
+ odl_bind_ip = options.fetch(:odl_bind_ip, '127.0.0.1')
+ if odl_bind_ip == '127.0.0.1'
+ java_options = ['-Djava.net.preferIPv4Stack=true'] + java_opts
+ else
+ java_options = ['-Djava.net.preferIPv6Addresses=true'] + java_opts
+ end
+
# Should contain karaf file with Java options set
describe file('/opt/opendaylight/bin/karaf') do
it { should be_file }
it { should be_owned_by 'odl' }
it { should be_grouped_into 'odl' }
- its(:content) { should match /^EXTRA_JAVA_OPTS=#{java_opts}$/ }
+ its(:content) { should match /^EXTRA_JAVA_OPTS=#{java_options.join(" ")}/ }
end
# Should contain ODL NB port config file
remote {
artery {
enabled = off
+ <%- if scope.lookupvar('opendaylight::enable_ipv6') -%>
+ canonical.hostname = "[<%= scope.lookupvar('opendaylight::odl_bind_ip') %>]"
+ <%- else -%>
canonical.hostname = "<%= scope.lookupvar('opendaylight::odl_bind_ip') %>"
+ <% end -%>
canonical.port = 2550
}
netty.tcp {
+ <%- if scope.lookupvar('opendaylight::enable_ipv6') -%>
+ hostname = "[<%= scope.lookupvar('opendaylight::odl_bind_ip') %>]"
+ <%- else -%>
hostname = "<%= scope.lookupvar('opendaylight::odl_bind_ip') %>"
+ <% end -%>
port = 2550
}
}
# Remove ".tcp" when using artery.
seed-nodes = [
<% scope.lookupvar('opendaylight::ha_node_ips').each do |ha_ip| -%>
+ <%- if scope.lookupvar('opendaylight::enable_ipv6') -%>
+ "akka.tcp://opendaylight-cluster-data@[<%= ha_ip %>]:2550",
+ <%- else -%>
"akka.tcp://opendaylight-cluster-data@<%= ha_ip %>:2550",
<% end -%>
+ <% end -%>
]
roles = ["member-<%=scope.lookupvar('opendaylight::ha_node_ips').index(scope.lookupvar('opendaylight::odl_bind_ip'))%>"]