Adds VXLAN+GPE config when using SFC feature 12/62112/2
authorTim Rozet <trozet@redhat.com>
Mon, 21 Aug 2017 20:46:47 +0000 (16:46 -0400)
committerDaniel Farrell <dfarrell@redhat.com>
Mon, 21 Aug 2017 22:55:24 +0000 (18:55 -0400)
Config is necessary for Genius to create VXLAN tunnels as VXLAN+GPE when
using the odl-netvirt-sfc feature.

Disable XML Coala linting because of false-positive regarding XML
version. ODL uses files like this, should copy. Can reevaluate enabling
later.

Change-Id: I02314dac7c779d00d54cd5c47448822792e353ab
Signed-off-by: Tim Rozet <trozet@redhat.com>
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
.coafile
files/genius-itm-config.xml [new file with mode: 0644]
files/netvirt-elanmanager-config.xml [new file with mode: 0644]
manifests/config.pp
spec/acceptance/class_spec.rb
spec/classes/opendaylight_spec.rb
spec/spec_helper.rb
spec/spec_helper_acceptance.rb

index 832a75045feb15dcb4bff5079b935feca7d04785..4f085b7293ad28f76ffacfee0f3e283ae7352e2c 100644 (file)
--- a/.coafile
+++ b/.coafile
@@ -78,3 +78,4 @@ default_actions = JSONFormatBear: ApplyPatchAction
 [all.xml]
 bears = XMLBear
 files = **.xml
+enabled = False
diff --git a/files/genius-itm-config.xml b/files/genius-itm-config.xml
new file mode 100644 (file)
index 0000000..91efee9
--- /dev/null
@@ -0,0 +1,3 @@
+<itm-config xmlns="urn:opendaylight:genius:itm:config">
+    <gpe-extension-enabled>true</gpe-extension-enabled>
+</itm-config>
diff --git a/files/netvirt-elanmanager-config.xml b/files/netvirt-elanmanager-config.xml
new file mode 100644 (file)
index 0000000..8058eb0
--- /dev/null
@@ -0,0 +1,3 @@
+<elanmanager-config xmlns="urn:opendaylight:netvirt:elan:config">
+    <use-of-tunnels>true</use-of-tunnels>
+</elanmanager-config>
index 2f16454c9c725a45a49678ec2fedf3e8c9f88534..69723f195c50bb7749cd6841c8621ebd37309698 100644 (file)
@@ -101,9 +101,9 @@ class opendaylight::config {
     }
   }
 
-  # Configure ACL security group
-  # Requires at least CentOS 7.3 for RHEL/CentOS systems
-  if ('odl-netvirt-openstack' in $opendaylight::features) {
+  if ('odl-netvirt-openstack' in $opendaylight::features or 'odl-netvirt-sfc' in $opendaylight::features) {
+    # Configure ACL security group
+    # Requires at least CentOS 7.3 for RHEL/CentOS systems
     if $opendaylight::security_group_mode == 'stateful' {
       if defined('$opendaylight::stateful_unsupported') and $opendaylight::stateful_unsupported {
           warning("Stateful is unsupported in ${::operatingsystemrelease} setting to 'learn'")
@@ -135,10 +135,8 @@ class opendaylight::config {
       group   => 'odl',
       content => template('opendaylight/netvirt-aclservice-config.xml.erb'),
     }
-  }
 
-  # Configure SNAT
-  if ('odl-netvirt-openstack' in $opendaylight::features) {
+    # Configure SNAT
     file { 'netvirt-natservice-config.xml':
       ensure  => file,
       path    => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-natservice-config.xml',
@@ -149,6 +147,27 @@ class opendaylight::config {
     }
   }
 
+  # SFC Config
+  if ('odl-netvirt-sfc' in $opendaylight::features) {
+    file { 'netvirt-elanmanager-config.xml':
+      ensure  => file,
+      path    => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-elanmanager-config.xml',
+      owner   => 'odl',
+      group   => 'odl',
+      source  => 'puppet:///modules/opendaylight/netvirt-elanmanager-config.xml',
+      require => File['/opt/opendaylight/etc/opendaylight/datastore/initial/config'],
+    }
+
+    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',
+      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':
index db51e110a5aa53ce8794aa13419d5a035f8a0096..384ea8a6b058b2f41f58de03299626becec86dfa 100644 (file)
@@ -210,4 +210,14 @@ describe 'opendaylight class' do
       snat_mechanism_validations(snat_mechanism: 'conntrack')
     end
   end
+
+  describe 'testing configuring SFC' do
+    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
+    end
+  end
 end
index 66a6d88abfae7bad24c2dddd0257fc7d776c08ca..eb4910da0949d84c1271f63936ae348b167fde14 100644 (file)
@@ -858,6 +858,35 @@ describe 'opendaylight' do
     end
   end
 
+  # SFC tests
+  describe 'SFC 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 odl-netvirt-sfc feature' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{
+        :extra_features => ['odl-netvirt-sfc'],
+      }}
+
+      # 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
+  end
+
   # VPP routing node config tests
   describe 'VPP routing node tests' do
     # Non-OS-type tests assume CentOS 7
@@ -952,4 +981,4 @@ describe 'opendaylight' do
       username_password_tests('test', 'test')
     end
   end
-end
\ No newline at end of file
+end
index 12eb8e4e7ed971f1874313bf3cdf3d51658e6438..00b21fd0ef46f75b7c506cbfdb51290f46b2ee60 100644 (file)
@@ -354,6 +354,31 @@ def snat_mechanism_tests(snat_mechanism='controller')
     }
 end
 
+# Shared tests that specialize in testing SFC Config
+def sfc_tests()
+  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')}
+
+  it {
+    should contain_file('netvirt-elanmanager-config.xml').with(
+      'ensure'  => 'file',
+      'path'    => '/opt/opendaylight/etc/opendaylight/datastore/initial/config/netvirt-elanmanager-config.xml',
+      'owner'   => 'odl',
+      'group'   => 'odl',
+      'source'  => 'puppet:///modules/opendaylight/netvirt-elanmanager-config.xml'
+      )
+    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',
+      'source'  => 'puppet:///modules/opendaylight/genius-itm-config.xml'
+      )
+    }
+end
+
 # Shared tests that specialize in testing VPP routing node config
 def vpp_routing_node_tests(options = {})
   # Extract params
index ab0ca093474e72505d592e5033a4a63c609a00b0..44d70eaa8c02bfc10088056bf9d07cb90a8efdad 100644 (file)
@@ -402,3 +402,24 @@ def snat_mechanism_validations(options = {})
     its(:content) { should match /<nat-mode>#{snat_mechanism}<\/nat-mode>/ }
   end
 end
+
+# Shared function for validations related to SFC
+def sfc_validations()
+  # 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^^
+
+  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 /<use-of-tunnels>true<\/use-of-tunnels>/ }
+  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>/ }
+  end
+end