1 require 'beaker-rspec/spec_helper'
2 require 'beaker-rspec/helpers/serverspec'
3 require 'beaker-puppet'
5 include Beaker::DSL::InstallUtils::FOSSUtils
6 include Beaker::DSL::InstallUtils::ModuleUtils
7 include Beaker::DSL::Helpers::PuppetHelpers
9 # Install Puppet on all Beaker hosts
10 unless ENV['BEAKER_provision'] == 'no'
13 install_puppet_agent_on(host, {:puppet_collection => "pc1"})
17 RSpec.configure do |c|
19 proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
21 # Readable test descriptions
22 c.formatter = :documentation
24 # Configure all nodes in nodeset
26 # Install opendaylight module on any/all Beaker hosts
27 # TODO: Should this be done in host.each loop?
28 puppet_module_install(:source => proj_root, :module_name => 'opendaylight')
30 # Install stdlib, a dependency of the odl mod
31 on host, puppet('module', 'install', 'puppetlabs-stdlib'), { :acceptable_exit_codes => [0] }
32 # Install apt, a dependency of the deb install method
33 on host, puppet('module', 'install', 'puppetlabs-apt'), { :acceptable_exit_codes => [0] }
39 # NB: These are a library of helper fns used by the Beaker tests
42 # NB: There are a large number of helper functions used in these tests.
43 # They make this code much more friendly, but may need to be referenced.
44 # The serverspec helpers (`should`, `be_running`...) are documented here:
45 # http://serverspec.org/resource_types.html
47 def install_odl(options = {})
48 # Install params are passed via environment var, set in Rakefile
49 # Changing the installed version of ODL via `puppet apply` is not supported
50 # by puppet-odl, so it's not possible to vary these params in the same
51 # Beaker test run. Do a different run passing different env vars.
52 rpm_repo = ENV['RPM_REPO']
53 deb_repo = ENV['DEB_REPO']
55 # NB: These param defaults should match the ones used by the opendaylight
56 # class, which are defined in opendaylight::params
57 # TODO: Remove this possible source of bugs^^
58 # Extract params if given, defaulting to odl class defaults if not
59 extra_features = options.fetch(:extra_features, ['odl-restconf'])
60 default_features = options.fetch(:default_features, ['standard', 'wrap', 'ssh'])
61 odl_rest_port = options.fetch(:odl_rest_port, 8181)
62 odl_bind_ip = options.fetch(:odl_bind_ip, '0.0.0.0')
63 log_levels = options.fetch(:log_levels, {})
64 enable_ha = options.fetch(:enable_ha, false)
65 ha_node_ips = options.fetch(:ha_node_ips, [])
66 ha_node_index = options.fetch(:ha_node_index, 0)
67 ha_db_modules = options.fetch(:ha_db_modules, { 'default' => false })
68 username = options.fetch(:username, 'admin')
69 password = options.fetch(:password, 'admin')
70 log_max_size = options.fetch(:log_max_size, '10GB')
71 log_max_rollover = options.fetch(:log_max_rollover, 2)
72 log_pattern = options.fetch(:log_pattern, '%d{ISO8601} | %-5p | %-16t | %-60c{6} | %m%n')
73 log_rollover_fileindex = options.fetch(:log_rollover_fileindex, 'min')
74 snat_mechanism = options.fetch(:snat_mechanism, 'controller')
75 enable_tls = options.fetch(:enable_tls, false)
76 tls_keystore_password = options.fetch(:tls_keystore_password, 'dummypass')
77 log_mechanism = options.fetch(:log_mechanism, 'file')
78 inherit_dscp_marking = options.fetch(:inherit_dscp_marking, false)
79 stats_polling_enabled = options.fetch(:stats_polling_enabled, false)
80 inactivity_probe = options.fetch(:inactivity_probe, :undef)
81 java_opts = options.fetch(:java_opts, '')
83 # Build script for consumption by Puppet apply
84 it 'should work idempotently with no errors' do
86 class { 'opendaylight':
87 rpm_repo => '#{rpm_repo}',
88 deb_repo => '#{deb_repo}',
89 default_features => #{default_features},
90 extra_features => #{extra_features},
91 odl_rest_port => #{odl_rest_port},
92 odl_bind_ip => '#{odl_bind_ip}',
93 enable_ha => #{enable_ha},
94 ha_node_ips => #{ha_node_ips},
95 ha_node_index => #{ha_node_index},
96 ha_db_modules => #{ha_db_modules},
97 log_levels => #{log_levels},
98 username => #{username},
99 password => #{password},
100 log_max_size => '#{log_max_size}',
101 log_max_rollover => #{log_max_rollover},
102 log_pattern => '#{log_pattern}',
103 log_rollover_fileindex => #{log_rollover_fileindex},
104 snat_mechanism => #{snat_mechanism},
105 enable_tls => #{enable_tls},
106 tls_keystore_password => #{tls_keystore_password},
107 log_mechanism => #{log_mechanism},
108 inherit_dscp_marking => #{inherit_dscp_marking},
109 stats_polling_enabled => #{stats_polling_enabled},
110 inactivity_probe => #{inactivity_probe},
111 java_opts => '#{java_opts}',
115 # Apply our Puppet manifest on the Beaker host
116 apply_manifest(pp, :catch_failures => true)
118 # Not checking for idempotence because of false failures
119 # related to package manager cache updates outputting to
120 # stdout and different IDs for the puppet manifest apply.
121 # I think this is a limitation in how Beaker can check
122 # for changes, not a problem with the Puppet module.
126 # Shared function that handles generic validations
127 # These should be common for all odl class param combos
128 def generic_validations(options = {})
129 # Verify ODL's directory
130 describe file('/opt/opendaylight/') do
131 it { should be_directory }
132 it { should be_owned_by 'odl' }
133 it { should be_grouped_into 'odl' }
136 # Verify ODL's systemd service
137 describe service('opendaylight') do
138 it { should be_enabled }
139 it { should be_enabled.with_level(3) }
140 it { should be_running.under('systemd') }
143 # Creation handled by RPM or Deb
144 describe user('odl') do
146 it { should belong_to_group 'odl' }
147 # NB: This really shouldn't have a slash at the end!
148 # The home dir set by the RPM is `/opt/opendaylight`.
149 # Since we use the trailing slash elsewhere else, this
150 # may look like a style issue. It isn't! It will make
151 # Beaker tests fail if it ends with a `/`. A future
152 # version of the ODL RPM may change this.
153 it { should have_home_directory '/opt/opendaylight' }
156 # Creation handled by RPM or Deb
157 describe group('odl') do
161 # This should not be the odl user's home dir
162 describe file('/home/odl') do
163 # Home dir shouldn't be created for odl user
164 it { should_not be_directory }
167 # OpenDaylight will appear as a Java process
168 describe process('java') do
169 it { should be_running }
172 # Should contain Karaf features config file
173 describe file('/opt/opendaylight/etc/org.apache.karaf.features.cfg') do
174 it { should be_file }
175 it { should be_owned_by 'odl' }
176 it { should be_grouped_into 'odl' }
179 java_opts = options.fetch(:java_opts, '')
180 odl_bind_ip = options.fetch(:odl_bind_ip, '127.0.0.1')
181 if odl_bind_ip == '127.0.0.1'
182 java_options = ['-Djava.net.preferIPv4Stack=true', java_opts].join(' ').strip
184 java_options = ['-Djava.net.preferIPv6Addresses=true', java_opts].join(' ').strip
187 # Should contain karaf file with Java options set
188 describe file('/opt/opendaylight/bin/karaf') do
189 it { should be_file }
190 it { should be_owned_by 'odl' }
191 it { should be_grouped_into 'odl' }
192 its(:content) { should match /^EXTRA_JAVA_OPTS=\"#{java_options}\"/ }
195 describe command do ("ps -ef | grep opendaylight | grep #{java_options}")
196 its(:exit_status) { should eq 0 }
199 # Should contain ODL NB port config file
200 describe file('/opt/opendaylight/etc/jetty.xml') do
201 it { should be_file }
202 it { should be_owned_by 'odl' }
203 it { should be_grouped_into 'odl' }
206 # Should contain log level config file
207 describe file('/opt/opendaylight/etc/org.ops4j.pax.logging.cfg') do
208 it { should be_file }
209 it { should be_owned_by 'odl' }
210 it { should be_grouped_into 'odl' }
213 if ['centos-7', 'centos-7-docker'].include? ENV['RS_SET']
214 # Validations for modern Red Hat family OSs
216 # Verify ODL systemd .service file
217 describe file('/usr/lib/systemd/system/opendaylight.service') do
218 it { should be_file }
219 it { should be_owned_by 'root' }
220 it { should be_grouped_into 'root' }
221 it { should be_mode '644' }
224 # Java 8 should be installed
225 describe package('java-1.8.0-openjdk') do
226 it { should be_installed }
229 # Ubuntu 16.04 specific validation
230 elsif ['ubuntu-16', 'ubuntu-16-docker'].include? ENV['RS_SET']
232 # Verify ODL systemd .service file
233 describe file('/lib/systemd/system/opendaylight.service') do
234 it { should be_file }
235 it { should be_owned_by 'root' }
236 it { should be_grouped_into 'root' }
237 it { should be_mode '644' }
240 # Java 8 should be installed
241 describe package('openjdk-8-jre-headless') do
242 it { should be_installed }
246 fail("Unexpected RS_SET (host OS): #{ENV['RS_SET']}")
250 # Shared function for validations related to log file settings
251 def log_settings_validations(options = {})
252 # Should contain log level config file with correct file size and rollover values
253 log_max_size = options.fetch(:log_max_size, '10GB')
254 log_max_rollover = options.fetch(:log_max_rollover, 2)
255 log_pattern = options.fetch(:log_pattern, '%d{ISO8601} | %-5p | %-16t | %-60c{6} | %m%n')
256 log_rollover_fileindex = options.fetch(:log_rollover_fileindex, 'min')
257 log_mechanism = options.fetch(:log_mechanism, 'file')
259 if log_mechanism == 'console'
260 describe file('/opt/opendaylight/etc/org.ops4j.pax.logging.cfg') do
261 it { should be_file }
262 it { should be_owned_by 'odl' }
263 it { should be_grouped_into 'odl' }
264 its(:content) { should match /^karaf.log.console=INFO/ }
265 its(:content) { should match /^log4j2.appender.console.direct = true/ }
268 describe file('/opt/opendaylight/etc/org.ops4j.pax.logging.cfg') do
269 it { should be_file }
270 it { should be_owned_by 'odl' }
271 it { should be_grouped_into 'odl' }
272 its(:content) { should match /^log4j2.appender.rolling.policies.size.size = #{log_max_size}/ }
273 its(:content) { should match /^log4j2.appender.rolling.strategy.type = DefaultRolloverStrategy/ }
274 its(:content) { should match /^log4j2.appender.rolling.strategy.max = #{log_max_rollover}/ }
275 its(:content) { should match /^log4j2.appender.rolling.strategy.fileIndex = #{log_rollover_fileindex}/ }
278 describe file('/opt/opendaylight/etc/org.ops4j.pax.logging.cfg') do
279 its(:content) { should match /^log4j2.pattern = #{log_pattern}/ }
283 # Shared function for validations related to the Karaf config file
284 def karaf_config_validations(options = {})
285 # NB: These param defaults should match the ones used by the opendaylight
286 # class, which are defined in opendaylight::params
287 # TODO: Remove this possible source of bugs^^
288 extra_features = options.fetch(:extra_features, [])
289 default_features = options.fetch(:default_features, ['standard', 'wrap', 'ssh'])
291 # Create one list of all of the features
292 features = default_features + extra_features
294 describe file('/opt/opendaylight/etc/org.apache.karaf.features.cfg') do
295 it { should be_file }
296 it { should be_owned_by 'odl' }
297 it { should be_grouped_into 'odl' }
298 its(:content) { should match /^featuresBoot=#{features.join(",")}/ }
302 # Shared function for validations related to the ODL REST port config file
303 def port_config_validations(options = {})
304 # NB: This param default should match the one used by the opendaylight
305 # class, which is defined in opendaylight::params
306 # TODO: Remove this possible source of bugs^^
307 odl_rest_port = options.fetch(:odl_rest_port, 8181)
309 describe file('/opt/opendaylight/etc/jetty.xml') do
310 it { should be_file }
311 it { should be_owned_by 'odl' }
312 it { should be_grouped_into 'odl' }
313 its(:content) { should match /Property name="jetty.port" default="#{odl_rest_port}"/ }
316 describe file('/opt/opendaylight/etc/org.ops4j.pax.web.cfg') do
317 it { should be_file }
318 it { should be_owned_by 'odl' }
319 it { should be_grouped_into 'odl' }
320 its(:content) { should match /org.osgi.service.http.port = #{odl_rest_port}/ }
324 # Shared function for validations related to the ODL bind IP
325 def odl_bind_ip_validation(options = {})
326 # NB: This param default should match the one used by the opendaylight
327 # class, which is defined in opendaylight::params
328 # TODO: Remove this possible source of bugs^^
329 odl_bind_ip = options.fetch(:odl_bind_ip, '0.0.0.0')
331 if odl_bind_ip != '0.0.0.0'
332 describe file('/opt/opendaylight/etc/org.apache.karaf.shell.cfg') do
333 it { should be_file }
334 it { should be_owned_by 'odl' }
335 it { should be_grouped_into 'odl' }
336 its(:content) { should match /sshHost = #{odl_bind_ip}/ }
339 describe file('/opt/opendaylight/etc/org.opendaylight.ovsdb.library.cfg') do
340 it { should be_file }
341 it { should be_owned_by 'odl' }
342 it { should be_grouped_into 'odl' }
343 its(:content) { should match /ovsdb-listener-ip = #{odl_bind_ip}/ }
346 describe file('/opt/opendaylight/etc/opendaylight/datastore/initial/config/default-openflow-connection-config.xml') do
347 it { should be_file }
348 it { should be_owned_by 'odl' }
349 it { should be_grouped_into 'odl' }
350 its(:content) { should match /<address>#{odl_bind_ip}<\/address>/ }
353 describe command("loop_count=0; until [[ \$loop_count -ge 30 ]]; do netstat -punta | grep 8101 | grep #{odl_bind_ip} && break; loop_count=\$[\$loop_count+1]; sleep 1; done; echo \"Waited \$loop_count seconds to detect ODL karaf bound to IP\"") do
354 its(:exit_status) { should eq 0 }
357 describe command("loop_count=0; until [[ \$loop_count -ge 60 ]]; do netstat -punta | grep 6653 | grep #{odl_bind_ip} && break; loop_count=\$[\$loop_count+1]; sleep 1; done; echo \"Waited \$loop_count seconds to detect ODL karaf bound to IP\"") do
358 its(:exit_status) { should eq 0 }
361 describe command("loop_count=0; until [[ \$loop_count -ge 60 ]]; do netstat -punta | grep 6640 | grep #{odl_bind_ip} && break; loop_count=\$[\$loop_count+1]; sleep 1; done; echo \"Waited \$loop_count seconds to detect ODL karaf bound to IP\"") do
362 its(:exit_status) { should eq 0 }
367 # Shared function for validations related to custom logging verbosity
368 def log_level_validations(options = {})
369 # NB: This param default should match the one used by the opendaylight
370 # class, which is defined in opendaylight::params
371 # TODO: Remove this possible source of bugs^^
372 log_levels = options.fetch(:log_levels, {})
375 # Should contain log level config file
376 describe file('/opt/opendaylight/etc/org.ops4j.pax.logging.cfg') do
377 it { should be_file }
378 it { should be_owned_by 'odl' }
379 it { should be_grouped_into 'odl' }
382 # Should contain log level config file
383 describe file('/opt/opendaylight/etc/org.ops4j.pax.logging.cfg') do
384 it { should be_file }
385 it { should be_owned_by 'odl' }
386 it { should be_grouped_into 'odl' }
388 # Verify each custom log level config entry
389 log_levels.each_pair do |logger, level|
390 underscored_version = "#{logger}".gsub('.', '_')
391 describe file('/opt/opendaylight/etc/org.ops4j.pax.logging.cfg') do
392 it { should be_file }
393 it { should be_owned_by 'odl' }
394 it { should be_grouped_into 'odl' }
395 its(:content) { should match /^log4j2.logger.#{underscored_version}.level = #{level}/ }
396 its(:content) { should match /^log4j2.logger.#{underscored_version}.name = #{logger}/ }
402 # Shared function for validations related to ODL OVSDB HA config
403 def enable_ha_validations(options = {})
404 # NB: This param default should match the one used by the opendaylight
405 # class, which is defined in opendaylight::params
406 # TODO: Remove this possible source of bugs^^
407 enable_ha = options.fetch(:enable_ha, false)
408 ha_node_ips = options.fetch(:ha_node_ips, [])
409 odl_bind_ip = options.fetch(:odl_bind_ip, '0.0.0.0')
410 ha_db_modules = options.fetch(:ha_db_modules, { 'default' => false })
412 ha_node_count = ha_node_ips.size
414 if (enable_ha) && (ha_node_count < 2)
415 # Check for HA_NODE_COUNT < 2
416 fail("Number of HA nodes less than 2: #{ha_node_count} and HA Enabled")
420 ha_node_index = ha_node_ips.index(odl_bind_ip)
421 describe file('/opt/opendaylight/configuration/initial/akka.conf') do
422 it { should be_file }
423 it { should be_owned_by 'odl' }
424 it { should be_grouped_into 'odl' }
425 its(:content) { should match /roles\s*=\s*\["member-#{ha_node_index}"\]/ }
428 ha_db_modules.each do |mod, urn|
429 describe file('/opt/opendaylight/configuration/initial/module-shards.conf') do
430 it { should be_file }
431 it { should be_owned_by 'odl' }
432 it { should be_grouped_into 'odl' }
433 its(:content) { should match /name = "#{mod}"/ }
437 describe file('/opt/opendaylight/configuration/initial/modules.conf') do
438 it { should be_file }
439 it { should be_owned_by 'odl' }
440 it { should be_grouped_into 'odl' }
443 describe file('/opt/opendaylight/configuration/initial/modules.conf') do
444 it { should be_file }
445 it { should be_owned_by 'odl' }
446 it { should be_grouped_into 'odl' }
447 its(:content) { should match /name = "#{mod}"/ }
448 its(:content) { should match /namespace = "#{urn}"/ }
455 # Shared function that handles validations specific to RPM-type installs
456 def rpm_validations()
457 rpm_repo = ENV['RPM_REPO']
459 describe yumrepo('opendaylight') do
461 it { should be_enabled }
464 describe package('opendaylight') do
465 it { should be_installed }
469 # Shared function that handles validations specific to Deb-type installs
470 def deb_validations()
471 deb_repo = ENV['DEB_REPO']
473 # Docs: http://serverspec.org/resource_types.html#ppa
474 describe ppa(deb_repo) do
476 it { should be_enabled }
479 describe package('opendaylight') do
480 it { should be_installed }
484 # Shared function for validations related to username/password
485 def username_password_validations(options = {})
486 # NB: This param default should match the one used by the opendaylight
487 # class, which is defined in opendaylight::params
488 # TODO: Remove this possible source of bugs^^
489 odl_username = options.fetch(:username, 'admin')
490 odl_password = options.fetch(:password, 'admin')
491 odl_check_url = 'http://127.0.0.1:8181/restconf'
493 describe file('/opt/opendaylight/data/idmlight.db.mv.db') do
494 it { should be_file }
497 describe command("loop_count=0; until [[ \$loop_count -ge 300 ]]; do curl -o /dev/null --fail --silent --head -u #{odl_username}:#{odl_password} #{odl_check_url} && break; loop_count=\$[\$loop_count+1]; sleep 1; done; echo \"Waited \$loop_count seconds for ODL to become active\"") do
498 its(:exit_status) { should eq 0 }
501 describe command("curl -o /dev/null --fail --silent --head -u #{odl_username}:#{odl_password} #{odl_check_url}") do
502 its(:exit_status) { should eq 0 }
506 # Shared function for validations related to the SNAT config file
507 def snat_mechanism_validations(options = {})
508 # NB: This param default should match the one used by the opendaylight
509 # class, which is defined in opendaylight::params
510 # TODO: Remove this possible source of bugs^^
511 snat_mechanism = options.fetch(:snat_mechanism, 'controller')
513 describe file('/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-natservice-config.xml') do
514 it { should be_file }
515 it { should be_owned_by 'odl' }
516 it { should be_grouped_into 'odl' }
517 its(:content) { should match /<nat-mode>#{snat_mechanism}<\/nat-mode>/ }
521 # Shared function for validations related to SFC
522 def sfc_validations(options = {})
523 # NB: This param default should match the one used by the opendaylight
524 # class, which is defined in opendaylight::params
525 # TODO: Remove this possible source of bugs^^
527 extra_features = options.fetch(:extra_features, [])
528 if extra_features.include? 'odl-netvirt-sfc'
534 describe file('/opt/opendaylight/etc/opendaylight/datastore/initial/config/genius-itm-config.xml') do
535 it { should be_file }
536 it { should be_owned_by 'odl' }
537 it { should be_grouped_into 'odl' }
538 its(:content) { should match /<gpe-extension-enabled>#{sfc_enabled}<\/gpe-extension-enabled>/ }
542 # Shared function for validations related to tos value for DSCP marking
543 def dscp_validations(options = {})
544 # NB: This param default should match the one used by the opendaylight
545 # class, which is defined in opendaylight::params
546 # TODO: Remove this possible source of bugs^^
548 inherit_dscp_marking = options.fetch(:inherit_dscp_marking, false)
550 if inherit_dscp_marking
551 describe file('/opt/opendaylight/etc/opendaylight/datastore/initial/config/genius-itm-config.xml') do
552 it { should be_file }
553 it { should be_owned_by 'odl' }
554 it { should be_grouped_into 'odl' }
555 its(:content) { should match /<default-tunnel-tos>inherit<\/default-tunnel-tos>/ }
560 def websocket_address_validations(options = {})
561 # NB: This param default should match the one used by the opendaylight
562 # class, which is defined in opendaylight::params
563 # TODO: Remove this possible source of bugs^^
564 odl_bind_ip = options.fetch(:odl_bind_ip, '0.0.0.0')
566 if not odl_bind_ip.eql? '0.0.0.0'
567 describe file('/opt/opendaylight/etc/org.opendaylight.restconf.cfg') do
568 it { should be_file }
569 it { should be_owned_by 'odl' }
570 it { should be_grouped_into 'odl' }
571 its(:content) { should match /^websocket-address=#{odl_bind_ip}/ }
574 describe file('/opt/opendaylight/etc/org.opendaylight.restconf.cfg') do
575 it { should be_file }
580 def tls_validations(options = {})
581 # NB: This param default should match the one used by the opendaylight
582 # class, which is defined in opendaylight::params
583 # TODO: Remove this possible source of bugs^^
584 tls_keystore_password = options.fetch(:tls_keystore_password)
585 odl_rest_port = options.fetch(:odl_rest_port, 8181)
587 describe file('/opt/opendaylight/etc/org.ops4j.pax.web.cfg') do
588 it { should be_file }
589 it { should be_owned_by 'odl' }
590 it { should be_grouped_into 'odl' }
591 its(:content) { should match /org.osgi.service.http.port.secure = #{odl_rest_port}/ }
592 its(:content) { should match /org.ops4j.pax.web.ssl.keystore = configuration\/ssl\/ctl.jks/ }
593 its(:content) { should match /org.ops4j.pax.web.ssl.password = #{tls_keystore_password}/ }
594 its(:content) { should match /org.ops4j.pax.web.ssl.keypassword = #{tls_keystore_password}/ }
595 its(:content) { should match /org.osgi.service.http.secure.enabled = true/ }
596 its(:content) { should match /org.osgi.service.http.enabled = false/ }
599 describe file('/opt/opendaylight/etc/org.opendaylight.ovsdb.library.cfg') do
600 it { should be_file }
601 it { should be_owned_by 'odl' }
602 it { should be_grouped_into 'odl' }
603 its(:content) { should match /use-ssl = true/ }
606 describe file('/opt/opendaylight/etc/opendaylight/datastore/initial/config/default-openflow-connection-config.xml') do
607 it { should be_file }
608 it { should be_owned_by 'odl' }
609 it { should be_grouped_into 'odl' }
610 its(:content) { should match /<keystore-password>#{tls_keystore_password}<\/keystore-password>/ }
611 its(:content) { should match /<truststore-password>#{tls_keystore_password}<\/truststore-password>/ }
612 its(:content) { should match /<transport-protocol>TLS<\/transport-protocol>/ }
615 describe file('/opt/opendaylight/etc/opendaylight/datastore/initial/config/aaa-cert-config.xml') do
616 it { should be_file }
617 it { should be_owned_by 'odl' }
618 it { should be_grouped_into 'odl' }
619 its(:content) { should match /<store-password>#{tls_keystore_password}<\/store-password>/ }
620 its(:content) { should match /<use-mdsal>false<\/use-mdsal>/ }
623 describe file('/opt/opendaylight/etc/jetty.xml') do
624 it { should be_file }
625 it { should be_owned_by 'odl' }
626 it { should be_grouped_into 'odl' }
627 its(:content) { should match /<Property name="jetty.secure.port" default="#{odl_rest_port}" \/>/ }
631 # Shared function for validations related to OVS statistics polling
632 def stats_polling_validations(options = {})
633 # NB: This param default should match the one used by the opendaylight
634 # class, which is defined in opendaylight::params
635 # TODO: Remove this possible source of bugs^^
637 stats_polling_enabled = options.fetch(:stats_polling_enabled, false)
638 describe file('/opt/opendaylight/etc/org.opendaylight.openflowplugin.cfg') do
639 it { should be_file }
640 it { should be_owned_by 'odl' }
641 it { should be_grouped_into 'odl' }
642 its(:content) { should match /is-statistics-polling-on=#{stats_polling_enabled}/ }
646 # Shared function for validations related to inactivity probe
647 def inactivity_probe_validations(options = {})
648 # NB: This param default should match the one used by the opendaylight
649 # class, which is defined in opendaylight::params
650 # TODO: Remove this possible source of bugs^^
652 inactivity_probe = options.fetch(:inactivity_probe, :undef)
653 unless inactivity_probe == :undef
654 describe file('/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-elanmanager-config.xml') do
655 it { should be_file }
656 it { should be_owned_by 'odl' }
657 it { should be_grouped_into 'odl' }
658 its(:content) { should match /<controller-inactivity-probe>#{inactivity_probe}/ }