Disable OF statics polling 05/74105/2
authorJanki Chhatbar <jankihchhatbar@gmail.com>
Tue, 17 Jul 2018 07:16:28 +0000 (12:46 +0530)
committerJanki Chhatbar <jankihchhatbar@gmail.com>
Thu, 19 Jul 2018 06:14:22 +0000 (11:44 +0530)
ODL polls for OF statics for its properties like
group. This causes unnecessary long logs and affects
performance in large scale deployments. Disable it
with a flag 'stats_polling_enabled=false' which can
be changed to true to enable it again.

Change-Id: I7f659a72e485d6c82ddce6649b2e04c804ceefce
Signed-Off-By: Janki Chhatbar <jchhatba@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

index 7f2eeeb9b5af5c7b2c830a1f1df2900fbc7b480a..2f7d3aa5b42c59f2b39baa58b16e872d1ecc5894 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -78,3 +78,5 @@
 - Configure tos option to support QoS DSCP marking
 2018-06-28 Release 8.2.1
 - Bind karaf shell to ODL bind IP
+2018-07-16 Release 8.3.0
+- Disable regular polling of OF statistics
index cfbf3bce2b74971202d52b83b2d4a7443d038b47..97ed481c96a74edc9ec926b43fc67c4be55afbb3 100644 (file)
@@ -426,6 +426,14 @@ Default: `false`
 
 Valid options: `true`, `false`
 
+### `stats_polling_enabled`
+
+Enables statistics polling of OpenFlow entities like table, groups.
+
+Default: `false`
+
+Valid options: `true`, `false`
+
 ## Limitations
 
 - Tested on CentOS 7 and Ubuntu 16.04.
index 392bff078fdc01f0c632e89534446a8c97b9845c..f76f31ed0c1f43ec6650a175cbd50e9e9953d7e7 100644 (file)
@@ -369,4 +369,19 @@ class opendaylight::config {
     password => $::opendaylight::password,
     before   => Service['opendaylight'],
   }
+
+  # Configure OpenFlow entities' statistics polling
+  file { 'openflowplugin.cfg':
+    ensure => file,
+    path   => '/opt/opendaylight/etc/org.opendaylight.openflowplugin.cfg',
+    # Set user:group owners
+    owner  => 'odl',
+    group  => 'odl',
+  }
+  file_line { 'stats-polling':
+    ensure => present,
+    path   => '/opt/opendaylight/etc/org.opendaylight.openflowplugin.cfg',
+    line   => "is-statistics-polling-on=${::opendaylight::stats_polling_enabled}",
+    match  => '^is-statistics-polling-on=.*$',
+  }
 }
index da957f6d7e1f75385b66356425d774c38d2dea15..308e1cafeffe09277c1b5b5ec15f432a09ccb56d 100644 (file)
 #   Optional.  Defaults to undef.
 # [*log_mechanism*]
 #   Sets logging mechanism for karaf logs
-# [*inherit_dscp_marking]
+# [*inherit_dscp_marking*]
 #   Sets tos option to enable QoS DSCP marking
 #   Defaults to false
-#
+# [*stats_polling_enabled*]
+#   Enables statistics polling of OpenFlow entities like table, groups.
+#   Defaults to false
 # === Deprecated Parameters
 #
 # [*ha_node_index*]
@@ -98,6 +100,7 @@ class opendaylight (
   $tls_ca_cert_file      = $::opendaylight::params::tls_ca_cert_file,
   $log_mechanism         = $::opendaylight::params::log_mechanism,
   $inherit_dscp_marking  = $::opendaylight::params::inherit_dscp_marking,
+  $stats_polling_enabled = $::opendaylight::params::stats_polling_enabled,
 ) inherits ::opendaylight::params {
 
   # Validate OS family
index ddfa8fab15f5eb7095adcf82ee3d0775ceea8453..a3b4de45ae5aa4a6bbcaa50ab34b271519859883 100644 (file)
@@ -35,4 +35,5 @@ class opendaylight::params {
   $tls_trusted_certs = []
   $log_mechanism = 'file'
   $inherit_dscp_marking = false
+  $stats_polling_enabled = false
 }
index 25f3e0c38631a3b37ba9f4c8da219666e9429374..12ed99dc51f760c4e3db75b4db009c0cb64b8a74 100644 (file)
@@ -1,6 +1,6 @@
 {
     "name": "opendaylight-opendaylight",
-    "version": "8.2.1",
+    "version": "8.3.0",
     "author": "Daniel Farrell",
     "summary": "Puppet module that installs and configures the OpenDaylight SDN controller",
     "license": "BSD-2-Clause",
index fc1fa486a9f5a7557ef59b8b56ed7de5f8028e0d..e223a4a54eddedfd4d937f1d3ba5fcb56fa835cf 100644 (file)
@@ -289,4 +289,23 @@ describe 'opendaylight class' do
       tls_validations(enable_tls: true, tls_keystore_password: '123456')
     end
   end
+
+  describe 'testing stats polling enablement' do
+    context 'with polling enabled' do
+      # Call specialized helper fn to install OpenDaylight
+      install_odl(stats_polling_enabled: true)
+
+      # Call specialized helper fn for polling enablement validations
+      stats_polling_validations(stats_polling_enabled: true)
+    end
+
+    context 'with polling disabled' do
+      # Call specialized helper fn to install OpenDaylight
+      install_odl
+
+      # Call specialized helper fn for polling enablement validations
+      stats_polling_validations
+    end
+
+  end
 end
index 19c3b2416ca4a10d0e99f767b9900da05503a55d..76bbb16d4fef0f9bbf4457d40d16c76a097e6429 100644 (file)
@@ -1083,4 +1083,51 @@ describe 'opendaylight' do
       odl_tls_tests(enable_tls:true, tls_keystore_password:'123456')
     end
   end
+
+  describe 'polling enablement settings' do
+    # Non-OS-type tests assume CentOS 7
+    #   See issue #43 for reasoning:
+    #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
+    osfamily = 'RedHat'
+    operatingsystem = 'CentOS'
+    operatingsystemmajrelease = '7'
+
+    # Default statistics polling off
+    context 'do not poll ovs statistics' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{ }}
+
+      # Run shared tests applicable to all supported OSs
+      # Note that this function is defined in spec_helper
+      generic_tests
+
+      # Run test specific to log settings
+      stats_polling_enablement_tests
+    end
+
+    # Default statistics polling on
+    context 'poll ovs statistics' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{
+       :stats_polling_enabled => true,
+       }}
+
+      # Run shared tests applicable to all supported OSs
+      # Note that this function is defined in spec_helper
+      generic_tests
+
+      # Run test specific to log settings
+      stats_polling_enablement_tests(stats_polling_enabled:true)
+    end
+  end
 end
index beaba7f3f8b17ae12e4d8fc42195d13ca5d26c1e..eb5c4693c2b10a2e2e459de3d2289f6c6533620b 100644 (file)
@@ -613,3 +613,27 @@ def odl_tls_tests(options = {})
     }
   end
 end
+
+def stats_polling_enablement_tests(options = {})
+  # Extract params
+  # NB: This default value should be the same as one in opendaylight::params
+  # TODO: Remove this possible source of bugs^^
+  stats_polling_enabled = options.fetch(:stats_polling_enabled, false)
+  # Confirm properties of ODL REST port config file
+  # NB: These hashes don't work with Ruby 1.8.7, but we
+  #   don't support 1.8.7 so that's okay. See issue #36.
+  it {
+    should contain_file('openflowplugin.cfg').with(
+      'ensure' => 'file',
+      'path'   => '/opt/opendaylight/etc/org.opendaylight.openflowplugin.cfg',
+      'owner'  => 'odl',
+      'group'  => 'odl',
+    )
+    should contain_file_line('stats-polling').with(
+      'ensure' => 'present',
+      'path'   => '/opt/opendaylight/etc/org.opendaylight.openflowplugin.cfg',
+      'line'   => "is-statistics-polling-on=#{stats_polling_enabled}",
+      'match'  => '^is-statistics-polling-on=.*$',
+    )
+  }
+end
\ No newline at end of file
index 5611026019e83b70eaea436c63e076c8186b05d6..517c1739da44704778c2b5ecce9d5a4f4af4dece 100644 (file)
@@ -69,6 +69,7 @@ def install_odl(options = {})
   tls_keystore_password = options.fetch(:tls_keystore_password, 'dummypass')
   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)
 
   # Build script for consumption by Puppet apply
   it 'should work idempotently with no errors' do
@@ -94,6 +95,7 @@ def install_odl(options = {})
       tls_keystore_password => #{tls_keystore_password},
       log_mechanism => #{log_mechanism},
       inherit_dscp_marking => #{inherit_dscp_marking},
+      stats_polling_enabled => #{stats_polling_enabled},
     }
     EOS
 
@@ -574,3 +576,18 @@ def tls_validations(options = {})
     its(:content) { should match /<Property name="jetty.secure.port" default="#{odl_rest_port}" \/>/ }
   end
 end
+
+# Shared function for validations related to OVS statistics polling
+def stats_polling_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^^
+
+  stats_polling_enabled = options.fetch(:stats_polling_enabled, false)
+  describe file('/opt/opendaylight/etc/org.opendaylight.openflowplugin.cfg') do
+    it { should be_file }
+    it { should be_owned_by 'odl' }
+    it { should be_grouped_into 'odl' }
+    its(:content) { should match /is-statistics-polling-on=#{stats_polling_enabled}/ }
+  end
+end