Adds inactivity probe configuration 85/76285/3
authorTim Rozet <trozet@redhat.com>
Wed, 19 Sep 2018 22:07:18 +0000 (18:07 -0400)
committerTim Rozet <trozet@redhat.com>
Wed, 3 Oct 2018 18:32:09 +0000 (14:32 -0400)
Configures inactivity probe timer, which is the time before a probe is
sent to an inactive switch via OVSDB. If the switch does not respond in
the same time as the inactivity probe interval, the switch will be
considered down.

Change-Id: I3b8ae5239841c5412716d9e9be89516c20abc8d9
Signed-off-by: Tim Rozet <trozet@redhat.com>
CHANGELOG
README.markdown
manifests/config.pp
manifests/init.pp
manifests/params.pp
metadata.json
spec/acceptance/class_spec.rb
spec/classes/opendaylight_spec.rb
spec/spec_helper.rb
spec/spec_helper_acceptance.rb
templates/netvirt-elanmanager-config.xml.erb [new file with mode: 0644]

index a20fe9848b895d5416cd8866e3abc44dc48d35e5..2d4d16b7b2e6997d33d2a59b57e132bf76971da4 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -86,3 +86,5 @@
 - Fix opendaylight karaf log file rotation
 2018-09-27 Release 8.4.2
 - Bind OVSDB and OpenFlow addresses to specific IP
+2018-10-03 Release 8.4.3
+- Adds configuration for OVSDB inactivity probe timer
index 21b9686e8c758dca1199fded6a2a4e7bbe7ae00f..184d700c78d342c5e89b3a73dc89bce8c5ffdbe4 100644 (file)
@@ -453,6 +453,14 @@ Default: `false`
 
 Valid options: `true`, `false`
 
+### `inactivity_probe`
+
+Configures inactivity probe timer when specified.
+
+Default: `undef`
+
+Valid options: An integer or string in milliseconds.
+
 ## Limitations
 
 - Tested on CentOS 7 and Ubuntu 16.04.
index a3b33cab4e8f633f28b6d20f6f31bc99124bd62a..5b9cedd6246808c7cd70bf45f373e349abf9d226 100644 (file)
@@ -221,6 +221,17 @@ class opendaylight::config {
     }
   }
 
+  # Configure inactivity probe
+  if $opendaylight::inactivity_probe {
+    file {'netvirt-elanmanager-config.xml':
+      ensure  => file,
+      path    => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-elanmanager-config.xml',
+      owner   => 'odl',
+      group   => 'odl',
+      content => template('opendaylight/netvirt-elanmanager-config.xml.erb')
+    }
+  }
+
   # Set any custom log levels
   $opendaylight::log_levels.each |$log_name, $logging_level| {
     $underscored_version = regsubst($log_name, '\.', '_', 'G')
index f485edda64f605fbf0b99beffabc7e5e31e751f2..a7e8753952d0ec2b7ee0a08fe45c9a56df4f38fe 100644 (file)
@@ -72,6 +72,9 @@
 # [*stats_polling_enabled*]
 #   Enables statistics polling of OpenFlow entities like table, groups.
 #   Defaults to false
+# [*inactivity_probe*]
+#   Time in millseconds before an inactivity probe is sent via OVSDB
+#   to OVS. Defaults to undef.
 #
 # === Deprecated Parameters
 #
@@ -108,6 +111,7 @@ class opendaylight (
   $log_mechanism          = $::opendaylight::params::log_mechanism,
   $inherit_dscp_marking   = $::opendaylight::params::inherit_dscp_marking,
   $stats_polling_enabled  = $::opendaylight::params::stats_polling_enabled,
+  $inactivity_probe       = $::opendaylight::params::inactivity_probe,
 ) inherits ::opendaylight::params {
 
   # Validate OS family
index 9bbcde1ca5df346bef6b8aca549dae1ffacd4697..7f1142b2a643d7bc9d453fe274ad45e3e9da5c61 100644 (file)
@@ -37,4 +37,5 @@ class opendaylight::params {
   $log_mechanism = 'file'
   $inherit_dscp_marking = false
   $stats_polling_enabled = false
+  $inactivity_probe = undef
 }
index 45408dd6073e91f15e6a1cb0929a776f635fdb75..7553341e3bd3b5b1c7e4fa88b4bbfb235fb8ee6d 100644 (file)
@@ -1,6 +1,6 @@
 {
     "name": "opendaylight-opendaylight",
-    "version": "8.4.2",
+    "version": "8.4.3",
     "author": "Daniel Farrell",
     "summary": "Puppet module that installs and configures the OpenDaylight SDN controller",
     "license": "BSD-2-Clause",
index b45ad38b50fafec29c1d9f2bd56e42bcafc46945..53abe8969ad05c7d71c1fc188fa7c207e11edbdb 100644 (file)
@@ -327,4 +327,14 @@ describe 'opendaylight class' do
       generic_validations(odl_bind_ip: '127.0.0.1')
     end
   end
+
+  describe 'testing configuring inactivity probe' do
+    context 'with specifying inactivity probe timer' do
+      # Call specialized helper fn to install OpenDaylight
+      install_odl(inactivity_probe: 99999)
+
+      # Call specialized helper fn for probe validations
+      inactivity_probe_validations(inactivity_probe: 99999)
+    end
+  end
 end
index ace2dacff62daed0ead97759ea07cfe31431415b..b9a2970f878ff2ad782e233b6a33aa7290c992b4 100644 (file)
@@ -550,6 +550,22 @@ describe 'opendaylight' do
       # Run test specific to log settings
       log_settings(log_mechanism: 'console')
     end
+
+    context 'setting inactivity probe' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{
+        :inactivity_probe => 99999,
+      }}
+
+      # Run shared tests applicable to all supported OSs
+      # Note that this function is defined in spec_helper
+      generic_tests
+    end
   end
 
   # All OVSDB HA enable/disable tests
index 1000321d4bbe2c898cf54cc04b1de7d38de2ccf4..d932cec926edcaab7147603e20b95535bd1ea098 100644 (file)
@@ -16,6 +16,7 @@ RSpec::Puppet::Coverage.filters.push(*custom_filters)
 def generic_tests(options = {})
   java_opts = options.fetch(:java_opts, '')
   odl_bind_ip = options.fetch(:odl_bind_ip, '0.0.0.0')
+  inactivity_probe = options.fetch(:inactivity_probe, :undef)
 
   # Confirm that module compiles
   it { should compile }
@@ -99,6 +100,18 @@ def generic_tests(options = {})
     )
   }
 
+  unless inactivity_probe == :undef
+    it {
+      should contain_file('Configure inactivity probe timer').with(
+        'ensure'  => 'file',
+        'path'    => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-elanmanager-config.xml',
+        'owner'   => 'odl',
+        'group'   => 'odl',
+        'content' =>  /<controller-inactivity-probe>#{inactivity_probe}<\/controller-inactivity-probe>/
+      )
+    }
+  end
+
 end
 
 # Shared tests that specialize in testing log file size and rollover
index 389fabc6843b731c0b983b18eb0996ea1a860a95..31b6e7c8f51296ed7de65836f7cefbe020911749 100644 (file)
@@ -76,6 +76,7 @@ def install_odl(options = {})
   log_mechanism = options.fetch(:log_mechanism, 'file')
   inherit_dscp_marking = options.fetch(:inherit_dscp_marking, false)
   stats_polling_enabled = options.fetch(:stats_polling_enabled, false)
+  inactivity_probe = options.fetch(:inactivity_probe, :undef)
 
   # Build script for consumption by Puppet apply
   it 'should work idempotently with no errors' do
@@ -103,6 +104,7 @@ def install_odl(options = {})
       log_mechanism => #{log_mechanism},
       inherit_dscp_marking => #{inherit_dscp_marking},
       stats_polling_enabled => #{stats_polling_enabled},
+      inactivity_probe => #{inactivity_probe},
     }
     EOS
 
@@ -628,3 +630,20 @@ def stats_polling_validations(options = {})
     its(:content) { should match /is-statistics-polling-on=#{stats_polling_enabled}/ }
   end
 end
+
+# Shared function for validations related to inactivity probe
+def inactivity_probe_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^^
+
+  inactivity_probe = options.fetch(:inactivity_probe, :undef)
+  unless inactivity_probe == :undef
+    describe file('/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-elanmanager-config.xml') do
+      it { should be_file }
+      it { should be_owned_by 'odl' }
+      it { should be_grouped_into 'odl' }
+      its(:content) { should match /<controller-inactivity-probe>#{inactivity_probe}/ }
+    end
+  end
+end
diff --git a/templates/netvirt-elanmanager-config.xml.erb b/templates/netvirt-elanmanager-config.xml.erb
new file mode 100644 (file)
index 0000000..8ca7293
--- /dev/null
@@ -0,0 +1,3 @@
+<elanmanager-config xmlns="urn:opendaylight:netvirt:elan:config">
+  <controller-inactivity-probe><%= scope.lookupvar('opendaylight::inactivity_probe') %></controller-inactivity-probe>
+</elanmanager-config>