Binds OpenFlow and OVSDB IPs
[integration/packaging/puppet-opendaylight.git] / spec / classes / opendaylight_spec.rb
1 require 'spec_helper'
2
3 describe 'opendaylight' do
4   # All tests that check OS support/not-support
5   describe 'OS support tests' do
6     # All tests for OSs in the Red Hat family (CentOS, Fedora)
7     describe 'OS family Red Hat ' do
8       osfamily = 'RedHat'
9       # All tests for Fedora
10       describe 'Fedora' do
11         operatingsystem = 'Fedora'
12
13         # All tests for supported versions of Fedora
14         ['25', '26'].each do |operatingsystemmajrelease|
15           context "#{operatingsystemmajrelease}" do
16             let(:facts) {{
17               :osfamily => osfamily,
18               :operatingsystem => operatingsystem,
19               :operatingsystemmajrelease => operatingsystemmajrelease,
20             }}
21             # Run shared tests applicable to all supported OSs
22             # Note that this function is defined in spec_helper
23             generic_tests
24
25             # Run tests that specialize in checking rpm-based installs
26             # NB: Only testing defaults here, specialized rpm tests elsewhere
27             # Note that this function is defined in spec_helper
28             rpm_install_tests(operatingsystem: operatingsystem)
29
30             # Run tests that specialize in checking Karaf feature installs
31             # NB: Only testing defaults here, specialized Karaf tests elsewhere
32             # Note that this function is defined in spec_helper
33             karaf_feature_tests
34
35             # Run tests that specialize in checking ODL's REST port config
36             # NB: Only testing defaults here, specialized log level tests elsewhere
37             # Note that this function is defined in spec_helper
38             odl_rest_port_tests
39
40             # Run tests that specialize in checking custom log level config
41             # NB: Only testing defaults here, specialized log level tests elsewhere
42             # Note that this function is defined in spec_helper
43             log_level_tests
44
45             # Run tests that specialize in checking ODL OVSDB HA config
46             # NB: Only testing defaults here, specialized enabling HA tests elsewhere
47             # Note that this function is defined in spec_helper
48             enable_ha_tests
49
50             # Run tests that specialize in checking log file settings
51             # NB: Only testing defaults here, specialized log file settings tests elsewhere
52             # Note that this function is defined in spec_helper
53             log_settings
54           end
55         end
56
57         # All tests for unsupported versions of Fedora
58         ['23'].each do |operatingsystemmajrelease|
59           context "#{operatingsystemmajrelease}" do
60             let(:facts) {{
61               :osfamily => osfamily,
62               :operatingsystem => operatingsystem,
63               :operatingsystemmajrelease => operatingsystemmajrelease,
64             }}
65             # Run shared tests applicable to all unsupported OSs
66             # Note that this function is defined in spec_helper
67             expected_msg = "Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}"
68             unsupported_os_tests(expected_msg: expected_msg)
69           end
70         end
71       end
72
73       # All tests for CentOS
74       describe 'CentOS' do
75         operatingsystem = 'CentOS'
76
77         # All tests for supported versions of CentOS
78         ['7'].each do |operatingsystemmajrelease|
79           context "#{operatingsystemmajrelease}" do
80             let(:facts) {{
81               :osfamily => osfamily,
82               :operatingsystem => operatingsystem,
83               :operatingsystemmajrelease => operatingsystemmajrelease,
84             }}
85             # Run shared tests applicable to all supported OSs
86             # Note that this function is defined in spec_helper
87             generic_tests
88
89             # Run test that specialize in checking rpm-based installs
90             # NB: Only testing defaults here, specialized rpm tests elsewhere
91             # Note that this function is defined in spec_helper
92             rpm_install_tests
93
94             # Run test that specialize in checking Karaf feature installs
95             # NB: Only testing defaults here, specialized Karaf tests elsewhere
96             # Note that this function is defined in spec_helper
97             karaf_feature_tests
98
99             # Run tests that specialize in checking ODL's REST port config
100             # NB: Only testing defaults here, specialized log level tests elsewhere
101             # Note that this function is defined in spec_helper
102             odl_rest_port_tests
103
104             # Run test that specialize in checking custom log level config
105             # NB: Only testing defaults here, specialized log level tests elsewhere
106             # Note that this function is defined in spec_helper
107             log_level_tests
108
109             # Run tests that specialize in checking ODL OVSDB HA config
110             # NB: Only testing defaults here, specialized enabling HA tests elsewhere
111             # Note that this function is defined in spec_helper
112             enable_ha_tests
113
114             # Run tests that specialize in checking log file settings
115             # NB: Only testing defaults here, specialized log file settings tests elsewhere
116             # Note that this function is defined in spec_helper
117             log_settings
118           end
119         end
120
121         # All tests for unsupported versions of CentOS
122         ['6'].each do |operatingsystemmajrelease|
123           context "#{operatingsystemmajrelease}" do
124             let(:facts) {{
125               :osfamily => osfamily,
126               :operatingsystem => operatingsystem,
127               :operatingsystemmajrelease => operatingsystemmajrelease,
128             }}
129             # Run shared tests applicable to all unsupported OSs
130             # Note that this function is defined in spec_helper
131             expected_msg = "Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}"
132             unsupported_os_tests(expected_msg: expected_msg)
133           end
134         end
135       end
136     end
137
138     # All tests for OSs in the Debian family (Ubuntu)
139     describe 'OS family Debian' do
140       osfamily = 'Debian'
141
142       # All tests for Ubuntu 16.04
143       describe 'Ubuntu' do
144         operatingsystem = 'Ubuntu'
145
146         # All tests for supported versions of Ubuntu
147         ['16.04'].each do |operatingsystemrelease|
148           context "#{operatingsystemrelease}" do
149             let(:facts) {{
150               :osfamily => osfamily,
151               :operatingsystem => operatingsystem,
152               :operatingsystemrelease => operatingsystemrelease,
153               :lsbdistid => operatingsystem,
154               :lsbdistrelease => operatingsystemrelease,
155               :lsbdistcodename => 'xenial',
156               :puppetversion => '4.9.0',
157               :path => ['/usr/local/bin', '/usr/bin', '/bin'],
158             }}
159
160             # Run shared tests applicable to all supported OSs
161             # Note that this function is defined in spec_helper
162             generic_tests
163
164             # Run test that specialize in checking deb-based installs
165             # Note that this function is defined in spec_helper
166             deb_install_tests
167
168             # Run test that specialize in checking Karaf feature installs
169             # NB: Only testing defaults here, specialized Karaf tests elsewhere
170             # Note that this function is defined in spec_helper
171             karaf_feature_tests
172
173             # Run tests that specialize in checking ODL's REST port config
174             # NB: Only testing defaults here, specialized log level tests elsewhere
175             # Note that this function is defined in spec_helper
176             odl_rest_port_tests
177
178             # Run test that specialize in checking custom log level config
179             # NB: Only testing defaults here, specialized log level tests elsewhere
180             # Note that this function is defined in spec_helper
181             log_level_tests
182
183             # Run tests that specialize in checking ODL OVSDB HA config
184             # NB: Only testing defaults here, specialized enabling HA tests elsewhere
185             # Note that this function is defined in spec_helper
186             enable_ha_tests
187
188             # Run tests that specialize in checking log file settings
189             # NB: Only testing defaults here, specialized log file settings tests elsewhere
190             # Note that this function is defined in spec_helper
191             log_settings
192           end
193         end
194
195         # All tests for unsupported versions of Ubuntu
196         ['12.04', '14.04', '15.10'].each do |operatingsystemrelease|
197           context "#{operatingsystemrelease}" do
198             let(:facts) {{
199               :osfamily => osfamily,
200               :operatingsystem => operatingsystem,
201               :operatingsystemrelease => operatingsystemrelease,
202               :lsbdistid => operatingsystem,
203               :lsbdistrelease => operatingsystemrelease,
204               :lsbdistcodename => 'xenial',
205               :puppetversion => '4.9.0',
206             }}
207             # Run shared tests applicable to all unsupported OSs
208             # Note that this function is defined in spec_helper
209             expected_msg = "Unsupported OS: #{operatingsystem} #{operatingsystemrelease}"
210             unsupported_os_tests(expected_msg: expected_msg)
211           end
212         end
213       end
214     end
215
216     # All tests for unsupported OS families
217     ['Suse', 'Solaris'].each do |osfamily|
218       context "OS family #{osfamily}" do
219         let(:facts) {{
220           :osfamily => osfamily,
221         }}
222
223         # Run shared tests applicable to all unsupported OSs
224         # Note that this function is defined in spec_helper
225         expected_msg = "Unsupported OS family: #{osfamily}"
226         unsupported_os_tests(expected_msg: expected_msg)
227       end
228     end
229   end
230
231   # All Karaf feature tests
232   describe 'Karaf feature tests' do
233     # Non-OS-type tests assume CentOS 7
234     #   See issue #43 for reasoning:
235     #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
236     osfamily = 'RedHat'
237     operatingsystem = 'CentOS'
238     operatingsystemmajrelease = '7'
239     describe 'using default features' do
240       context 'and not passing extra features' do
241         let(:facts) {{
242           :osfamily => osfamily,
243           :operatingsystem => operatingsystem,
244           :operatingsystemmajrelease => operatingsystemmajrelease,
245         }}
246
247         let(:params) {{ }}
248
249         # Run shared tests applicable to all supported OSs
250         # Note that this function is defined in spec_helper
251         generic_tests
252
253         # Run test that specialize in checking Karaf feature installs
254         # Note that this function is defined in spec_helper
255         karaf_feature_tests
256       end
257
258       context 'and passing extra features' do
259         let(:facts) {{
260           :osfamily => osfamily,
261           :operatingsystem => operatingsystem,
262           :operatingsystemmajrelease => operatingsystemmajrelease,
263         }}
264
265         # These are real but arbitrarily chosen features
266         extra_features = ['odl-base-all', 'odl-ovsdb-all']
267         let(:params) {{
268           :extra_features => extra_features,
269         }}
270
271         # Run shared tests applicable to all supported OSs
272         # Note that this function is defined in spec_helper
273         generic_tests
274
275         # Run test that specialize in checking Karaf feature installs
276         # Note that this function is defined in spec_helper
277         karaf_feature_tests(extra_features: extra_features)
278       end
279     end
280
281     describe 'overriding default features' do
282       default_features = ['standard', 'ssh']
283       context 'and not passing extra features' do
284         let(:facts) {{
285           :osfamily => osfamily,
286           :operatingsystem => operatingsystem,
287           :operatingsystemmajrelease => operatingsystemmajrelease,
288         }}
289
290         let(:params) {{
291           :default_features => default_features,
292         }}
293
294         # Run shared tests applicable to all supported OSs
295         # Note that this function is defined in spec_helper
296         generic_tests
297
298         # Run test that specialize in checking Karaf feature installs
299         # Note that this function is defined in spec_helper
300         karaf_feature_tests(default_features: default_features)
301       end
302
303       context 'and passing extra features' do
304         let(:facts) {{
305           :osfamily => osfamily,
306           :operatingsystem => operatingsystem,
307           :operatingsystemmajrelease => operatingsystemmajrelease,
308         }}
309
310         # These are real but arbitrarily chosen features
311         extra_features = ['odl-base-all', 'odl-ovsdb-all']
312         let(:params) {{
313           :default_features => default_features,
314           :extra_features => extra_features,
315         }}
316
317         # Run shared tests applicable to all supported OSs
318         # Note that this function is defined in spec_helper
319         generic_tests
320
321         # Run test that specialize in checking Karaf feature installs
322         # Note that this function is defined in spec_helper
323         karaf_feature_tests(default_features: default_features, extra_features: extra_features)
324       end
325     end
326   end
327
328   # All ODL IP/REST port tests
329   describe 'IP and REST port tests' do
330     # Non-OS-type tests assume CentOS 7
331     #   See issue #43 for reasoning:
332     #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
333     osfamily = 'RedHat'
334     operatingsystem = 'CentOS'
335     operatingsystemmajrelease = '7'
336     context 'using default REST port' do
337       let(:facts) {{
338         :osfamily => osfamily,
339         :operatingsystem => operatingsystem,
340         :operatingsystemmajrelease => operatingsystemmajrelease,
341       }}
342
343       let(:params) {{ }}
344
345       # Run shared tests applicable to all supported OSs
346       # Note that this function is defined in spec_helper
347       generic_tests
348
349       # Run test that specialize in checking ODL REST port config
350       # Note that this function is defined in spec_helper
351       odl_rest_port_tests
352     end
353
354     context 'overriding default REST and IP port' do
355       let(:facts) {{
356         :osfamily => osfamily,
357         :operatingsystem => operatingsystem,
358         :operatingsystemmajrelease => operatingsystemmajrelease,
359       }}
360
361       let(:params) {{
362         :odl_rest_port => 7777,
363         :odl_bind_ip => '127.0.0.1'
364       }}
365
366       # Run shared tests applicable to all supported OSs
367       # Note that this function is defined in spec_helper
368       generic_tests(odl_bind_ip: '127.0.0.1')
369
370       # Run test that specialize in checking ODL REST port config
371       # Note that this function is defined in spec_helper
372       odl_rest_port_tests(odl_rest_port: 7777, odl_bind_ip: '127.0.0.1')
373     end
374   end
375
376   # All custom log level tests
377   describe 'custom log level tests' do
378     # Non-OS-type tests assume CentOS 7
379     #   See issue #43 for reasoning:
380     #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
381     osfamily = 'RedHat'
382     operatingsystem = 'CentOS'
383     operatingsystemmajrelease = '7'
384     context 'using default log levels' do
385       let(:facts) {{
386         :osfamily => osfamily,
387         :operatingsystem => operatingsystem,
388         :operatingsystemmajrelease => operatingsystemmajrelease,
389       }}
390
391       let(:params) {{ }}
392
393       # Run shared tests applicable to all supported OSs
394       # Note that this function is defined in spec_helper
395       generic_tests
396
397       # Run test that specialize in checking custom log level config
398       # Note that this function is defined in spec_helper
399       log_level_tests
400     end
401
402     context 'adding one custom log level' do
403       let(:facts) {{
404         :osfamily => osfamily,
405         :operatingsystem => operatingsystem,
406         :operatingsystemmajrelease => operatingsystemmajrelease,
407       }}
408
409       custom_log_levels = { 'org.opendaylight.ovsdb' => 'TRACE' }
410
411       let(:params) {{
412         :log_levels => custom_log_levels,
413       }}
414
415       # Run shared tests applicable to all supported OSs
416       # Note that this function is defined in spec_helper
417       generic_tests
418
419       # Run test that specialize in checking log level config
420       # Note that this function is defined in spec_helper
421       log_level_tests(log_levels: custom_log_levels)
422     end
423
424     context 'adding two custom log levels' do
425       let(:facts) {{
426         :osfamily => osfamily,
427         :operatingsystem => operatingsystem,
428         :operatingsystemmajrelease => operatingsystemmajrelease,
429       }}
430
431       custom_log_levels = { 'org.opendaylight.ovsdb' => 'TRACE',
432                          'org.opendaylight.ovsdb.lib' => 'INFO' }
433
434       let(:params) {{
435         :log_levels => custom_log_levels,
436       }}
437
438       # Run shared tests applicable to all supported OSs
439       # Note that this function is defined in spec_helper
440       generic_tests
441
442       # Run test that specialize in checking log level config
443       # Note that this function is defined in spec_helper
444       log_level_tests(log_levels: custom_log_levels)
445     end
446   end
447
448   describe 'log mechanism settings' do
449     # Non-OS-type tests assume CentOS 7
450     #   See issue #43 for reasoning:
451     #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
452     osfamily = 'RedHat'
453     operatingsystem = 'CentOS'
454     operatingsystemmajrelease = '7'
455
456     # All custom log file size and rollover tests
457     context 'log to file using default size and rollover' do
458       let(:facts) {{
459         :osfamily => osfamily,
460         :operatingsystem => operatingsystem,
461         :operatingsystemmajrelease => operatingsystemmajrelease,
462       }}
463
464       let(:params) {{ }}
465
466       # Run shared tests applicable to all supported OSs
467       # Note that this function is defined in spec_helper
468       generic_tests
469
470       # Run test specific to log settings
471       log_settings
472     end
473
474     context 'log to file customizing size' do
475       let(:facts) {{
476         :osfamily => osfamily,
477         :operatingsystem => operatingsystem,
478         :operatingsystemmajrelease => operatingsystemmajrelease,
479       }}
480
481       let(:params) {{
482         :log_max_size => '1GB',
483       }}
484
485       # Run shared tests applicable to all supported OSs
486       # Note that this function is defined in spec_helper
487       generic_tests
488
489       # Run test specific to log settings
490       log_settings(log_max_size: '1GB')
491     end
492
493     context 'log to file customizing rollover' do
494       let(:facts) {{
495         :osfamily => osfamily,
496         :operatingsystem => operatingsystem,
497         :operatingsystemmajrelease => operatingsystemmajrelease,
498       }}
499
500       let(:params) {{
501         :log_max_rollover => 3,
502       }}
503
504       # Run shared tests applicable to all supported OSs
505       # Note that this function is defined in spec_helper
506       generic_tests
507
508       # Run test specific to log settings
509       log_settings(log_max_rollover: 3)
510     end
511
512     context 'log to file customizing size and rollover' do
513       let(:facts) {{
514         :osfamily => osfamily,
515         :operatingsystem => operatingsystem,
516         :operatingsystemmajrelease => operatingsystemmajrelease,
517       }}
518
519       let(:params) {{
520         :log_max_size => '1GB',
521         :log_max_rollover => 3,
522         :log_rollover_fileindex => 'min'
523       }}
524
525       # Run shared tests applicable to all supported OSs
526       # Note that this function is defined in spec_helper
527       generic_tests
528
529       # Run test specific to log settings
530       log_settings(log_max_size: '1GB',
531                    log_max_rollover: 3,
532                    log_rollover_fileindex: 'min')
533     end
534
535     context 'log to console' do
536       let(:facts) {{
537         :osfamily => osfamily,
538         :operatingsystem => operatingsystem,
539         :operatingsystemmajrelease => operatingsystemmajrelease,
540       }}
541
542       let(:params) {{
543         :log_mechanism => 'console',
544       }}
545
546       # Run shared tests applicable to all supported OSs
547       # Note that this function is defined in spec_helper
548       generic_tests
549
550       # Run test specific to log settings
551       log_settings(log_mechanism: 'console')
552     end
553   end
554
555   # All OVSDB HA enable/disable tests
556   describe 'OVSDB HA enable/disable tests' do
557     # Non-OS-type tests assume CentOS 7
558     #   See issue #43 for reasoning:
559     #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
560     osfamily = 'RedHat'
561     operatingsystem = 'CentOS'
562     operatingsystemmajrelease = '7'
563     context 'using enable_ha default' do
564       let(:facts) {{
565         :osfamily => osfamily,
566         :operatingsystem => operatingsystem,
567         :operatingsystemmajrelease => operatingsystemmajrelease,
568       }}
569
570       let(:params) {{ }}
571
572       # Run shared tests applicable to all supported OSs
573       # Note that this function is defined in spec_helper
574       generic_tests
575
576       # Run test that specialize in checking ODL OVSDB HA config
577       # Note that this function is defined in spec_helper
578       enable_ha_tests
579     end
580
581     context 'using false for enable_ha' do
582       let(:facts) {{
583         :osfamily => osfamily,
584         :operatingsystem => operatingsystem,
585         :operatingsystemmajrelease => operatingsystemmajrelease,
586       }}
587
588       let(:params) {{
589         :enable_ha => false,
590       }}
591
592       # Run shared tests applicable to all supported OSs
593       # Note that this function is defined in spec_helper
594       generic_tests
595
596       # Run test that specialize in checking ODL OVSDB HA config
597       # Note that this function is defined in spec_helper
598       enable_ha_tests(enable_ha: false)
599     end
600
601     context 'using true for enable_ha' do
602       context 'using ha_node_count >=2' do
603         let(:facts) {{
604           :osfamily => osfamily,
605           :operatingsystem => operatingsystem,
606           :operatingsystemmajrelease => operatingsystemmajrelease,
607         }}
608
609         let(:params) {{
610           :enable_ha => true,
611           :ha_node_ips => ['0.0.0.0', '127.0.0.1']
612         }}
613
614         # Run shared tests applicable to all supported OSs
615         # Note that this function is defined in spec_helper
616         generic_tests
617
618         # Run test that specialize in checking ODL OVSDB HA config
619         # Note that this function is defined in spec_helper
620         enable_ha_tests(enable_ha: true, ha_node_ips: ['0.0.0.0', '127.0.0.1'])
621       end
622
623       context 'using custom modules for sharding' do
624         let(:facts) {{
625           :osfamily => osfamily,
626           :operatingsystem => operatingsystem,
627           :operatingsystemmajrelease => operatingsystemmajrelease,
628         }}
629
630         let(:params) {{
631           :enable_ha => true,
632           :ha_node_ips => ['0.0.0.0', '127.0.0.1'],
633           :ha_db_modules => {'default' => false, 'topology' => 'urn:opendaylight:topology'}
634         }}
635
636         # Run shared tests applicable to all supported OSs
637         # Note that this function is defined in spec_helper
638         generic_tests
639
640         # Run test that specialize in checking ODL OVSDB HA config
641         # Note that this function is defined in spec_helper
642         enable_ha_tests(enable_ha: true, ha_node_ips: ['0.0.0.0', '127.0.0.1'])
643       end
644     end
645   end
646
647
648   # All install method tests
649   describe 'install method tests' do
650
651     # All tests for RPM install method
652     describe 'RPM' do
653       # Non-OS-type tests assume CentOS 7
654       #   See issue #43 for reasoning:
655       #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
656       osfamily = 'RedHat'
657       operatingsystem = 'CentOS'
658       operatingsystemrelease = '7.0'
659       operatingsystemmajrelease = '7'
660
661       context 'installing from default repo' do
662         let(:facts) {{
663           :osfamily => osfamily,
664           :operatingsystem => operatingsystem,
665           :operatingsystemmajrelease => operatingsystemmajrelease,
666         }}
667
668         # Run shared tests applicable to all supported OSs
669         # Note that this function is defined in spec_helper
670         generic_tests
671
672         # Run test that specialize in checking RPM-based installs
673         # Note that this function is defined in spec_helper
674         rpm_install_tests
675       end
676
677       context 'installing from Nexus repo' do
678         rpm_repo = 'https://nexus.opendaylight.org/content/repositories/opendaylight-fluorine-epel-7-$basearch-devel'
679         let(:facts) {{
680           :osfamily => osfamily,
681           :operatingsystem => operatingsystem,
682           :operatingsystemmajrelease => operatingsystemmajrelease,
683         }}
684
685         let(:params) {{
686           :rpm_repo => rpm_repo,
687         }}
688
689         # Run shared tests applicable to all supported OSs
690         # Note that this function is defined in spec_helper
691         generic_tests
692
693         # Run test that specialize in checking RPM-based installs
694         # Note that this function is defined in spec_helper
695         rpm_install_tests(rpm_repo: rpm_repo)
696       end
697     end
698
699     # All tests for Deb install method
700     describe 'Deb' do
701       osfamily = 'Debian'
702       operatingsystem = 'Ubuntu'
703       operatingsystemrelease = '16.04'
704       operatingsystemmajrelease = '16'
705       lsbdistcodename = 'xenial'
706
707       context 'installing Deb' do
708         let(:facts) {{
709           :osfamily => osfamily,
710           :operatingsystem => operatingsystem,
711           :operatingsystemrelease => operatingsystemrelease,
712           :operatingsystemmajrelease => operatingsystemmajrelease,
713           :lsbdistid => operatingsystem,
714           :lsbdistrelease => operatingsystemrelease,
715           :lsbmajdistrelease => operatingsystemmajrelease,
716           :lsbdistcodename => lsbdistcodename,
717           :puppetversion => Puppet.version,
718         }}
719
720         # Run shared tests applicable to all supported OSs
721         # Note that this function is defined in spec_helper
722         generic_tests
723
724         # Run test that specialize in checking RPM-based installs
725         # Note that this function is defined in spec_helper
726         deb_install_tests
727       end
728
729       context 'installing Nitrogen Deb' do
730         deb_repo = 'ppa:odl-team/nitrogen'
731         let(:facts) {{
732           :osfamily => osfamily,
733           :operatingsystem => operatingsystem,
734           :operatingsystemrelease => operatingsystemrelease,
735           :operatingsystemmajrelease => operatingsystemmajrelease,
736           :lsbdistid => operatingsystem,
737           :lsbdistrelease => operatingsystemrelease,
738           :lsbmajdistrelease => operatingsystemmajrelease,
739           :lsbdistcodename => lsbdistcodename,
740           :puppetversion => Puppet.version,
741         }}
742
743         let(:params) {{
744           :deb_repo => deb_repo,
745         }}
746
747         # Run shared tests applicable to all supported OSs
748         # Note that this function is defined in spec_helper
749         generic_tests
750
751         # Run test that specialize in checking RPM-based installs
752         # Note that this function is defined in spec_helper
753         deb_install_tests(deb_repo: deb_repo)
754       end
755     end
756   end
757
758   # SNAT Mechanism tests
759   describe 'SNAT mechanism tests' do
760     # Non-OS-type tests assume CentOS 7
761     #   See issue #43 for reasoning:
762     #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
763     osfamily = 'RedHat'
764     operatingsystem = 'CentOS'
765     operatingsystemmajrelease = '7'
766     context 'using controller' do
767       let(:facts) {{
768         :osfamily => osfamily,
769         :operatingsystem => operatingsystem,
770         :operatingsystemmajrelease => operatingsystemmajrelease,
771       }}
772
773       let(:params) {{
774         :extra_features => ['odl-netvirt-openstack'],
775       }}
776
777       # Run shared tests applicable to all supported OSs
778       # Note that this function is defined in spec_helper
779       generic_tests
780
781       # Run test that specialize in checking security groups
782       # Note that this function is defined in spec_helper
783       snat_mechanism_tests
784     end
785
786     context 'using conntrack' do
787       let(:facts) {{
788         :osfamily => osfamily,
789         :operatingsystem => operatingsystem,
790         :operatingsystemmajrelease => operatingsystemmajrelease,
791       }}
792
793       let(:params) {{
794         :snat_mechanism => 'conntrack',
795         :extra_features => ['odl-netvirt-openstack'],
796       }}
797
798       # Run shared tests applicable to all supported OSs
799       # Note that this function is defined in spec_helper
800       generic_tests
801
802       # Run test that specialize in checking security groups
803       # Note that this function is defined in spec_helper
804       snat_mechanism_tests('conntrack')
805     end
806   end
807
808   # SFC tests
809   describe 'SFC tests' do
810     # Non-OS-type tests assume CentOS 7
811     #   See issue #43 for reasoning:
812     #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
813     osfamily = 'RedHat'
814     operatingsystem = 'CentOS'
815     operatingsystemmajrelease = '7'
816     context 'not using odl-netvirt-sfc feature' do
817       let(:facts) {{
818         :osfamily => osfamily,
819         :operatingsystem => operatingsystem,
820         :operatingsystemmajrelease => operatingsystemmajrelease,
821       }}
822
823       let(:params) {{ }}
824
825       # Run shared tests applicable to all supported OSs
826       # Note that this function is defined in spec_helper
827       generic_tests
828
829       # Run test that specialize in checking security groups
830       # Note that this function is defined in spec_helper
831       sfc_tests
832     end
833
834     context 'using odl-netvirt-sfc feature' do
835       let(:facts) {{
836         :osfamily => osfamily,
837         :operatingsystem => operatingsystem,
838         :operatingsystemmajrelease => operatingsystemmajrelease,
839       }}
840
841       let(:params) {{
842         :extra_features => ['odl-netvirt-sfc'],
843       }}
844
845       # Run shared tests applicable to all supported OSs
846       # Note that this function is defined in spec_helper
847       generic_tests
848
849       # Run test that specialize in checking security groups
850       # Note that this function is defined in spec_helper
851       sfc_tests(extra_features: ['odl-netvirt-sfc'])
852     end
853   end
854
855   # DSCP marking tests
856   describe 'DSCP marking tests' do
857     # Non-OS-type tests assume CentOS 7
858     #   See issue #43 for reasoning:
859     #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
860     osfamily = 'RedHat'
861     operatingsystem = 'CentOS'
862     operatingsystemmajrelease = '7'
863     context 'use default value' do
864       let(:facts) {{
865         :osfamily => osfamily,
866         :operatingsystem => operatingsystem,
867         :operatingsystemmajrelease => operatingsystemmajrelease,
868       }}
869
870       let(:params) {{ }}
871
872       # Run shared tests applicable to all supported OSs
873       # Note that this function is defined in spec_helper
874       generic_tests
875
876       # Run test that specialize in checking security groups
877       # Note that this function is defined in spec_helper
878       dscp_tests
879     end
880
881     context 'inherit DSCP values' do
882       let(:facts) {{
883         :osfamily => osfamily,
884         :operatingsystem => operatingsystem,
885         :operatingsystemmajrelease => operatingsystemmajrelease,
886       }}
887
888       let(:params) {{
889         :inherit_dscp_marking => :true,
890       }}
891
892       # Run shared tests applicable to all supported OSs
893       # Note that this function is defined in spec_helper
894       generic_tests
895
896       # Run test that specialize in checking security groups
897       # Note that this function is defined in spec_helper
898       dscp_tests(inherit_dscp_marking: true)
899     end
900   end
901
902   # VPP routing node config tests
903   describe 'VPP routing node tests' do
904     # Non-OS-type tests assume CentOS 7
905     #   See issue #43 for reasoning:
906     #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
907     osfamily = 'RedHat'
908     operatingsystem = 'CentOS'
909     operatingsystemmajrelease = '7'
910     context 'using default - no routing node' do
911       let(:facts) {{
912         :osfamily => osfamily,
913         :operatingsystem => operatingsystem,
914         :operatingsystemmajrelease => operatingsystemmajrelease,
915       }}
916
917       let(:params) {{ }}
918
919       # Run shared tests applicable to all supported OSs
920       # Note that this function is defined in spec_helper
921       generic_tests
922
923       # Run test that specialize in checking routing-node config
924       # Note that this function is defined in spec_helper
925       vpp_routing_node_tests
926     end
927
928     context 'using node name for routing node' do
929       let(:facts) {{
930         :osfamily => osfamily,
931         :operatingsystem => operatingsystem,
932         :operatingsystemmajrelease => operatingsystemmajrelease,
933       }}
934
935       let(:params) {{
936         :vpp_routing_node => 'test-node-1',
937       }}
938
939       # Run shared tests applicable to all supported OSs
940       # Note that this function is defined in spec_helper
941       generic_tests
942
943       # Run test that specialize in checking routing-node config
944       # Note that this function is defined in spec_helper
945       vpp_routing_node_tests(routing_node: 'test-node-1')
946     end
947   end
948
949   # ODL username/password tests
950   describe 'ODL username/password tests' do
951     # Non-OS-type tests assume CentOS 7
952     #   See issue #43 for reasoning:
953     #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
954     osfamily = 'RedHat'
955     operatingsystem = 'CentOS'
956     operatingsystemmajrelease = '7'
957     context 'using default username/password' do
958       let(:facts) {{
959         :osfamily => osfamily,
960         :operatingsystem => operatingsystem,
961         :operatingsystemmajrelease => operatingsystemmajrelease,
962       }}
963
964       let(:params) {{ }}
965
966       # Run shared tests applicable to all supported OSs
967       # Note that this function is defined in spec_helper
968       generic_tests
969
970       # Run test that specialize in checking username/password config
971       # Note that this function is defined in spec_helper
972       username_password_tests('admin','admin')
973     end
974
975     context 'specifying non-default username/password' do
976       let(:facts) {{
977         :osfamily => osfamily,
978         :operatingsystem => operatingsystem,
979         :operatingsystemmajrelease => operatingsystemmajrelease,
980       }}
981
982       let(:params) {{
983         :username => 'test',
984         :password => 'test'
985       }}
986
987       # Run shared tests applicable to all supported OSs
988       # Note that this function is defined in spec_helper
989       generic_tests
990
991       # Run test that specialize in checking routing-node config
992       # Note that this function is defined in spec_helper
993       username_password_tests('test', 'test')
994     end
995   end
996
997   # websocket address tests
998   describe 'ODL websocket address tests' do
999     # Non-OS-type tests assume CentOS 7
1000     #   See issue #43 for reasoning:
1001     #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
1002     osfamily = 'RedHat'
1003     operatingsystem = 'CentOS'
1004     operatingsystemmajrelease = '7'
1005     context 'using default websocket address' do
1006       let(:facts) {{
1007         :osfamily => osfamily,
1008         :operatingsystem => operatingsystem,
1009         :operatingsystemmajrelease => operatingsystemmajrelease,
1010       }}
1011
1012       let(:params) {{ }}
1013
1014       # Run shared tests applicable to all supported OSs
1015       # Note that this function is defined in spec_helper
1016       generic_tests
1017
1018       # Run test that specialize in checking websocket address
1019       # Note that this function is defined in spec_helper
1020       odl_websocket_address_tests
1021     end
1022
1023     context 'overriding websocket address' do
1024       let(:facts) {{
1025         :osfamily => osfamily,
1026         :operatingsystem => operatingsystem,
1027         :operatingsystemmajrelease => operatingsystemmajrelease,
1028       }}
1029
1030       let(:params) {{
1031        :odl_bind_ip => '127.0.0.1'
1032        }}
1033
1034       # Run shared tests applicable to all supported OSs
1035       # Note that this function is defined in spec_helper
1036       generic_tests(odl_bind_ip: '127.0.0.1')
1037
1038       # Run test that specialize in checking websocket address
1039       # Note that this function is defined in spec_helper
1040       odl_websocket_address_tests(odl_bind_ip: '127.0.0.1')
1041     end
1042   end
1043
1044   # TLS tests
1045   describe 'ODL TLS tests' do
1046     # Non-OS-type tests assume CentOS 7
1047     #   See issue #43 for reasoning:
1048     #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
1049     osfamily = 'RedHat'
1050     operatingsystem = 'CentOS'
1051     operatingsystemmajrelease = '7'
1052     context 'enabling TLS without required keystore password (negative test)' do
1053       let(:facts) {{
1054         :osfamily => osfamily,
1055         :operatingsystem => operatingsystem,
1056         :operatingsystemmajrelease => operatingsystemmajrelease,
1057       }}
1058
1059       let(:params) {{
1060        :enable_tls => :true
1061        }}
1062
1063       # Run test that specialize in checking TLS
1064       # Note that this function is defined in spec_helper
1065       odl_tls_tests(enable_tls:true)
1066     end
1067     context 'enabling TLS with required params' do
1068       let(:facts) {{
1069         :osfamily => osfamily,
1070         :operatingsystem => operatingsystem,
1071         :operatingsystemmajrelease => operatingsystemmajrelease,
1072       }}
1073
1074       let(:params) {{
1075        :enable_tls => true,
1076        :tls_keystore_password => '123456',
1077        }}
1078
1079       # Run shared tests applicable to all supported OSs
1080       # Note that this function is defined in spec_helper
1081       generic_tests
1082
1083       # Run test that specialize in checking TLS
1084       # Note that this function is defined in spec_helper
1085       odl_tls_tests(enable_tls:true, tls_keystore_password:'123456')
1086     end
1087   end
1088
1089   describe 'polling enablement settings' do
1090     # Non-OS-type tests assume CentOS 7
1091     #   See issue #43 for reasoning:
1092     #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
1093     osfamily = 'RedHat'
1094     operatingsystem = 'CentOS'
1095     operatingsystemmajrelease = '7'
1096
1097     # Default statistics polling off
1098     context 'do not poll ovs statistics' do
1099       let(:facts) {{
1100         :osfamily => osfamily,
1101         :operatingsystem => operatingsystem,
1102         :operatingsystemmajrelease => operatingsystemmajrelease,
1103       }}
1104
1105       let(:params) {{ }}
1106
1107       # Run shared tests applicable to all supported OSs
1108       # Note that this function is defined in spec_helper
1109       generic_tests
1110
1111       # Run test specific to log settings
1112       stats_polling_enablement_tests
1113     end
1114
1115     # Default statistics polling on
1116     context 'poll ovs statistics' do
1117       let(:facts) {{
1118         :osfamily => osfamily,
1119         :operatingsystem => operatingsystem,
1120         :operatingsystemmajrelease => operatingsystemmajrelease,
1121       }}
1122
1123       let(:params) {{
1124        :stats_polling_enabled => true,
1125        }}
1126
1127       # Run shared tests applicable to all supported OSs
1128       # Note that this function is defined in spec_helper
1129       generic_tests
1130
1131       # Run test specific to log settings
1132       stats_polling_enablement_tests(stats_polling_enabled:true)
1133     end
1134   end
1135
1136   describe 'Different IPv support tests' do
1137     # Non-OS-type tests assume CentOS 7
1138     #   See issue #43 for reasoning:
1139     #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
1140     osfamily = 'RedHat'
1141     operatingsystem = 'CentOS'
1142     operatingsystemmajrelease = '7'
1143
1144     context 'IPv6 deployment' do
1145       let(:facts) {{
1146         :osfamily => osfamily,
1147         :operatingsystem => operatingsystem,
1148         :operatingsystemmajrelease => operatingsystemmajrelease,
1149       }}
1150
1151       let(:params) {{
1152         :odl_bind_ip => '::1'
1153         }}
1154
1155       # Run shared tests applicable to all supported OSs
1156       # Note that this function is defined in spec_helper
1157       generic_tests(odl_bind_ip:'::1')
1158     end
1159
1160     context 'IPv4 deployment' do
1161       let(:facts) {{
1162         :osfamily => osfamily,
1163         :operatingsystem => operatingsystem,
1164         :operatingsystemmajrelease => operatingsystemmajrelease,
1165       }}
1166
1167       let(:params) {{
1168         :odl_bind_ip => '127.0.0.1'
1169         }}
1170
1171       # Run shared tests applicable to all supported OSs
1172       # Note that this function is defined in spec_helper
1173       generic_tests(odl_bind_ip:'127.0.0.1')
1174     end
1175   end
1176 end