line => "org.ops4j.pax.web.listening.addresses = ${opendaylight::odl_bind_ip}",
require => File['org.ops4j.pax.web.cfg']
}
+
+ # Configure websocket address
+ file { '/opt/opendaylight/etc/org.opendaylight.restconf.cfg':
+ ensure => file,
+ path => '/opt/opendaylight/etc/org.opendaylight.restconf.cfg',
+ owner => 'odl',
+ group => 'odl',
+ }
+ -> file_line { 'websocket-address':
+ ensure => present,
+ path => '/opt/opendaylight/etc/org.opendaylight.restconf.cfg',
+ line => "websocket-address=${::opendaylight::odl_bind_ip}",
+ match => '^websocket-address=.*$',
+ }
}
# Set any custom log levels
password => $::opendaylight::password,
before => Service['opendaylight'],
}
-
- # Configure websocket address
- file { '10-rest-connector.xml':
- ensure => file,
- path => '/opt/opendaylight/etc/opendaylight/karaf/10-rest-connector.xml',
- owner => 'odl',
- group => 'odl',
- content => template('opendaylight/10-rest-connector.xml.erb'),
- require => File['/opt/opendaylight/etc/opendaylight/karaf'],
- }
}
# 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_file('10-rest-connector.xml').with(
- 'ensure' => 'file',
- 'path' => '/opt/opendaylight/etc/opendaylight/karaf/10-rest-connector.xml',
- 'owner' => 'odl',
- 'group' => 'odl',
- 'content' => /<websocket-address>#{odl_bind_ip}<\/websocket-address>/
- )
- }
+
+ if not odl_bind_ip.eql? '0.0.0.0'
+ it {
+ should contain_file('/opt/opendaylight/etc/org.opendaylight.restconf.cfg').with(
+ 'ensure' => 'file',
+ 'path' => '/opt/opendaylight/etc/org.opendaylight.restconf.cfg',
+ 'owner' => 'odl',
+ 'group' => 'odl',
+ )
+ }
+ it {
+ should contain_file_line('websocket-address').with(
+ 'path' => '/opt/opendaylight/etc/org.opendaylight.restconf.cfg',
+ 'line' => "websocket-address=#{odl_bind_ip}",
+ 'match' => '^websocket-address=.*$',
+ )
+ }
+ else
+ it {
+ should_not contain_file_line('websocket-address')
+ }
+ end
end
def odl_tls_tests(options = {})
# TODO: Remove this possible source of bugs^^
odl_bind_ip = options.fetch(:odl_bind_ip, '0.0.0.0')
- describe file('/opt/opendaylight/etc/opendaylight/karaf/10-rest-connector.xml') do
- it { should be_file }
- it { should be_owned_by 'odl' }
- it { should be_grouped_into 'odl' }
- its(:content) { should match /<websocket-address>#{odl_bind_ip}<\/websocket-address>/ }
+ if not odl_bind_ip.eql? '0.0.0.0'
+ describe file('/opt/opendaylight/etc/org.opendaylight.restconf.cfg') do
+ it { should be_file }
+ it { should be_owned_by 'odl' }
+ it { should be_grouped_into 'odl' }
+ its(:content) { should match /^websocket-address=#{odl_bind_ip}/ }
+ end
+ else
+ describe file('/opt/opendaylight/etc/org.opendaylight.restconf.cfg') do
+ it { should be_file }
+ end
end
end
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
-
-This program and the accompanying materials are made available under the
-terms of the Eclipse Public License v1.0 which accompanies this distribution,
-and is available at http://www.eclipse.org/legal/epl-v10.html
--->
-<snapshot>
- <configuration>
- <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
- <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
- <!-- default OF-switch-connection-provider (port 6633) -->
- <module>
- <type xmlns:rest="urn:opendaylight:params:xml:ns:yang:controller:md:sal:rest:connector">rest:rest-connector-impl</type>
- <name>rest-connector-default-impl</name>
- <websocket-address><%= scope.lookupvar('opendaylight::odl_bind_ip') %></websocket-address>
- <websocket-port>8185</websocket-port>
- <dom-broker>
- <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type>
- <name>dom-broker</name>
- </dom-broker>
- </module>
- </modules>
-
- <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
- <service>
- <type xmlns:rest="urn:opendaylight:params:xml:ns:yang:controller:md:sal:rest:connector">rest:rest-connector</type>
- <instance>
- <name>rest-connector-default</name>
- <provider>
- /modules/module[type='rest-connector-impl'][name='rest-connector-default-impl']
- </provider>
- </instance>
- </service>
- </services>
- </data>
- </configuration>
- <required-capabilities>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:rest:connector?module=opendaylight-rest-connector&revision=2014-07-24</capability>
- </required-capabilities>
-</snapshot>
\ No newline at end of file