Gemfile.lock
*.log
*.tox
+.idea/**
match => '^featuresBoot=.*$',
}
- # Configuration of ODL NB REST port and IP to listen on
- augeas {'jetty.xml':
+ # Configuration of ODL NB REST port to listen on
+ augeas {'ODL REST Port':
incl => '/opt/opendaylight/etc/jetty.xml',
context => '/files/opt/opendaylight/etc/jetty.xml/Configure',
lens => 'Xml.lns',
changes => [
- "set Call[2]/Arg/New/Set[#attribute[name='port']]/Property/#attribute/default ${opendaylight::odl_rest_port}",
- "set Call[1]/Arg/New/Set[#attribute[name='host']]/#text[1] ${opendaylight::odl_bind_ip}",
- "rm Call[1]/Arg/New/Set[#attribute[name='host']]/Property",
- "set Call[2]/Arg/New/Set[#attribute[name='host']]/#text[1] ${opendaylight::odl_bind_ip}",
- "rm Call[2]/Arg/New/Set[#attribute[name='host']]/Property"]
+ "set Call[2]/Arg/New/Set[#attribute[name='port']]/Property/#attribute/default ${opendaylight::odl_rest_port}"]
+ }
+
+ if $opendaylight::odl_bind_ip != '0.0.0.0' {
+ # Configuration of ODL NB REST IP to listen on
+ augeas { 'ODL REST IP':
+ incl => '/opt/opendaylight/etc/jetty.xml',
+ context => '/files/opt/opendaylight/etc/jetty.xml/Configure',
+ lens => 'Xml.lns',
+ changes => [
+ "set Call[1]/Arg/New/Set[#attribute[name='host']]/Property/#attribute/default ${opendaylight::odl_bind_ip}",
+ "set Call[2]/Arg/New/Set[#attribute[name='host']]/Property/#attribute/default ${opendaylight::odl_bind_ip}"]
+ }
+
+ file { 'org.ops4j.pax.web.cfg':
+ ensure => file,
+ path => '/opt/opendaylight/etc/org.ops4j.pax.web.cfg',
+ # Set user:group owners
+ owner => 'odl',
+ group => 'odl',
+ }
+ -> file_line { 'org.ops4j.pax.web.cfg':
+ ensure => present,
+ path => '/opt/opendaylight/etc/org.ops4j.pax.web.cfg',
+ line => "org.ops4j.pax.web.listening.addresses = ${opendaylight::odl_bind_ip}"
+ }
}
# Set any custom log levels
end
describe 'testing odl username/password' do
+ bind_ip = '127.0.0.1'
context 'using default username/password' do
- context 'using default log levels' do
+ context 'using non-default bind ip' do
# Call specialized helper fn to install OpenDaylight
- install_odl({:extra_features => ['odl-restconf']})
+ install_odl({:odl_bind_ip => bind_ip, :extra_features => ['odl-restconf']})
# Call specialized helper fn for username/password validations
username_password_validations
odl_rest_port_tests
end
- context 'overriding default REST port' do
+ context 'overriding default REST and IP port' do
let(:facts) {{
:osfamily => osfamily,
:operatingsystem => operatingsystem,
let(:params) {{
:odl_rest_port => 7777,
+ :odl_bind_ip => '127.0.0.1'
}}
# Run shared tests applicable to all supported OSs
# Run test that specialize in checking ODL REST port config
# Note that this function is defined in spec_helper
- odl_rest_port_tests(odl_rest_port: 7777)
+ odl_rest_port_tests(odl_rest_port: 7777, odl_bind_ip: '127.0.0.1')
end
end
# NB: This default value should be the same as one in opendaylight::params
# TODO: Remove this possible source of bugs^^
odl_rest_port = options.fetch(:odl_rest_port, 8080)
-
+ odl_bind_ip = options.fetch(:odl_bind_ip, '0.0.0.0')
# Confirm properties of ODL REST port config file
# NB: These hashes don't work with Ruby 1.8.7, but we
# don't support 1.8.7 so that's okay. See issue #36.
it {
- should contain_augeas('jetty.xml')
+ should contain_augeas('ODL REST Port')
}
+
+ if not odl_bind_ip.eql? '0.0.0.0'
+ it {
+ should contain_augeas('ODL REST IP')
+ should contain_file_line('org.ops4j.pax.web.cfg').with(
+ 'path' => '/opt/opendaylight/etc/org.ops4j.pax.web.cfg',
+ 'line' => "org.ops4j.pax.web.listening.addresses = #{odl_bind_ip}",
+ )
+ }
+ else
+ it {
+ should_not contain_augeas('ODL REST IP')
+ }
+ end
end
def log_level_tests(options = {})
it { should be_file }
end
- describe command("sleep 60 && curl -o /dev/null --fail --silent --head -u #{odl_username}:#{odl_password} #{odl_check_url}") do
+ describe command("sleep 180 && curl -o /dev/null --fail --silent --head -u #{odl_username}:#{odl_password} #{odl_check_url}") do
its(:exit_status) { should eq 0 }
end
end