- Move to ODL-managed repo
2017-07-20 Release 4.1.0
- Add log size/rotate config params
+2017-08-14 Release 4.2.0
+- Add param to config SNAT mechanism
Valid options: `transparent`, `learn`, `stateless`
+##### `snat_mechanism`
+
+Specifies the mechanism to be used for SNAT.
+
+Default: `controller`
+
+Valid options: `conntrack`, `controller`
+
##### `vpp_routing_node`
Specifies the routing node for VPP deployment. A non-empty string will create config file
}
}
+ # Configure SNAT
+ if ('odl-netvirt-openstack' in $opendaylight::features) {
+ file { 'netvirt-natservice-config.xml':
+ ensure => file,
+ path => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-natservice-config.xml',
+ owner => 'odl',
+ group => 'odl',
+ content => template('opendaylight/netvirt-natservice-config.xml.erb'),
+ require => File['/opt/opendaylight/etc/opendaylight/datastore/initial/config'],
+ }
+ }
+
#configure VPP routing node
if ! empty($::opendaylight::vpp_routing_node) {
file { 'org.opendaylight.groupbasedpolicy.neutron.vpp.mapper.startup.cfg':
# Maxium size of OpenDaylight's log file.
# [*log_max_rollover*]
# Maxium number of OpenDaylight log rollovers to keep.
+# [*snat_mechanism*]
+# Sets the mechanism to be used for SNAT (conntrack, controller)
#
# === Deprecated Parameters
#
$username = $::opendaylight::params::username,
$password = $::opendaylight::params::password,
$log_max_size = $::opendaylight::params::log_max_size,
- $log_max_rollover = $::opendaylight::params::log_max_rollover
+ $log_max_rollover = $::opendaylight::params::log_max_rollover,
+ $snat_mechanism = $::opendaylight::params::snat_mechanism
) inherits ::opendaylight::params {
# Validate OS family
$password = 'admin'
$log_max_size = '10GB'
$log_max_rollover = 2
+ $snat_mechanism = 'controller'
}
{
"name": "opendaylight-opendaylight",
- "version": "4.1.0",
+ "version": "4.2.0",
"author": "Daniel Farrell",
"summary": "Puppet module that installs and configures the OpenDaylight SDN controller",
"license": "BSD-2-Clause",
ha_node_ips: odl_ips, ha_db_modules: db_modules)
end
end
+
+ describe 'testing configuring SNAT' do
+ context 'using default SNAT mechanism' do
+ # Call specialized helper fn to install OpenDaylight
+ install_odl(extra_features: ['odl-netvirt-openstack'])
+
+ # Call specialized helper fn for SNAT config validations
+ snat_mechanism_validations
+ end
+
+ context 'using conntrack SNAT' do
+ # Call specialized helper fn to install OpenDaylight
+ install_odl(extra_features: ['odl-netvirt-openstack'], snat_mechanism: 'conntrack')
+
+ # Call specialized helper fn for SNAT mechanism validations
+ snat_mechanism_validations(snat_mechanism: 'conntrack')
+ end
+ end
end
end
end
+ # SNAT Mechanism tests
+ describe 'SNAT mechanism tests' do
+ # Non-OS-type tests assume CentO
+ # See issue #43 for reasoning:
+ # https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
+ osfamily = 'RedHat'
+ operatingsystem = 'CentOS'
+ operatingsystemmajrelease = '7'
+ context 'using controller' do
+ let(:facts) {{
+ :osfamily => osfamily,
+ :operatingsystem => operatingsystem,
+ :operatingsystemmajrelease => operatingsystemmajrelease,
+ }}
+
+ let(:params) {{
+ :extra_features => ['odl-netvirt-openstack'],
+ }}
+
+ # 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 security groups
+ # Note that this function is defined in spec_helper
+ snat_mechanism_tests
+ end
+
+ context 'using conntrack' do
+ let(:facts) {{
+ :osfamily => osfamily,
+ :operatingsystem => operatingsystem,
+ :operatingsystemmajrelease => operatingsystemmajrelease,
+ }}
+
+ let(:params) {{
+ :snat_mechanism => 'conntrack',
+ :extra_features => ['odl-netvirt-openstack'],
+ }}
+
+ # 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 security groups
+ # Note that this function is defined in spec_helper
+ snat_mechanism_tests('conntrack')
+ end
+ end
+
# VPP routing node config tests
describe 'VPP routing node tests' do
# Non-OS-type tests assume CentOS 7
username_password_tests('test', 'test')
end
end
-
-end
+end
\ No newline at end of file
end
end
+# Shared tests that specialize in testing SNAT mechanism
+def snat_mechanism_tests(snat_mechanism='controller')
+ it { should contain_file('/opt/opendaylight/etc/opendaylight') }
+ it { should contain_file('/opt/opendaylight/etc/opendaylight/datastore')}
+ it { should contain_file('/opt/opendaylight/etc/opendaylight/datastore/initial')}
+ it { should contain_file('/opt/opendaylight/etc/opendaylight/datastore/initial/config')}
+
+ # Confirm snat_mechanism
+ it {
+ should contain_file('netvirt-natservice-config.xml').with(
+ 'ensure' => 'file',
+ 'path' => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-natservice-config.xml',
+ 'owner' => 'odl',
+ 'group' => 'odl',
+ 'content' => /<nat-mode>#{snat_mechanism}<\/nat-mode>/
+ )
+ }
+end
+
# Shared tests that specialize in testing VPP routing node config
def vpp_routing_node_tests(options = {})
# Extract params
password = options.fetch(:password, 'admin')
log_max_size = options.fetch(:log_max_size, '10GB')
log_max_rollover = options.fetch(:log_max_rollover, 2)
+ snat_mechanism = options.fetch(:snat_mechanism, 'controller')
# Build script for consumption by Puppet apply
it 'should work idempotently with no errors' do
password => #{password},
log_max_size => '#{log_max_size}',
log_max_rollover => #{log_max_rollover},
+ snat_mechanism => #{snat_mechanism},
}
EOS
its(:exit_status) { should eq 0 }
end
end
+
+# Shared function for validations related to the SNAT config file
+def snat_mechanism_validations(options = {})
+ # NB: This param default should match the one used by the opendaylight
+ # class, which is defined in opendaylight::params
+ # TODO: Remove this possible source of bugs^^
+ snat_mechanism = options.fetch(:snat_mechanism, 'controller')
+
+ describe file('/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-natservice-config.xml') do
+ it { should be_file }
+ it { should be_owned_by 'odl' }
+ it { should be_grouped_into 'odl' }
+ its(:content) { should match /<nat-mode>#{snat_mechanism}<\/nat-mode>/ }
+ end
+end
\ No newline at end of file
--- /dev/null
+<natservice-config xmlns="urn:opendaylight:netvirt:natservice:config">
+ <nat-mode><%= scope.lookupvar('opendaylight::snat_mechanism') %></nat-mode>
+</natservice-config>
\ No newline at end of file