1 require 'spec_helper_acceptance'
3 # NB: There are a large number of helper functions used in these tests.
4 # They make this code much more friendly, but may need to be referenced.
5 # The serverspec helpers (`should`, `be_running`...) are documented here:
6 # http://serverspec.org/resource_types.html
7 # Custom helpers (`install_odl`, `*_validations`) are in:
8 # <this module>/spec/spec_helper_acceptance.rb
10 describe 'opendaylight class' do
11 describe 'testing install methods' do
12 # Call specialized helper fn to install OpenDaylight
15 # Run checks specific to install type, via env var passed from Rakefile
16 if :osfamily == 'RedHat'
17 # Call specialized helper fn for RPM-type install validations
19 elsif :osfamily == 'Debian'
20 # Call specialized helper fn for Deb-type install validations
24 # Use helper fn to run generic validations
28 describe 'testing Karaf config file' do
29 describe 'using default features' do
30 context 'and not passing extra features' do
31 # Call specialized helper fn to install OpenDaylight
34 # Call specialized helper fn for Karaf config validations
35 karaf_config_validations
38 context 'and passing extra features' do
39 # These are real but arbitrarily chosen features
40 extra_features = ['odl-base-all', 'odl-ovsdb-all']
42 # Call specialized helper fn to install OpenDaylight
43 install_odl(extra_features: extra_features)
45 # Call specialized helper fn for Karaf config validations
46 karaf_config_validations(extra_features: extra_features)
50 describe 'overriding default features' do
51 # These are real but arbitrarily chosen features
52 default_features = ['standard', 'ssh']
54 context 'and not passing extra features' do
55 # Call specialized helper fn to install OpenDaylight
56 install_odl(default_features: default_features)
58 # Call specialized helper fn for Karaf config validations
59 karaf_config_validations(default_features: default_features)
62 context 'and passing extra features' do
63 # These are real but arbitrarily chosen features
64 extra_features = ['odl-base-all', 'odl-ovsdb-all']
66 # Call specialized helper fn to install OpenDaylight
67 install_odl(default_features: default_features,
68 extra_features: extra_features)
70 # Call specialized helper fn for Karaf config validations
71 karaf_config_validations(default_features: default_features,
72 extra_features: extra_features)
77 describe 'logging mechanism' do
78 context 'log to file using default size and rollover' do
79 # Call specialized helper fn to install OpenDaylight
82 # Call specialized helper fn for log settings validations
83 log_settings_validations
86 context 'log to file customising size' do
87 # Call specialized helper fn to install OpenDaylight
88 install_odl(log_max_size: '1GB')
90 # Call specialized helper fn for log settings validations
91 log_settings_validations(log_max_size: '1GB')
94 context 'log to file customising rollover' do
95 # Call specialized helper fn to install OpenDaylight
96 install_odl(log_max_rollover: 3)
98 # Call specialized helper fn for log settings validations
99 log_settings_validations(log_max_rollover: 3)
102 context 'log to file customising size and rollover' do
103 # Call specialized helper fn to install OpenDaylight
104 install_odl(log_max_size: '1GB',
106 log_rollover_fileIndex: 'min')
108 # Call specialized helper fn for log settings validations
109 log_settings_validations(log_max_size: '1GB',
111 log_rollover_fileIndex: 'min')
114 context 'log to file customizing pattern' do
115 # Call specialized helper fn to install OpenDaylight
116 install_odl(log_pattern: '%d{ISO8601} | %-5p | %-16t | %m%n')
118 # Call specialized helper fn for log settings validations
119 log_settings_validations(log_pattern: '%d{ISO8601} | %-5p | %-16t | %m%n')
122 context 'log to console' do
123 # Call specialized helper fn to install OpenDaylight
124 install_odl(log_mechanism: 'console')
126 # Call specialized helper fn for log settings validations
127 log_settings_validations(log_mechanism: 'console')
130 context 'log to console customizing pattern' do
131 # Call specialized helper fn to install OpenDaylight
132 install_odl(log_mechanism: 'console',
133 log_pattern: '%d{ISO8601} | %-5p | %-16t | %m%n')
135 # Call specialized helper fn for log settings validations
136 log_settings_validations(log_mechanism: 'console',
137 log_pattern: '%d{ISO8601} | %-5p | %-16t | %m%n')
141 describe 'testing REST port config file' do
142 context 'using default port' do
143 # Call specialized helper fn to install OpenDaylight
146 # Call specialized helper fn for REST port config validations
147 port_config_validations
150 context 'overriding default port' do
151 # Call specialized helper fn to install OpenDaylight
152 install_odl(odl_rest_port: 7777)
154 # Call specialized helper fn for REST port config validations
155 port_config_validations(odl_rest_port: 7777)
159 describe 'testing binding ODL to an IP' do
160 install_odl(odl_bind_ip: '127.0.0.1')
161 context 'using specific IP for ODL' do
162 odl_bind_ip_validation(odl_bind_ip: '127.0.0.1')
166 describe 'testing custom logging verbosity' do
167 context 'using default log levels' do
168 # Call specialized helper fn to install OpenDaylight
171 # Call specialized helper fn for custom logger verbosity validations
172 log_level_validations
175 context 'adding one custom log level' do
176 custom_log_levels = { 'org.opendaylight.ovsdb' => 'TRACE' }
178 # Call specialized helper fn to install OpenDaylight
179 install_odl(log_levels: custom_log_levels)
181 # Call specialized helper fn for custom logger verbosity validations
182 log_level_validations(log_levels: custom_log_levels)
185 context 'adding two custom log level' do
186 custom_log_levels = { 'org.opendaylight.ovsdb' => 'TRACE',
187 'org.opendaylight.ovsdb.lib' => 'INFO' }
189 # Call specialized helper fn to install OpenDaylight
190 install_odl(log_levels: custom_log_levels)
192 # Call specialized helper fn for custom logger verbosity validations
193 log_level_validations(log_levels: custom_log_levels)
197 describe 'testing odl username/password' do
198 bind_ip = '127.0.0.1'
199 context 'using default username/password' do
200 context 'using non-default bind ip' do
201 # Call specialized helper fn to install OpenDaylight
202 install_odl({:odl_bind_ip => bind_ip, :extra_features => ['odl-restconf']})
204 # Call specialized helper fn for username/password validations
205 #username_password_validations
210 describe 'testing odl HA configuration' do
211 bind_ip = '127.0.0.1'
212 odl_ips = ['127.0.0.1', '127.0.0.2', '127.0.0.3']
213 context 'using default modules' do
214 install_odl(odl_bind_ip: bind_ip, enable_ha: true, ha_node_ips: odl_ips)
216 enable_ha_validations(odl_bind_ip: bind_ip, enable_ha: true,
217 ha_node_ips: odl_ips)
220 context 'specifying datastore modules' do
223 'topology' => 'urn:opendaylight:topology'
225 install_odl(odl_bind_ip: bind_ip, enable_ha: true, ha_node_ips: odl_ips,
226 ha_db_modules: db_modules)
227 enable_ha_validations(odl_bind_ip: bind_ip, enable_ha: true,
228 ha_node_ips: odl_ips, ha_db_modules: db_modules)
232 describe 'testing configuring SNAT' do
233 context 'using default SNAT mechanism' do
234 # Call specialized helper fn to install OpenDaylight
235 install_odl(extra_features: ['odl-netvirt-openstack'])
237 # Call specialized helper fn for SNAT config validations
238 snat_mechanism_validations
241 context 'using conntrack SNAT' do
242 # Call specialized helper fn to install OpenDaylight
243 install_odl(extra_features: ['odl-netvirt-openstack'], snat_mechanism: 'conntrack')
245 # Call specialized helper fn for SNAT mechanism validations
246 snat_mechanism_validations(snat_mechanism: 'conntrack')
250 describe 'testing configuring SFC' do
251 context 'not using SFC feature' do
252 # Call specialized helper fn to install OpenDaylight
255 # Call specialized helper fn for SFC config validations
259 context 'using SFC feature' do
260 # Call specialized helper fn to install OpenDaylight
261 install_odl(extra_features: ['odl-netvirt-sfc'])
263 # Call specialized helper fn for SFC config validations
264 sfc_validations(extra_features: ['odl-netvirt-sfc'])
268 describe 'testing configuring tos value for DSCP marking' do
269 context 'not enabling DSCP marking' do
270 # Call specialized helper fn to install OpenDaylight
273 # Call specialized helper fn for SFC config validations
277 context 'enabling DSCP marking' do
278 # Call specialized helper fn to install OpenDaylight
279 install_odl(inherit_dscp_marking: true)
281 # Call specialized helper fn for SFC config validations
282 dscp_validations(inherit_dscp_marking: true)
286 describe 'testing websocket address config' do
287 context 'using default ip' do
288 # Call specialized helper fn to install OpenDaylight
291 # Call specialized helper fn for websocket address config validations
292 websocket_address_validations
295 context 'overriding default ip' do
296 # Call specialized helper fn to install OpenDaylight
297 install_odl(odl_bind_ip: '127.0.0.1')
299 # Call specialized helper fn for websocket address config validations
300 websocket_address_validations(odl_bind_ip: '127.0.0.1')
304 describe 'testing enabling TLS' do
305 context 'with self-signed key/cert creation' do
306 install_odl(enable_tls: true, tls_keystore_password: '123456')
308 # Call specialized helper fn for TLS config validations
309 tls_validations(enable_tls: true, tls_keystore_password: '123456')
313 describe 'testing stats polling enablement' do
314 context 'with polling enabled' do
315 # Call specialized helper fn to install OpenDaylight
316 install_odl(stats_polling_enabled: true)
318 # Call specialized helper fn for polling enablement validations
319 stats_polling_validations(stats_polling_enabled: true)
322 context 'with polling disabled' do
323 # Call specialized helper fn to install OpenDaylight
326 # Call specialized helper fn for polling enablement validations
327 stats_polling_validations
331 describe 'testing different IPv deployments' do
332 context 'IPv6 support tests' do
333 # Call specialized helper fn to install OpenDaylight
334 install_odl(odl_bind_ip: '::1')
336 # Call specialized helper fn for polling enablement validations
337 generic_validations(odl_bind_ip: '::1')
340 context 'IPv4 support test' do
341 # Call specialized helper fn to install OpenDaylight
342 install_odl(odl_bind_ip: '127.0.0.1')
344 # Call specialized helper fn for polling enablement validations
345 generic_validations(odl_bind_ip: '127.0.0.1')
349 describe 'testing passing extra java option' do
350 context 'pass java heap size' do
351 # Call specialized helper fn to install OpenDaylight
352 install_odl(java_opts: '-Xmx8192m')
354 # Call specialized helper fn for polling enablement validations
355 generic_validations(java_opts: '-Xmx8192m')
359 describe 'testing configuring inactivity probe' do
360 context 'with specifying inactivity probe timer' do
361 # Call specialized helper fn to install OpenDaylight
362 install_odl(inactivity_probe: 99999)
364 # Call specialized helper fn for probe validations
365 inactivity_probe_validations(inactivity_probe: 99999)