if $opendaylight::odl_bind_ip =~ Stdlib::Compat::Ipv6 {
$enable_ipv6 = true
- $java_options = join(union(['-Djava.net.preferIPv6Addresses=true'], any2array($opendaylight::java_opts)), ' ')
+ $java_options = strip(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)), ' ')
+ $java_options = strip(join(union(['-Djava.net.preferIPv4Stack=true'], any2array($opendaylight::java_opts)), ' '))
}
class { '::opendaylight::install': }
end
end
+ describe 'testing passing extra java option' do
+ context 'pass java heap size' do
+ # Call specialized helper fn to install OpenDaylight
+ install_odl(java_opts: '-Xmx8192m')
+
+ # Call specialized helper fn for polling enablement validations
+ generic_validations(java_opts: '-Xmx8192m')
+ end
+ end
+
describe 'testing configuring inactivity probe' do
context 'with specifying inactivity probe timer' do
# Call specialized helper fn to install OpenDaylight
should contain_file_line('Karaf Java Options').with(
'ensure' => 'present',
'path' => '/opt/opendaylight/bin/karaf',
- 'line' => "EXTRA_JAVA_OPTS=#{java_options}",
+ 'line' => "EXTRA_JAVA_OPTS=\"#{java_options}\"",
'match' => '^EXTRA_JAVA_OPTS=.*$',
'after' => '^PROGNAME=.*$'
)
inherit_dscp_marking = options.fetch(:inherit_dscp_marking, false)
stats_polling_enabled = options.fetch(:stats_polling_enabled, false)
inactivity_probe = options.fetch(:inactivity_probe, :undef)
+ java_opts = options.fetch(:java_opts, '')
# Build script for consumption by Puppet apply
it 'should work idempotently with no errors' do
inherit_dscp_marking => #{inherit_dscp_marking},
stats_polling_enabled => #{stats_polling_enabled},
inactivity_probe => #{inactivity_probe},
+ java_opts => '#{java_opts}',
}
EOS
# 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, [])
# Verify ODL's directory
describe file('/opt/opendaylight/') do
it { should be_directory }
it { should be_grouped_into 'odl' }
end
+ java_opts = options.fetch(:java_opts, '')
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
+ java_options = ['-Djava.net.preferIPv4Stack=true', java_opts].join(' ').strip
else
- java_options = ['-Djava.net.preferIPv6Addresses=true'] + java_opts
+ java_options = ['-Djava.net.preferIPv6Addresses=true', java_opts].join(' ').strip
end
# Should contain karaf file with Java options set
it { should be_file }
it { should be_owned_by 'odl' }
it { should be_grouped_into 'odl' }
- its(:content) { should match /^EXTRA_JAVA_OPTS=#{java_options.join(" ")}/ }
+ its(:content) { should match /^EXTRA_JAVA_OPTS=\"#{java_options}\"/ }
+ end
+
+ describe command do ("ps -ef | grep opendaylight | grep #{java_options}")
+ its(:exit_status) { should eq 0 }
end
# Should contain ODL NB port config file