INTPAK-185 Binds karaf to ODL IP
[integration/packaging/puppet-opendaylight.git] / spec / classes / opendaylight_spec.rb
index eb4910da0949d84c1271f63936ae348b167fde14..19c3b2416ca4a10d0e99f767b9900da05503a55d 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
@@ -351,7 +351,7 @@ describe 'opendaylight' do
       odl_rest_port_tests
     end
 
-    context 'overriding default REST port' do
+    context 'overriding default REST and IP port' do
       let(:facts) {{
         :osfamily => osfamily,
         :operatingsystem => operatingsystem,
@@ -360,6 +360,7 @@ describe 'opendaylight' do
 
       let(:params) {{
         :odl_rest_port => 7777,
+        :odl_bind_ip => '127.0.0.1'
       }}
 
       # Run shared tests applicable to all supported OSs
@@ -368,7 +369,7 @@ describe 'opendaylight' do
 
       # Run test that specialize in checking ODL REST port config
       # Note that this function is defined in spec_helper
-      odl_rest_port_tests(odl_rest_port: 7777)
+      odl_rest_port_tests(odl_rest_port: 7777, odl_bind_ip: '127.0.0.1')
     end
   end
 
@@ -444,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,
@@ -465,11 +467,11 @@ 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 'customizing size' do
+    context 'log to file customizing size' do
       let(:facts) {{
         :osfamily => osfamily,
         :operatingsystem => operatingsystem,
@@ -484,11 +486,11 @@ describe 'opendaylight' do
       # 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_max_size: '1GB')
     end
 
-    context 'customizing rollover' do
+    context 'log to file customizing rollover' do
       let(:facts) {{
         :osfamily => osfamily,
         :operatingsystem => operatingsystem,
@@ -503,11 +505,11 @@ describe 'opendaylight' do
       # 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_max_rollover: 3)
     end
 
-    context 'customizing size and rollover' do
+    context 'log to file customizing size and rollover' do
       let(:facts) {{
         :osfamily => osfamily,
         :operatingsystem => operatingsystem,
@@ -523,10 +525,29 @@ describe 'opendaylight' do
       # 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_max_size: '1GB',
                         log_max_rollover: 3)
     end
+
+    context 'log to console' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{
+        :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 settings
+      log_settings(log_mechanism: 'console')
+    end
   end
 
   # All OVSDB HA enable/disable tests
@@ -635,7 +656,7 @@ describe 'opendaylight' do
       operatingsystemrelease = '7.0'
       operatingsystemmajrelease = '7'
 
-      context 'installing default RPM' do
+      context 'installing from default repo' do
         let(:facts) {{
           :osfamily => osfamily,
           :operatingsystem => operatingsystem,
@@ -651,8 +672,8 @@ describe 'opendaylight' do
         rpm_install_tests
       end
 
-      context 'installing Beryllium RPM' do
-        rpm_repo = 'opendaylight-40-release'
+      context 'installing from Nexus repo' do
+        rpm_repo = 'https://nexus.opendaylight.org/content/repositories/opendaylight-fluorine-epel-7-$basearch-devel'
         let(:facts) {{
           :osfamily => osfamily,
           :operatingsystem => operatingsystem,
@@ -703,8 +724,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,
@@ -730,28 +751,25 @@ describe 'opendaylight' do
         deb_install_tests(deb_repo: deb_repo)
       end
     end
-
   end
 
-  # Security Group Tests
-  describe 'security group tests' do
+  # SNAT Mechanism tests
+  describe 'SNAT mechanism 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 'using supported stateful' do
+    context 'using controller' do
       let(:facts) {{
         :osfamily => osfamily,
         :operatingsystem => operatingsystem,
         :operatingsystemmajrelease => operatingsystemmajrelease,
-        :operatingsystemrelease => '7.3',
       }}
 
       let(:params) {{
-        :security_group_mode => 'stateful',
-        :extra_features      => ['odl-netvirt-openstack'],
+        :extra_features => ['odl-netvirt-openstack'],
       }}
 
       # Run shared tests applicable to all supported OSs
@@ -760,20 +778,19 @@ describe 'opendaylight' do
 
       # Run test that specialize in checking security groups
       # Note that this function is defined in spec_helper
-      enable_sg_tests('stateful', '7.3')
+      snat_mechanism_tests
     end
 
-    context 'using unsupported stateful' do
+    context 'using conntrack' do
       let(:facts) {{
         :osfamily => osfamily,
         :operatingsystem => operatingsystem,
         :operatingsystemmajrelease => operatingsystemmajrelease,
-        :operatingsystemrelease => '7.2.1511',
       }}
 
       let(:params) {{
-        :security_group_mode => 'stateful',
-        :extra_features      => ['odl-netvirt-openstack'],
+        :snat_mechanism => 'conntrack',
+        :extra_features => ['odl-netvirt-openstack'],
       }}
 
       # Run shared tests applicable to all supported OSs
@@ -782,21 +799,26 @@ describe 'opendaylight' do
 
       # Run test that specialize in checking security groups
       # Note that this function is defined in spec_helper
-      enable_sg_tests('stateful', '7.2.1511')
+      snat_mechanism_tests('conntrack')
     end
+  end
 
-    context 'using transparent with unsupported stateful' do
+  # SFC tests
+  describe 'SFC 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 'not using odl-netvirt-sfc feature' do
       let(:facts) {{
         :osfamily => osfamily,
         :operatingsystem => operatingsystem,
         :operatingsystemmajrelease => operatingsystemmajrelease,
-        :operatingsystemrelease => '7.2.1511',
       }}
 
-      let(:params) {{
-        :security_group_mode => 'transparent',
-        :extra_features      => ['odl-netvirt-openstack'],
-      }}
+      let(:params) {{ }}
 
       # Run shared tests applicable to all supported OSs
       # Note that this function is defined in spec_helper
@@ -804,19 +826,10 @@ describe 'opendaylight' do
 
       # Run test that specialize in checking security groups
       # Note that this function is defined in spec_helper
-      enable_sg_tests('transparent', '7.2.1511')
+      sfc_tests
     end
-  end
 
-  # SNAT Mechanism tests
-  describe 'SNAT mechanism 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 controller' do
+    context 'using odl-netvirt-sfc feature' do
       let(:facts) {{
         :osfamily => osfamily,
         :operatingsystem => operatingsystem,
@@ -824,7 +837,7 @@ describe 'opendaylight' do
       }}
 
       let(:params) {{
-        :extra_features => ['odl-netvirt-openstack'],
+        :extra_features => ['odl-netvirt-sfc'],
       }}
 
       # Run shared tests applicable to all supported OSs
@@ -833,20 +846,26 @@ describe 'opendaylight' do
 
       # Run test that specialize in checking security groups
       # Note that this function is defined in spec_helper
-      snat_mechanism_tests
+      sfc_tests(extra_features: ['odl-netvirt-sfc'])
     end
+  end
 
-    context 'using conntrack' do
+  # 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) {{
-        :snat_mechanism => 'conntrack',
-        :extra_features => ['odl-netvirt-openstack'],
-      }}
+      let(:params) {{ }}
 
       # Run shared tests applicable to all supported OSs
       # Note that this function is defined in spec_helper
@@ -854,19 +873,10 @@ describe 'opendaylight' do
 
       # Run test that specialize in checking security groups
       # Note that this function is defined in spec_helper
-      snat_mechanism_tests('conntrack')
+      dscp_tests
     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
+    context 'inherit DSCP values' do
       let(:facts) {{
         :osfamily => osfamily,
         :operatingsystem => operatingsystem,
@@ -874,7 +884,7 @@ describe 'opendaylight' do
       }}
 
       let(:params) {{
-        :extra_features => ['odl-netvirt-sfc'],
+        :inherit_dscp_marking => :true,
       }}
 
       # Run shared tests applicable to all supported OSs
@@ -883,7 +893,7 @@ describe 'opendaylight' do
 
       # Run test that specialize in checking security groups
       # Note that this function is defined in spec_helper
-      sfc_tests
+      dscp_tests(inherit_dscp_marking: true)
     end
   end
 
@@ -981,4 +991,96 @@ describe 'opendaylight' do
       username_password_tests('test', 'test')
     end
   end
+
+  # websocket address tests
+  describe 'ODL websocket address 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 'using default websocket address' 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 websocket address
+      # Note that this function is defined in spec_helper
+      odl_websocket_address_tests
+    end
+
+    context 'overriding websocket address' 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
+
+      # Run test that specialize in checking websocket address
+      # Note that this function is defined in spec_helper
+      odl_websocket_address_tests(odl_bind_ip: '127.0.0.1')
+    end
+  end
+
+  # TLS tests
+  describe 'ODL TLS 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 'enabling TLS without required keystore password (negative test)' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{
+       :enable_tls => :true
+       }}
+
+      # Run test that specialize in checking TLS
+      # Note that this function is defined in spec_helper
+      odl_tls_tests(enable_tls:true)
+    end
+    context 'enabling TLS with required params' do
+      let(:facts) {{
+        :osfamily => osfamily,
+        :operatingsystem => operatingsystem,
+        :operatingsystemmajrelease => operatingsystemmajrelease,
+      }}
+
+      let(:params) {{
+       :enable_tls => true,
+       :tls_keystore_password => '123456',
+       }}
+
+      # 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 TLS
+      # Note that this function is defined in spec_helper
+      odl_tls_tests(enable_tls:true, tls_keystore_password:'123456')
+    end
+  end
 end