```puppet
class { 'opendaylight':
- enable_l3 => 'yes',
+ enable_l3 => true,
}
```
Default: `'no'`
-Valid options: The strings 'yes' or 'no'.
-
-Boolean values are not currently supported, but that feature may be added.
+Valid options: The strings `'yes'` or `'no'` or boolean values `true` and `false`.
The ODL OVSDB L3 config in `/opt/opendaylight/etc/custom.properties` is set to
the value of the `enable_l3` param.
```puppet
class { 'opendaylight':
- enable_l3 => 'yes',
+ enable_l3 => true,
}
```
# [*unitfile_url*]
# OpenDaylight .service file to use for tarball installs. Defaults to one used by ODL RPM.
# [*enable_l3*]
-# Enable or disable ODL OVSDB ML2 L3 forwarding. Valid options are 'yes' and 'no'.
+# Enable or disable ODL OVSDB ML2 L3 forwarding. Valid: true, false, 'yes' and 'no'.
# [*log_levels*]
# Custom OpenDaylight logger verbosity configuration (TRACE, DEBUG, INFO, WARN, ERROR).
#
# Call specialized helper fn for ODL OVSDB L3 config validations
enable_l3_validations(enable_l3: 'yes')
end
+
+ context 'using false for enable_l3' do
+ # Call specialized helper fn to install OpenDaylight
+ install_odl(enable_l3: false)
+
+ # Call specialized helper fn for ODL OVSDB L3 config validations
+ enable_l3_validations(enable_l3: false)
+ end
+
+ context 'using true for enable_l3' do
+ # Call specialized helper fn to install OpenDaylight
+ install_odl(enable_l3: true)
+
+ # Call specialized helper fn for ODL OVSDB L3 config validations
+ enable_l3_validations(enable_l3: true)
+ end
end
end
# Note that this function is defined in spec_helper
enable_l3_tests(enable_l3: 'yes')
end
+
+ context 'using false for enable_l3' do
+ let(:facts) {{
+ :osfamily => osfamily,
+ :operatingsystem => operatingsystem,
+ :operatingsystemmajrelease => operatingsystemmajrelease,
+ }}
+
+ let(:params) {{
+ :enable_l3 => false ,
+ }}
+
+ # Run shared tests applicable to all supported OSs
+ # Note that this function is defined in spec_helper
+ generic_tests
+
+ # Run test that specialize in checking ODL OVSDB L3 config
+ # Note that this function is defined in spec_helper
+ enable_l3_tests(enable_l3: false)
+ end
+
+ context 'using true for enable_l3' do
+ let(:facts) {{
+ :osfamily => osfamily,
+ :operatingsystem => operatingsystem,
+ :operatingsystemmajrelease => operatingsystemmajrelease,
+ }}
+
+ let(:params) {{
+ :enable_l3 => true,
+ }}
+
+ # Run shared tests applicable to all supported OSs
+ # Note that this function is defined in spec_helper
+ generic_tests
+
+ # Run test that specialize in checking ODL OVSDB L3 config
+ # Note that this function is defined in spec_helper
+ enable_l3_tests(enable_l3: true)
+ end
end
# All install method tests
# TODO: Remove this possible source of bugs^^
enable_l3 = options.fetch(:enable_l3, 'no')
- # Confirm ODL OVSDB L3 config
- it {
- should contain_file('custom.properties').with(
- 'ensure' => 'file',
- 'path' => '/opt/opendaylight/etc/custom.properties',
- 'owner' => 'odl',
- 'group' => 'odl',
- 'content' => /ovsdb.l3.fwd.enabled=#{enable_l3}/
- )
- }
+ if [true, 'yes'].include? enable_l3
+ # Confirm ODL OVSDB L3 is enabled
+ it {
+ should contain_file('custom.properties').with(
+ 'ensure' => 'file',
+ 'path' => '/opt/opendaylight/etc/custom.properties',
+ 'owner' => 'odl',
+ 'group' => 'odl',
+ 'content' => /^ovsdb.l3.fwd.enabled=yes/
+ )
+ }
+ elsif [false, 'no'].include? enable_l3
+ # Confirm ODL OVSDB L3 is disabled
+ it {
+ should contain_file('custom.properties').with(
+ 'ensure' => 'file',
+ 'path' => '/opt/opendaylight/etc/custom.properties',
+ 'owner' => 'odl',
+ 'group' => 'odl',
+ 'content' => /^ovsdb.l3.fwd.enabled=no/
+ )
+ }
+ end
end
def tarball_install_tests(options = {})
# TODO: Remove this possible source of bugs^^
enable_l3 = options.fetch(:enable_l3, 'no')
- describe file('/opt/opendaylight/etc/custom.properties') do
- it { should be_file }
- it { should be_owned_by 'odl' }
- it { should be_grouped_into 'odl' }
- its(:content) { should match /ovsdb.l3.fwd.enabled=#{enable_l3}/ }
+ if [true, 'yes'].include? enable_l3
+ # Confirm ODL OVSDB L3 is enabled
+ describe file('/opt/opendaylight/etc/custom.properties') do
+ it { should be_file }
+ it { should be_owned_by 'odl' }
+ it { should be_grouped_into 'odl' }
+ its(:content) { should match /^ovsdb.l3.fwd.enabled=yes/ }
+ end
+ elsif [false, 'no'].include? enable_l3
+ # Confirm ODL OVSDB L3 is disabled
+ describe file('/opt/opendaylight/etc/custom.properties') do
+ it { should be_file }
+ it { should be_owned_by 'odl' }
+ it { should be_grouped_into 'odl' }
+ its(:content) { should match /^ovsdb.l3.fwd.enabled=no/ }
+ end
end
end
# ovsdb can be configured with ml2 to perform l3 forwarding. The config below enables that functionality, which is
# disabled by default.
-ovsdb.l3.fwd.enabled=<%= scope.lookupvar('opendaylight::enable_l3') %>
+<% if [true, 'yes'].include? scope.lookupvar('opendaylight::enable_l3') -%>
+ovsdb.l3.fwd.enabled=yes
+<% elsif [false, 'no'].include? scope.lookupvar('opendaylight::enable_l3') -%>
+ovsdb.l3.fwd.enabled=no
+<% else -%>
+ <%- fail("Unexpected enable_l3 value: #{scope.lookupvar('opendaylight::enable_l3')}") -%>
+<% end -%>
# ovsdb can be configured with ml2 to perform l3 forwarding. When used in that scenario, the mac address of the default
# gateway --on the external subnet-- is expected to be resolved from its inet address. The config below overrides that