Merge "Bump Puppet version 4.x to 5.x"
[integration/packaging/puppet-opendaylight.git] / spec / classes / opendaylight_spec.rb
index 1ce50988b41f18b3b79d3c99bd0644727531aa54..c430a55f9fa1a60e20bfcc3602c98940f250adda 100644 (file)
@@ -50,7 +50,7 @@ describe 'opendaylight' do
             # Run tests that specialize in checking log file settings
             # NB: Only testing defaults here, specialized log file settings tests elsewhere
             # Note that this function is defined in spec_helper
-            log_file_settings
+            log_settings
           end
         end
 
@@ -114,7 +114,7 @@ describe 'opendaylight' do
             # Run tests that specialize in checking log file settings
             # NB: Only testing defaults here, specialized log file settings tests elsewhere
             # Note that this function is defined in spec_helper
-            log_file_settings
+            log_settings
           end
         end
 
@@ -188,7 +188,7 @@ describe 'opendaylight' do
             # Run tests that specialize in checking log file settings
             # NB: Only testing defaults here, specialized log file settings tests elsewhere
             # Note that this function is defined in spec_helper
-            log_file_settings
+            log_settings
           end
         end
 
@@ -325,8 +325,8 @@ describe 'opendaylight' do
     end
   end
 
-  # All ODL REST port tests
-  describe 'REST port tests' do
+  # All ODL IP/REST port tests
+  describe 'IP and REST port tests' do
     # Non-OS-type tests assume CentOS 7
     #   See issue #43 for reasoning:
     #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
@@ -365,7 +365,7 @@ describe 'opendaylight' do
 
       # Run shared tests applicable to all supported OSs
       # Note that this function is defined in spec_helper
-      generic_tests
+      generic_tests(odl_bind_ip: '127.0.0.1')
 
       # Run test that specialize in checking ODL REST port config
       # Note that this function is defined in spec_helper
@@ -445,15 +445,16 @@ describe 'opendaylight' do
     end
   end
 
-  # All custom log file size and rollover tests
-  describe 'log file size and rollover' do
+  describe 'log mechanism 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'
-    context 'using default size and rollover' do
+
+    # All custom log file size and rollover tests
+    context 'log to file using default size and rollover' do
       let(:facts) {{
         :osfamily => osfamily,
         :operatingsystem => operatingsystem,
@@ -466,11 +467,129 @@ describe 'opendaylight' do
       # Note that this function is defined in spec_helper
       generic_tests
 
-      # Run test specific to log file settings
-      log_file_settings
+      # Run test specific to log settings
+      log_settings
+    end
+
+    context 'log to file customizing size' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{
+        :log_max_size => '100MB',
+      }}
+
+      # 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
+      log_settings(log_max_size: '100MB')
+    end
+
+    context 'log to file customizing rollover' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{
+        :log_max_rollover => 10,
+      }}
+
+      # 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
+      log_settings(log_max_rollover: 10)
+    end
+
+    context 'log to file customizing size and rollover' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{
+        :log_max_size => '250MB',
+        :log_max_rollover => 8,
+        :log_rollover_fileindex => 'min'
+      }}
+
+      # 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
+      log_settings(log_max_size: '250MB',
+                   log_max_rollover: 8,
+                   log_rollover_fileindex: 'min')
+    end
+
+    context 'log to file customizing pattern' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{
+        :log_pattern => '%d{ISO8601} | %-5p | %-16t | %m%n',
+      }}
+
+      # 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
+      log_settings(log_pattern: '%d{ISO8601} | %-5p | %-16t | %m%n')
+    end
+
+    context 'log to file enabling the PaxOsgi appender' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{
+        :enable_paxosgi_logger => 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
+      log_settings(enable_paxosgi_logger: true)
+    end
+
+    context 'log to file disabling the PaxOsgi appender' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{
+        :enable_paxosgi_logger => false,
+      }}
+
+      # 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
+      log_settings(enable_paxosgi_logger: false)
     end
 
-    context 'customizing size' do
+    context 'log to console' do
       let(:facts) {{
         :osfamily => osfamily,
         :operatingsystem => operatingsystem,
@@ -478,18 +597,18 @@ describe 'opendaylight' do
       }}
 
       let(:params) {{
-        :log_max_size => '1GB',
+        :log_mechanism => 'console',
       }}
 
       # Run shared tests applicable to all supported OSs
       # Note that this function is defined in spec_helper
       generic_tests
 
-      # Run test specific to log file settings
-      log_file_settings(log_max_size: '1GB')
+      # Run test specific to log settings
+      log_settings(log_mechanism: 'console')
     end
 
-    context 'customizing rollover' do
+    context 'log to console customizing pattern' do
       let(:facts) {{
         :osfamily => osfamily,
         :operatingsystem => operatingsystem,
@@ -497,18 +616,20 @@ describe 'opendaylight' do
       }}
 
       let(:params) {{
-        :log_max_rollover => 3,
+        :log_mechanism => 'console',
+        :log_pattern => '%d{ISO8601} | %-5p | %-16t | %m%n',
       }}
 
       # Run shared tests applicable to all supported OSs
       # Note that this function is defined in spec_helper
       generic_tests
 
-      # Run test specific to log file settings
-      log_file_settings(log_max_rollover: 3)
+      # Run test specific to log settings
+      log_settings(log_mechanism: 'console',
+                   log_pattern: '%d{ISO8601} | %-5p | %-16t | %m%n')
     end
 
-    context 'customizing size and rollover' do
+    context 'log to console enabling the PaxOsgi appender' do
       let(:facts) {{
         :osfamily => osfamily,
         :operatingsystem => operatingsystem,
@@ -516,17 +637,54 @@ describe 'opendaylight' do
       }}
 
       let(:params) {{
-        :log_max_size => '1GB',
-        :log_max_rollover => 3,
+        :log_mechanism => 'console',
+        :enable_paxosgi_logger => 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 file settings
-      log_file_settings(log_max_size: '1GB',
-                        log_max_rollover: 3)
+      # Run test specific to log settings
+      log_settings(log_mechanism: 'console',
+                   enable_paxosgi_logger: true)
+    end
+
+    context 'log to console disabling the PaxOsgi appender' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{
+        :log_mechanism => 'console',
+        :enable_paxosgi_logger => false,
+      }}
+
+      # 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
+      log_settings(log_mechanism: 'console',
+                   enable_paxosgi_logger: false)
+    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
 
@@ -653,7 +811,7 @@ describe 'opendaylight' do
       end
 
       context 'installing from Nexus repo' do
-        rpm_repo = 'https://nexus.opendaylight.org/content/repositories/opendaylight-oxygen-epel-7-$basearch-devel'
+        rpm_repo = 'https://nexus.opendaylight.org/content/repositories/opendaylight-neon-epel-7-$basearch-devel'
         let(:facts) {{
           :osfamily => osfamily,
           :operatingsystem => operatingsystem,
@@ -704,8 +862,8 @@ describe 'opendaylight' do
         deb_install_tests
       end
 
-      context 'installing Carbon Deb' do
-        deb_repo = 'ppa:odl-team/carbon'
+      context 'installing Nitrogen Deb' do
+        deb_repo = 'ppa:odl-team/nitrogen'
         let(:facts) {{
           :osfamily => osfamily,
           :operatingsystem => operatingsystem,
@@ -791,6 +949,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,
@@ -808,7 +984,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
 
@@ -946,7 +1169,7 @@ describe 'opendaylight' do
 
       # Run shared tests applicable to all supported OSs
       # Note that this function is defined in spec_helper
-      generic_tests
+      generic_tests(odl_bind_ip: '127.0.0.1')
 
       # Run test that specialize in checking websocket address
       # Note that this function is defined in spec_helper
@@ -998,4 +1221,92 @@ 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
+
+  describe 'Different IPv support 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 'IPv6 deployment' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{
+        :odl_bind_ip => '::1'
+        }}
+
+      # Run shared tests applicable to all supported OSs
+      # Note that this function is defined in spec_helper
+      generic_tests(odl_bind_ip:'::1')
+    end
+
+    context 'IPv4 deployment' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{
+        :odl_bind_ip => '127.0.0.1'
+        }}
+
+      # Run shared tests applicable to all supported OSs
+      # Note that this function is defined in spec_helper
+      generic_tests(odl_bind_ip:'127.0.0.1')
+    end
+  end
 end