@@ -71,6 +71,8 @@ def install_odl(options = {})
7171 enable_ha = options . fetch ( :enable_ha , false )
7272 ha_node_ips = options . fetch ( :ha_node_ips , [ ] )
7373 ha_node_index = options . fetch ( :ha_node_index , 0 )
74+ username = options . fetch ( :username , 'admin' )
75+ password = options . fetch ( :password , 'admin' )
7476
7577 # Build script for consumption by Puppet apply
7678 it 'should work idempotently with no errors' do
@@ -85,6 +87,8 @@ class { 'opendaylight':
8587 ha_node_ips=> #{ ha_node_ips } ,
8688 ha_node_index=> #{ ha_node_index } ,
8789 log_levels=> #{ log_levels } ,
90+ username=> #{ username } ,
91+ password=> #{ password } ,
8892 }
8993 EOS
9094
@@ -330,3 +334,21 @@ def deb_validations()
330334 it { should be_installed }
331335 end
332336end
337+
338+ # Shared function for validations related to username/password
339+ def username_password_validations ( options = { } )
340+ # NB: This param default should match the one used by the opendaylight
341+ # class, which is defined in opendaylight::params
342+ # TODO: Remove this possible source of bugs^^
343+ odl_username = options . fetch ( :username , 'admin' )
344+ odl_password = options . fetch ( :password , 'admin' )
345+ odl_check_url = 'http://127.0.0.1:8080/restconf'
346+
347+ describe file ( '/opt/opendaylight/idmlight.db.mv.db' ) do
348+ it { should be_file }
349+ end
350+
351+ describe command ( "curl -o /dev/null --fail --silent --head -u #{ odl_username } :#{ odl_password } #{ odl_check_url } " ) do
352+ its ( :exit_status ) { should eq 0 }
353+ end
354+ end
0 commit comments