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 'log file size and rollover' do
78 context 'using default size and rollover' do
79 # Call specialized helper fn to install OpenDaylight
82 # Call specialized helper fn for log file settings validations
83 log_file_settings_validations
86 context '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 file settings validations
91 log_file_settings_validations(log_max_size: '1GB')
94 context '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 file settings validations
99 log_file_settings_validations(log_max_rollover: 3)
102 context 'customising size and rollover' do
103 # Call specialized helper fn to install OpenDaylight
104 install_odl(log_max_size: '1GB',
107 # Call specialized helper fn for log file settings validations
108 log_file_settings_validations(log_max_size: '1GB',
113 describe 'testing REST port config file' do
114 context 'using default port' do
115 # Call specialized helper fn to install OpenDaylight
118 # Call specialized helper fn for REST port config validations
119 port_config_validations
122 context 'overriding default port' do
123 # Call specialized helper fn to install OpenDaylight
124 install_odl(odl_rest_port: 7777)
126 # Call specialized helper fn for REST port config validations
127 port_config_validations(odl_rest_port: 7777)
131 describe 'testing custom logging verbosity' do
132 context 'using default log levels' do
133 # Call specialized helper fn to install OpenDaylight
136 # Call specialized helper fn for custom logger verbosity validations
137 log_level_validations
140 context 'adding one custom log level' do
141 custom_log_levels = { 'org.opendaylight.ovsdb' => 'TRACE' }
143 # Call specialized helper fn to install OpenDaylight
144 install_odl(log_levels: custom_log_levels)
146 # Call specialized helper fn for custom logger verbosity validations
147 log_level_validations(log_levels: custom_log_levels)
150 context 'adding two custom log level' do
151 custom_log_levels = { 'org.opendaylight.ovsdb' => 'TRACE',
152 'org.opendaylight.ovsdb.lib' => 'INFO' }
154 # Call specialized helper fn to install OpenDaylight
155 install_odl(log_levels: custom_log_levels)
157 # Call specialized helper fn for custom logger verbosity validations
158 log_level_validations(log_levels: custom_log_levels)
162 describe 'testing odl username/password' do
163 bind_ip = '127.0.0.1'
164 context 'using default username/password' do
165 context 'using non-default bind ip' do
166 # Call specialized helper fn to install OpenDaylight
167 install_odl({:odl_bind_ip => bind_ip, :extra_features => ['odl-restconf']})
169 # Call specialized helper fn for username/password validations
170 username_password_validations
175 describe 'testing odl HA configuration' do
176 bind_ip = '127.0.0.1'
177 odl_ips = ['127.0.0.1', '127.0.0.2', '127.0.0.3']
178 context 'using default modules' do
179 install_odl(odl_bind_ip: bind_ip, enable_ha: true, ha_node_ips: odl_ips)
181 enable_ha_validations(odl_bind_ip: bind_ip, enable_ha: true,
182 ha_node_ips: odl_ips)
185 context 'specifying datastore modules' do
188 'topology' => 'urn:opendaylight:topology'
190 install_odl(odl_bind_ip: bind_ip, enable_ha: true, ha_node_ips: odl_ips,
191 ha_db_modules: db_modules)
192 enable_ha_validations(odl_bind_ip: bind_ip, enable_ha: true,
193 ha_node_ips: odl_ips, ha_db_modules: db_modules)
197 describe 'testing configuring SNAT' do
198 context 'using default SNAT mechanism' do
199 # Call specialized helper fn to install OpenDaylight
200 install_odl(extra_features: ['odl-netvirt-openstack'])
202 # Call specialized helper fn for SNAT config validations
203 snat_mechanism_validations
206 context 'using conntrack SNAT' do
207 # Call specialized helper fn to install OpenDaylight
208 install_odl(extra_features: ['odl-netvirt-openstack'], snat_mechanism: 'conntrack')
210 # Call specialized helper fn for SNAT mechanism validations
211 snat_mechanism_validations(snat_mechanism: 'conntrack')
215 describe 'testing configuring SFC' do
216 context 'using SFC feature' do
217 # Call specialized helper fn to install OpenDaylight
218 install_odl(extra_features: ['odl-netvirt-sfc'])
220 # Call specialized helper fn for SFC config validations