Add flag to enable DSCP marking 24/69424/14
authorJanki Chhatbar <jchhatba@redhat.com>
Tue, 13 Mar 2018 08:19:45 +0000 (13:49 +0530)
committerTim Rozet <trozet@redhat.com>
Wed, 23 May 2018 16:52:14 +0000 (12:52 -0400)
Configure files to support QoS DSCP marking feature.
genius-itm-config.xml is configured to support this feature.

default-tunnel-tos is '0' by default and 'inherit' for DSCP
marking support.

Change-Id: If06b1dd41235fb139642a77c0f098598d6d3018b
Signed-Off-By: Janki Chhatbar <jchhatba@redhat.com>
Signed-off-by: Tim Rozet <trozet@redhat.com>
12 files changed:
CHANGELOG
README.markdown
files/genius-itm-config.xml [deleted file]
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/genius-itm-config.xml.erb [new file with mode: 0644]

index 9c2ad00eb1dfeeb2f930861ee1acdaf7de4c35fa..e0027911ffa16f00350460a79ff7cd8023dd36ff 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -74,3 +74,5 @@
 - Disable MD-SAL Trust Store
 2018-05-22 Release 8.1.3
 - Remove ELAN manager config for SFC
+2018-05-23 Release 8.2.0
+- Configure tos option to support QoS DSCP marking
index e222072563378e58d8b288241ee42529dc60a2aa..cfbf3bce2b74971202d52b83b2d4a7443d038b47 100644 (file)
@@ -417,6 +417,15 @@ Default: `'admin'`
 
 Valid options: A password string.
 
+### `inherit_dscp_marking`
+
+Specifies whether DSCP marking is enabled for packets egressing out of OVS through
+VXLAN/GRE tunnels.
+
+Default: `false`
+
+Valid options: `true`, `false`
+
 ## Limitations
 
 - Tested on CentOS 7 and Ubuntu 16.04.
diff --git a/files/genius-itm-config.xml b/files/genius-itm-config.xml
deleted file mode 100644 (file)
index 91efee9..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<itm-config xmlns="urn:opendaylight:genius:itm:config">
-    <gpe-extension-enabled>true</gpe-extension-enabled>
-</itm-config>
index d4a8cdad51c303df73ba86a8e0a925fdcccc2e63..62ad17832ba880da14bdc08ca8c5b76bee9bd32e 100644 (file)
@@ -323,16 +323,14 @@ class opendaylight::config {
     }
   }
 
-  # SFC Config
-  if ('odl-netvirt-sfc' in $opendaylight::features) {
-    file { 'genius-itm-config.xml':
+  # Config file for SFC and DSCP features
+  file { 'genius-itm-config.xml':
       ensure  => file,
       path    => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/genius-itm-config.xml',
       owner   => 'odl',
       group   => 'odl',
-      source  => 'puppet:///modules/opendaylight/genius-itm-config.xml',
+      content => template('opendaylight/genius-itm-config.xml.erb'),
       require => File['/opt/opendaylight/etc/opendaylight/datastore/initial/config'],
-    }
   }
 
   #configure VPP routing node
index 14f644c3cb45b81c89f21bba4121909f226e998e..da957f6d7e1f75385b66356425d774c38d2dea15 100644 (file)
@@ -61,6 +61,9 @@
 #   Optional.  Defaults to undef.
 # [*log_mechanism*]
 #   Sets logging mechanism for karaf logs
+# [*inherit_dscp_marking]
+#   Sets tos option to enable QoS DSCP marking
+#   Defaults to false
 #
 # === Deprecated Parameters
 #
@@ -94,6 +97,7 @@ class opendaylight (
   $tls_cert_file         = $::opendaylight::params::tls_cert_file,
   $tls_ca_cert_file      = $::opendaylight::params::tls_ca_cert_file,
   $log_mechanism         = $::opendaylight::params::log_mechanism,
+  $inherit_dscp_marking  = $::opendaylight::params::inherit_dscp_marking,
 ) inherits ::opendaylight::params {
 
   # Validate OS family
index d384cca08c43ef9548e93ab50289e9a3217e803e..ddfa8fab15f5eb7095adcf82ee3d0775ceea8453 100644 (file)
@@ -34,4 +34,5 @@ class opendaylight::params {
   $tls_ca_cert_file = undef
   $tls_trusted_certs = []
   $log_mechanism = 'file'
+  $inherit_dscp_marking = false
 }
index 52d79adc6fe86c928b68c2646ed3f429e9db96a2..e03542392619c935fd22006c8ac77eb262f3f4ec 100644 (file)
@@ -1,6 +1,6 @@
 {
     "name": "opendaylight-opendaylight",
-    "version": "8.1.3",
+    "version": "8.2.0",
     "author": "Daniel Farrell",
     "summary": "Puppet module that installs and configures the OpenDaylight SDN controller",
     "license": "BSD-2-Clause",
index fb678e6e1828d53627ae91df83531b99e09b14a4..bed61c934850d766037235a26f695f9ace65563a 100644 (file)
@@ -221,12 +221,38 @@ describe 'opendaylight class' do
   end
 
   describe 'testing configuring SFC' do
+    context 'not using SFC feature' do
+      # Call specialized helper fn to install OpenDaylight
+      install_odl
+
+      # Call specialized helper fn for SFC config validations
+      sfc_validations
+    end
+
     context 'using SFC feature' do
       # Call specialized helper fn to install OpenDaylight
       install_odl(extra_features: ['odl-netvirt-sfc'])
 
       # Call specialized helper fn for SFC config validations
-      sfc_validations
+      sfc_validations(extra_features: ['odl-netvirt-sfc'])
+    end
+  end
+
+  describe 'testing configuring tos value for DSCP marking' do
+    context 'not enabling DSCP marking' do
+      # Call specialized helper fn to install OpenDaylight
+      install_odl
+
+      # Call specialized helper fn for SFC config validations
+      dscp_validations
+    end
+
+    context 'enabling DSCP marking' do
+      # Call specialized helper fn to install OpenDaylight
+      install_odl(inherit_dscp_marking: true)
+
+      # Call specialized helper fn for SFC config validations
+      dscp_validations(inherit_dscp_marking: true)
     end
   end
 
index b237d092e0442eff61775e93378995ad8d96b74b..9ef06d12e462f35bd703d994654a6507683f6b44 100644 (file)
@@ -811,6 +811,24 @@ describe 'opendaylight' do
     osfamily = 'RedHat'
     operatingsystem = 'CentOS'
     operatingsystemmajrelease = '7'
+    context 'not using odl-netvirt-sfc feature' 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 that specialize in checking security groups
+      # Note that this function is defined in spec_helper
+      sfc_tests
+    end
+
     context 'using odl-netvirt-sfc feature' do
       let(:facts) {{
         :osfamily => osfamily,
@@ -828,7 +846,54 @@ describe 'opendaylight' do
 
       # Run test that specialize in checking security groups
       # Note that this function is defined in spec_helper
-      sfc_tests
+      sfc_tests(extra_features: ['odl-netvirt-sfc'])
+    end
+  end
+
+  # DSCP marking tests
+  describe 'DSCP marking tests' 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'
+    context 'use default value' 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 that specialize in checking security groups
+      # Note that this function is defined in spec_helper
+      dscp_tests
+    end
+
+    context 'inherit DSCP values' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{
+        :inherit_dscp_marking => :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 security groups
+      # Note that this function is defined in spec_helper
+      dscp_tests(inherit_dscp_marking: true)
     end
   end
 
index 556e4ae0013369417e155eb7baa303ec56762ec9..1baf7176a07bae0cb07f920fb3ed44032ebd9218 100644 (file)
@@ -375,7 +375,15 @@ def snat_mechanism_tests(snat_mechanism='controller')
 end
 
 # Shared tests that specialize in testing SFC Config
-def sfc_tests()
+def sfc_tests(options = {})
+  extra_features = options.fetch(:extra_features, [])
+
+  if extra_features.include? 'odl-netvirt-sfc'
+    sfc_enabled = true
+  else
+    sfc_enabled = false
+  end
+
   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')}
@@ -387,9 +395,36 @@ def sfc_tests()
       'path'    => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/genius-itm-config.xml',
       'owner'   => 'odl',
       'group'   => 'odl',
-      'source'  => 'puppet:///modules/opendaylight/genius-itm-config.xml'
+      'content' => /<gpe-extension-enabled>#{sfc_enabled}<\/gpe-extension-enabled>/
+      )
+    }
+end
+
+# Shared tests that specialize in testing DSCP marking config
+def dscp_tests(options = {})
+  inherit_dscp_marking = options.fetch(:inherit_dscp_marking, false)
+
+  if inherit_dscp_marking
+    it {
+      should contain_file('genius-itm-config.xml').with(
+        'ensure'  => 'file',
+        'path'    => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/genius-itm-config.xml',
+        'owner'   => 'odl',
+        'group'   => 'odl',
+        'content' => /<default-tunnel-tos>inherit<\/default-tunnel-tos>/
       )
     }
+  else
+    it {
+      should contain_file('genius-itm-config.xml').with(
+        'ensure'  => 'file',
+        'path'    => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/genius-itm-config.xml',
+        'owner'   => 'odl',
+        'group'   => 'odl',
+        'content' => /<default-tunnel-tos>0<\/default-tunnel-tos>/
+      )
+    }
+  end
 end
 
 # Shared tests that specialize in testing VPP routing node config
index 93479d1c961cf415fb6668760b6a84d277948ce8..f7ef25313f33989ed0041f04f4711cded267bdca 100644 (file)
@@ -68,6 +68,7 @@ def install_odl(options = {})
   enable_tls = options.fetch(:enable_tls, false)
   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)
 
   # Build script for consumption by Puppet apply
   it 'should work idempotently with no errors' do
@@ -92,6 +93,7 @@ def install_odl(options = {})
       enable_tls => #{enable_tls},
       tls_keystore_password => #{tls_keystore_password},
       log_mechanism => #{log_mechanism},
+      inherit_dscp_marking => #{inherit_dscp_marking},
     }
     EOS
 
@@ -442,16 +444,41 @@ def snat_mechanism_validations(options = {})
 end
 
 # Shared function for validations related to SFC
-def sfc_validations()
+def sfc_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^^
 
+  extra_features = options.fetch(:extra_features, [])
+  if extra_features.include? 'odl-netvirt-sfc'
+    sfc_enabled = true
+  else
+    sfc_enabled = false
+  end
+
   describe file('/opt/opendaylight/etc/opendaylight/datastore/initial/config/genius-itm-config.xml') do
     it { should be_file }
     it { should be_owned_by 'odl' }
     it { should be_grouped_into 'odl' }
-    its(:content) { should match /<gpe-extension-enabled>true<\/gpe-extension-enabled>/ }
+    its(:content) { should match /<gpe-extension-enabled>#{sfc_enabled}<\/gpe-extension-enabled>/ }
+  end
+end
+
+# Shared function for validations related to tos value for DSCP marking
+def dscp_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^^
+
+  inherit_dscp_marking = options.fetch(:inherit_dscp_marking, false)
+
+  if inherit_dscp_marking
+    describe file('/opt/opendaylight/etc/opendaylight/datastore/initial/config/genius-itm-config.xml') do
+      it { should be_file }
+      it { should be_owned_by 'odl' }
+      it { should be_grouped_into 'odl' }
+      its(:content) { should match /<default-tunnel-tos>inherit<\/default-tunnel-tos>/ }
+    end
   end
 end
 
diff --git a/templates/genius-itm-config.xml.erb b/templates/genius-itm-config.xml.erb
new file mode 100644 (file)
index 0000000..1266d01
--- /dev/null
@@ -0,0 +1,18 @@
+<itm-config xmlns="urn:opendaylight:genius:itm:config">
+    <def-tz-enabled>true</def-tz-enabled>
+    <def-tz-tunnel-type>vxlan</def-tz-tunnel-type>
+    <tunnel-aggregation>
+        <tunnel-type>vxlan</tunnel-type>
+        <enabled>false</enabled>
+    </tunnel-aggregation>
+    <%- if scope.lookupvar('opendaylight::inherit_dscp_marking') -%>
+    <default-tunnel-tos>inherit</default-tunnel-tos>
+    <%- else -%>
+    <default-tunnel-tos>0</default-tunnel-tos>
+    <%- end -%>
+    <%- if scope.lookupvar('opendaylight::features').include?('odl-netvirt-sfc') -%>
+    <gpe-extension-enabled>true</gpe-extension-enabled>
+    <%- else -%>
+    <gpe-extension-enabled>false</gpe-extension-enabled>
+    <%- end -%>
+</itm-config>
\ No newline at end of file