# Requires at least CentOS 7.3 for RHEL/CentOS systems
if ('odl-netvirt-openstack' in $opendaylight::features) {
if $opendaylight::security_group_mode == 'stateful' {
- if defined('$opendaylight::stateful_unsupported') {
- if $opendaylight::stateful_unsupported {
+ if defined('$opendaylight::stateful_unsupported') and $opendaylight::stateful_unsupported {
warning("Stateful is unsupported in ${::operatingsystemrelease} setting to 'learn'")
$sg_mode = 'learn'
- } else {
- $sg_mode = 'learn'
- }
} else {
$sg_mode = 'stateful'
}
if $::operatingsystemmajrelease != '7' {
# RHEL/CentOS versions < 7 not supported as they lack systemd
fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
- } elsif defined('::operatingsystemrelease') {
+ } elsif defined('$::operatingsystemrelease') {
if (versioncmp($::operatingsystemrelease, '7.3') < 0) {
# Versions < 7.3 do not support stateful security groups
$stateful_unsupported = true
# Run test that specialize in checking security groups
# Note that this function is defined in spec_helper
- enable_sg_tests(security_group_mode: 'stateful', osrelease: '7.3')
+ enable_sg_tests('stateful', '7.3')
end
context 'using unsupported stateful' do
# Run test that specialize in checking security groups
# Note that this function is defined in spec_helper
- enable_sg_tests(security_group_mode: 'stateful', osrelease: '7.3')
+ enable_sg_tests('stateful', '7.2.1511')
end
context 'using transparent with unsupported stateful' do
# Run test that specialize in checking security groups
# Note that this function is defined in spec_helper
- enable_sg_tests(security_group_mode: 'transparent', osrelease: '7.2.1511')
+ enable_sg_tests('transparent', '7.2.1511')
end
end
end
it { expect { should contain_file('org.apache.karaf.features.cfg') }.to raise_error(Puppet::Error, /#{expected_msg}/) }
end
-# Shared tests that specialize in testing enabling L3 via ODL OVSDB
-def enable_sg_tests(options = {})
+# Shared tests that specialize in testing security group mode
+def enable_sg_tests(sg_mode='stateful', os_release)
# Extract params
# NB: This default value should be the same as one in opendaylight::params
# TODO: Remove this possible source of bugs^^
- sg_mode = options.fetch(:security_group_mode, 'stateful')
- os_release = options.fetch(:osrelease)
- if !os_release.include? '7.3' and ['stateful'].include? sg_mode
+ if os_release != '7.3' and sg_mode == 'stateful'
# Confirm sg_mode becomes learn
it {
should contain_file('netvirt-aclservice-config.xml').with(