Merge "Adds provider API tests"
diff --git a/octavia_tempest_plugin/config.py b/octavia_tempest_plugin/config.py
index 905dc9c..91aa2c4 100644
--- a/octavia_tempest_plugin/config.py
+++ b/octavia_tempest_plugin/config.py
@@ -186,4 +186,12 @@
                 default=True,
                 help="Whether TLS termination is available with provider "
                      "driver or not."),
+    cfg.BoolOpt('l7_protocol_enabled',
+                default=True,
+                help="Whether L7 Protocols are available with the provider"
+                     " driver or not."),
+    cfg.StrOpt('l4_protocol',
+               default="TCP",
+               help="The type of L4 Protocol which is supported with the"
+                    " provider driver."),
 ]
diff --git a/octavia_tempest_plugin/tests/api/v2/test_l7policy.py b/octavia_tempest_plugin/tests/api/v2/test_l7policy.py
index 255bbde..eeb22bf 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_l7policy.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_l7policy.py
@@ -32,6 +32,15 @@
     """Test the l7policy object API."""
 
     @classmethod
+    def skip_checks(cls):
+        super(L7PolicyAPITest, cls).skip_checks()
+        if not CONF.loadbalancer_feature_enabled.l7_protocol_enabled:
+            cls.skipException('[loadbalancer-feature-enabled] '
+                              '"l7_protocol_enabled" is set to False in the '
+                              'Tempest configuration. L7 Scenario tests will '
+                              'be skipped.')
+
+    @classmethod
     def resource_setup(cls):
         """Setup resources needed by the tests."""
         super(L7PolicyAPITest, cls).resource_setup()
diff --git a/octavia_tempest_plugin/tests/api/v2/test_l7rule.py b/octavia_tempest_plugin/tests/api/v2/test_l7rule.py
index 395a3ad..a75b157 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_l7rule.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_l7rule.py
@@ -30,6 +30,14 @@
 
 class L7RuleAPITest(test_base.LoadBalancerBaseTest):
     """Test the l7rule object API."""
+    @classmethod
+    def skip_checks(cls):
+        super(L7RuleAPITest, cls).skip_checks()
+        if not CONF.loadbalancer_feature_enabled.l7_protocol_enabled:
+            cls.skipException('[loadbalancer-feature-enabled]'
+                              ' "l7_protocol_enabled" is set to False in the'
+                              ' Tempest configuration.L7 Scenario tests would'
+                              ' be skipped.')
 
     @classmethod
     def resource_setup(cls):
diff --git a/octavia_tempest_plugin/tests/api/v2/test_listener.py b/octavia_tempest_plugin/tests/api/v2/test_listener.py
index 38da0ae..928ecfb 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_listener.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_listener.py
@@ -42,6 +42,10 @@
                      const.NAME: lb_name}
 
         cls._setup_lb_network_kwargs(lb_kwargs)
+        cls.protocol = const.HTTP
+        lb_feature_enabled = CONF.loadbalancer_feature_enabled
+        if not lb_feature_enabled.l7_protocol_enabled:
+            cls.protocol = lb_feature_enabled.l4_protocol
 
         lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs)
         cls.lb_id = lb[const.ID]
@@ -72,7 +76,7 @@
             const.NAME: listener_name,
             const.DESCRIPTION: listener_description,
             const.ADMIN_STATE_UP: True,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: self.protocol,
             const.PROTOCOL_PORT: 80,
             const.LOADBALANCER_ID: self.lb_id,
             const.CONNECTION_LIMIT: 200,
@@ -142,7 +146,7 @@
             self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
         else:
             self.assertEqual(const.ONLINE, listener[const.OPERATING_STATUS])
-        self.assertEqual(const.HTTP, listener[const.PROTOCOL])
+        self.assertEqual(self.protocol, listener[const.PROTOCOL])
         self.assertEqual(80, listener[const.PROTOCOL_PORT])
         self.assertEqual(200, listener[const.CONNECTION_LIMIT])
         insert_headers = listener[const.INSERT_HEADERS]
@@ -194,7 +198,7 @@
             const.NAME: listener1_name,
             const.DESCRIPTION: listener1_desc,
             const.ADMIN_STATE_UP: True,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: self.protocol,
             const.PROTOCOL_PORT: 80,
             const.LOADBALANCER_ID: lb_id,
         }
@@ -226,7 +230,7 @@
             const.NAME: listener2_name,
             const.DESCRIPTION: listener2_desc,
             const.ADMIN_STATE_UP: True,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: self.protocol,
             const.PROTOCOL_PORT: 81,
             const.LOADBALANCER_ID: lb_id,
         }
@@ -258,7 +262,7 @@
             const.NAME: listener3_name,
             const.DESCRIPTION: listener3_desc,
             const.ADMIN_STATE_UP: False,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: self.protocol,
             const.PROTOCOL_PORT: 82,
             const.LOADBALANCER_ID: lb_id,
         }
@@ -420,7 +424,7 @@
             const.NAME: listener_name,
             const.DESCRIPTION: listener_description,
             const.ADMIN_STATE_UP: True,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: self.protocol,
             const.PROTOCOL_PORT: 81,
             const.LOADBALANCER_ID: self.lb_id,
             const.CONNECTION_LIMIT: 200,
@@ -479,7 +483,7 @@
             self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
         else:
             self.assertEqual(const.ONLINE, listener[const.OPERATING_STATUS])
-        self.assertEqual(const.HTTP, listener[const.PROTOCOL])
+        self.assertEqual(self.protocol, listener[const.PROTOCOL])
         self.assertEqual(81, listener[const.PROTOCOL_PORT])
         self.assertEqual(200, listener[const.CONNECTION_LIMIT])
         insert_headers = listener[const.INSERT_HEADERS]
@@ -542,7 +546,7 @@
             const.NAME: listener_name,
             const.DESCRIPTION: listener_description,
             const.ADMIN_STATE_UP: False,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: self.protocol,
             const.PROTOCOL_PORT: 82,
             const.LOADBALANCER_ID: self.lb_id,
             const.CONNECTION_LIMIT: 200,
@@ -590,7 +594,7 @@
         UUID(listener[const.ID])
         # Operating status will be OFFLINE while admin_state_up = False
         self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
-        self.assertEqual(const.HTTP, listener[const.PROTOCOL])
+        self.assertEqual(self.protocol, listener[const.PROTOCOL])
         self.assertEqual(82, listener[const.PROTOCOL_PORT])
         self.assertEqual(200, listener[const.CONNECTION_LIMIT])
         insert_headers = listener[const.INSERT_HEADERS]
@@ -717,7 +721,7 @@
 
         listener_kwargs = {
             const.NAME: listener_name,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: self.protocol,
             const.PROTOCOL_PORT: 83,
             const.LOADBALANCER_ID: self.lb_id,
         }
diff --git a/octavia_tempest_plugin/tests/api/v2/test_member.py b/octavia_tempest_plugin/tests/api/v2/test_member.py
index 18073cc..a84e121 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_member.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_member.py
@@ -40,8 +40,11 @@
         lb_name = data_utils.rand_name("lb_member_lb1_member")
         lb_kwargs = {const.PROVIDER: CONF.load_balancer.provider,
                      const.NAME: lb_name}
-
         cls._setup_lb_network_kwargs(lb_kwargs)
+        cls.protocol = const.HTTP
+        lb_feature_enabled = CONF.loadbalancer_feature_enabled
+        if not lb_feature_enabled.l7_protocol_enabled:
+            cls.protocol = lb_feature_enabled.l4_protocol
 
         lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs)
         cls.lb_id = lb[const.ID]
@@ -58,7 +61,7 @@
         listener_name = data_utils.rand_name("lb_member_listener1_member")
         listener_kwargs = {
             const.NAME: listener_name,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: cls.protocol,
             const.PROTOCOL_PORT: '80',
             const.LOADBALANCER_ID: cls.lb_id,
         }
@@ -78,7 +81,7 @@
         pool_name = data_utils.rand_name("lb_member_pool1_member")
         pool_kwargs = {
             const.NAME: pool_name,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: cls.protocol,
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
             const.LISTENER_ID: cls.listener_id,
         }
@@ -96,6 +99,14 @@
                                 CONF.load_balancer.build_interval,
                                 CONF.load_balancer.build_timeout)
 
+    def _create_member_and_get_monitor_status(self, **member_kwargs):
+        monitor = CONF.loadbalancer_feature_enabled.health_monitor_enabled
+        if not monitor:
+            del member_kwargs[const.MONITOR_ADDRESS]
+            del member_kwargs[const.MONITOR_PORT]
+        member = self.mem_member_client.create_member(**member_kwargs)
+        return member, monitor
+
     # Note: This test also covers basic member show API
     @decorators.idempotent_id('0623aa1f-753d-44e7-afa1-017d274eace7')
     def test_member_ipv4_create(self):
@@ -114,6 +125,7 @@
         * Tests that users without the loadbalancer member role cannot
           create members.
         * Create a fully populated member.
+        * If driver doesnt support Monitors, allow to create without monitor
         * Show member details.
         * Validate the show reflects the requested values.
         """
@@ -153,7 +165,9 @@
                 self.os_primary.member_client.create_member,
                 **member_kwargs)
 
-        member = self.mem_member_client.create_member(**member_kwargs)
+        member, monitor = self._create_member_and_get_monitor_status(
+            **member_kwargs)
+
         self.addClassResourceCleanup(
             self.mem_member_client.cleanup_member,
             member[const.ID], pool_id=self.pool_id,
@@ -178,13 +192,13 @@
         self.assertEqual(const.NO_MONITOR, member[const.OPERATING_STATUS])
 
         equal_items = [const.NAME, const.ADMIN_STATE_UP, const.ADDRESS,
-                       const.PROTOCOL_PORT, const.WEIGHT,
-                       const.MONITOR_ADDRESS, const.MONITOR_PORT]
-
+                       const.PROTOCOL_PORT, const.WEIGHT]
         if self.mem_member_client.is_version_supported(
                 self.api_version, '2.1'):
             equal_items.append(const.BACKUP)
 
+        if monitor:
+            equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
         if const.SUBNET_ID in member_kwargs:
             equal_items.append(const.SUBNET_ID)
         else:
@@ -211,7 +225,8 @@
         pool_name = data_utils.rand_name("lb_member_pool2_member-list")
         pool = self.mem_pool_client.create_pool(
             name=pool_name, loadbalancer_id=self.lb_id,
-            protocol=const.HTTP, lb_algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
+            protocol=self.protocol,
+            lb_algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
         pool_id = pool[const.ID]
         self.addCleanup(
             self.mem_pool_client.cleanup_pool, pool_id,
@@ -447,7 +462,9 @@
             member_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
                 const.ID]
 
-        member = self.mem_member_client.create_member(**member_kwargs)
+        member, monitor = self._create_member_and_get_monitor_status(
+            **member_kwargs)
+
         self.addClassResourceCleanup(
             self.mem_member_client.cleanup_member,
             member[const.ID], pool_id=self.pool_id,
@@ -472,13 +489,14 @@
         self.assertEqual(const.NO_MONITOR, member[const.OPERATING_STATUS])
 
         equal_items = [const.NAME, const.ADMIN_STATE_UP, const.ADDRESS,
-                       const.PROTOCOL_PORT, const.WEIGHT,
-                       const.MONITOR_ADDRESS, const.MONITOR_PORT]
+                       const.PROTOCOL_PORT, const.WEIGHT]
 
         if self.mem_member_client.is_version_supported(
                 self.api_version, '2.1'):
             equal_items.append(const.BACKUP)
 
+        if monitor:
+            equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
         if const.SUBNET_ID in member_kwargs:
             equal_items.append(const.SUBNET_ID)
         else:
@@ -549,7 +567,9 @@
             member_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
                 const.ID]
 
-        member = self.mem_member_client.create_member(**member_kwargs)
+        member, monitor = self._create_member_and_get_monitor_status(
+            **member_kwargs)
+
         self.addClassResourceCleanup(
             self.mem_member_client.cleanup_member,
             member[const.ID], pool_id=self.pool_id,
@@ -567,27 +587,30 @@
             CONF.load_balancer.build_interval,
             CONF.load_balancer.build_timeout,
             pool_id=self.pool_id)
-        if not CONF.load_balancer.test_with_noop:
-            member = waiters.wait_for_status(
-                self.mem_member_client.show_member,
-                member[const.ID], const.OPERATING_STATUS,
-                const.OFFLINE,
-                CONF.load_balancer.build_interval,
-                CONF.load_balancer.build_timeout,
-                pool_id=self.pool_id)
+        status = const.OFFLINE
+        if not monitor or CONF.load_balancer.test_with_noop:
+            status = const.NO_MONITOR
+        member = waiters.wait_for_status(
+            self.mem_member_client.show_member,
+            member[const.ID], const.OPERATING_STATUS,
+            status,
+            CONF.load_balancer.build_interval,
+            CONF.load_balancer.build_timeout,
+            pool_id=self.pool_id)
 
         parser.parse(member[const.CREATED_AT])
         parser.parse(member[const.UPDATED_AT])
         UUID(member[const.ID])
 
         equal_items = [const.NAME, const.ADMIN_STATE_UP, const.ADDRESS,
-                       const.PROTOCOL_PORT, const.WEIGHT,
-                       const.MONITOR_ADDRESS, const.MONITOR_PORT]
+                       const.PROTOCOL_PORT, const.WEIGHT]
 
         if self.mem_member_client.is_version_supported(
                 self.api_version, '2.1'):
             equal_items.append(const.BACKUP)
 
+        if monitor:
+            equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
         if const.SUBNET_ID in member_kwargs:
             equal_items.append(const.SUBNET_ID)
         else:
@@ -596,8 +619,9 @@
         for item in equal_items:
             self.assertEqual(member_kwargs[item], member[item])
 
-        if CONF.load_balancer.test_with_noop:
-            # Operating status with noop will stay in NO_MONITOR
+        if CONF.load_balancer.test_with_noop or not monitor:
+            # Operating status with noop or Driver not supporting Monitors
+            # will stay in NO_MONITOR
             self.assertEqual(const.NO_MONITOR, member[const.OPERATING_STATUS])
         else:
             # Operating status will be OFFLINE while admin_state_up = False
@@ -642,18 +666,18 @@
             const.NAME: new_name,
             const.ADMIN_STATE_UP: not member[const.ADMIN_STATE_UP],
             const.WEIGHT: member[const.WEIGHT] + 1,
-            const.MONITOR_ADDRESS: '192.0.2.3',
-            const.MONITOR_PORT: member[const.MONITOR_PORT] + 1,
         }
         if self.mem_member_client.is_version_supported(
                 self.api_version, '2.1'):
             member_update_kwargs.update({
                 const.BACKUP: not member[const.BACKUP]
             })
-
+        if monitor:
+            member_update_kwargs[const.MONITOR_ADDRESS] = '192.0.2.3'
+            member_update_kwargs[const.MONITOR_PORT] = member[
+                const.MONITOR_PORT] + 1
         member = self.mem_member_client.update_member(
             member[const.ID], **member_update_kwargs)
-
         waiters.wait_for_status(
             self.mem_lb_client.show_loadbalancer, self.lb_id,
             const.PROVISIONING_STATUS, const.ACTIVE,
@@ -679,13 +703,14 @@
         self.assertEqual(const.NO_MONITOR, member[const.OPERATING_STATUS])
 
         # Test changed items
-        equal_items = [const.NAME, const.ADMIN_STATE_UP, const.WEIGHT,
-                       const.MONITOR_ADDRESS, const.MONITOR_PORT]
+        equal_items = [const.NAME, const.ADMIN_STATE_UP, const.WEIGHT]
 
         if self.mem_member_client.is_version_supported(
                 self.api_version, '2.1'):
             equal_items.append(const.BACKUP)
 
+        if monitor:
+            equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
         for item in equal_items:
             self.assertEqual(member_update_kwargs[item], member[item])
 
@@ -710,7 +735,8 @@
         pool_name = data_utils.rand_name("lb_member_pool3_member-batch")
         pool = self.mem_pool_client.create_pool(
             name=pool_name, loadbalancer_id=self.lb_id,
-            protocol=const.HTTP, lb_algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
+            protocol=self.protocol,
+            lb_algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
         pool_id = pool[const.ID]
         self.addClassResourceCleanup(
             self.mem_pool_client.cleanup_pool, pool_id,
@@ -743,8 +769,9 @@
         if self.lb_member_vip_subnet:
             member1_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
                 const.ID]
+        member1, monitor = self._create_member_and_get_monitor_status(
+            **member1_kwargs)
 
-        member1 = self.mem_member_client.create_member(**member1_kwargs)
         self.addClassResourceCleanup(
             self.mem_member_client.cleanup_member,
             member1[const.ID], pool_id=pool_id,
@@ -765,8 +792,6 @@
             const.ADDRESS: '192.0.2.3',
             const.PROTOCOL_PORT: 81,
             const.WEIGHT: 51,
-            const.MONITOR_ADDRESS: '192.0.2.4',
-            const.MONITOR_PORT: 8081,
         }
         if self.mem_member_client.is_version_supported(
                 self.api_version, '2.1'):
@@ -774,6 +799,9 @@
                 const.BACKUP: True,
             })
 
+        if monitor:
+            member2_kwargs[const.MONITOR_ADDRESS] = '192.0.2.4'
+            member2_kwargs[const.MONITOR_PORT] = 8081
         if self.lb_member_vip_subnet:
             member2_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
                 const.ID]
@@ -798,8 +826,6 @@
             const.ADDRESS: '192.0.2.5',
             const.PROTOCOL_PORT: 82,
             const.WEIGHT: 52,
-            const.MONITOR_ADDRESS: '192.0.2.6',
-            const.MONITOR_PORT: 8082,
         }
         if self.mem_member_client.is_version_supported(
                 self.api_version, '2.1'):
@@ -807,6 +833,9 @@
                 const.BACKUP: True,
             })
 
+        if monitor:
+            member2_kwargs[const.MONITOR_ADDRESS] = '192.0.2.6'
+            member2_kwargs[const.MONITOR_PORT] = 8082
         if self.lb_member_vip_subnet:
             member3_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
                 const.ID]
diff --git a/octavia_tempest_plugin/tests/api/v2/test_pool.py b/octavia_tempest_plugin/tests/api/v2/test_pool.py
index 28b95b6..63d9e46 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_pool.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_pool.py
@@ -39,8 +39,11 @@
         lb_name = data_utils.rand_name("lb_member_lb1_pool")
         lb_kwargs = {const.PROVIDER: CONF.load_balancer.provider,
                      const.NAME: lb_name}
-
         cls._setup_lb_network_kwargs(lb_kwargs)
+        cls.protocol = const.HTTP
+        lb_feature_enabled = CONF.loadbalancer_feature_enabled
+        if not lb_feature_enabled.l7_protocol_enabled:
+            cls.protocol = lb_feature_enabled.l4_protocol
 
         lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs)
         cls.lb_id = lb[const.ID]
@@ -57,7 +60,7 @@
         listener_name = data_utils.rand_name("lb_member_listener1_pool")
         listener_kwargs = {
             const.NAME: listener_name,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: cls.protocol,
             const.PROTOCOL_PORT: '80',
             const.LOADBALANCER_ID: cls.lb_id,
         }
@@ -98,7 +101,7 @@
             const.NAME: pool_name,
             const.DESCRIPTION: pool_description,
             const.ADMIN_STATE_UP: True,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: self.protocol,
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
             const.SESSION_PERSISTENCE: {
                 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -156,7 +159,7 @@
         else:
             # OFFLINE if it is just on the LB directly or is in noop mode
             self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS])
-        self.assertEqual(const.HTTP, pool[const.PROTOCOL])
+        self.assertEqual(self.protocol, pool[const.PROTOCOL])
         self.assertEqual(1, len(pool[const.LOADBALANCERS]))
         self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
         if has_listener:
@@ -211,7 +214,7 @@
             const.NAME: pool1_name,
             const.DESCRIPTION: pool1_desc,
             const.ADMIN_STATE_UP: True,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: self.protocol,
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
             const.SESSION_PERSISTENCE: {
                 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -248,7 +251,7 @@
             const.NAME: pool2_name,
             const.DESCRIPTION: pool2_desc,
             const.ADMIN_STATE_UP: True,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: self.protocol,
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
             const.SESSION_PERSISTENCE: {
                 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -284,7 +287,7 @@
             const.NAME: pool3_name,
             const.DESCRIPTION: pool3_desc,
             const.ADMIN_STATE_UP: False,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: self.protocol,
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
             # No session persistence, just so there's one test for that
             const.LOADBALANCER_ID: lb_id,
@@ -425,7 +428,7 @@
             const.NAME: pool_name,
             const.DESCRIPTION: pool_description,
             const.ADMIN_STATE_UP: True,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: self.protocol,
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
             const.SESSION_PERSISTENCE: {
                 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -460,7 +463,7 @@
         UUID(pool[const.ID])
         # Operating status for pools will always be offline without members
         self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS])
-        self.assertEqual(const.HTTP, pool[const.PROTOCOL])
+        self.assertEqual(self.protocol, pool[const.PROTOCOL])
         self.assertEqual(1, len(pool[const.LOADBALANCERS]))
         self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
         self.assertEmpty(pool[const.LISTENERS])
@@ -519,7 +522,7 @@
             const.NAME: pool_name,
             const.DESCRIPTION: pool_description,
             const.ADMIN_STATE_UP: False,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: self.protocol,
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
             const.SESSION_PERSISTENCE: {
                 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -554,7 +557,7 @@
         UUID(pool[const.ID])
         # Operating status for pools will always be offline without members
         self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS])
-        self.assertEqual(const.HTTP, pool[const.PROTOCOL])
+        self.assertEqual(self.protocol, pool[const.PROTOCOL])
         self.assertEqual(1, len(pool[const.LOADBALANCERS]))
         self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
         self.assertEmpty(pool[const.LISTENERS])
@@ -667,7 +670,7 @@
         pool_sp_cookie_name = 'my_cookie'
         pool_kwargs = {
             const.NAME: pool_name,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: self.protocol,
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
             const.SESSION_PERSISTENCE: {
                 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
diff --git a/octavia_tempest_plugin/tests/scenario/v2/test_l7policy.py b/octavia_tempest_plugin/tests/scenario/v2/test_l7policy.py
index 9e09f35..c39a6c6 100644
--- a/octavia_tempest_plugin/tests/scenario/v2/test_l7policy.py
+++ b/octavia_tempest_plugin/tests/scenario/v2/test_l7policy.py
@@ -29,6 +29,15 @@
 class L7PolicyScenarioTest(test_base.LoadBalancerBaseTest):
 
     @classmethod
+    def skip_checks(cls):
+        super(L7PolicyScenarioTest, cls).skip_checks()
+        if not CONF.loadbalancer_feature_enabled.l7_protocol_enabled:
+            cls.skipException('[loadbalancer-feature-enabled] '
+                              '"l7_protocol_enabled" is set to False in the '
+                              'Tempest configuration. L7 Scenario tests will '
+                              'be skipped.')
+
+    @classmethod
     def resource_setup(cls):
         """Setup resources needed by the tests."""
         super(L7PolicyScenarioTest, cls).resource_setup()
diff --git a/octavia_tempest_plugin/tests/scenario/v2/test_l7rule.py b/octavia_tempest_plugin/tests/scenario/v2/test_l7rule.py
index 114ea3e..5c322ab 100644
--- a/octavia_tempest_plugin/tests/scenario/v2/test_l7rule.py
+++ b/octavia_tempest_plugin/tests/scenario/v2/test_l7rule.py
@@ -29,6 +29,15 @@
 class L7RuleScenarioTest(test_base.LoadBalancerBaseTest):
 
     @classmethod
+    def skip_checks(cls):
+        super(L7RuleScenarioTest, cls).skip_checks()
+        if not CONF.loadbalancer_feature_enabled.l7_protocol_enabled:
+            cls.skipException('[loadbalancer-feature-enabled] '
+                              '"l7_protocol_enabled" is set to False in the '
+                              'Tempest configuration. L7 Scenario tests will '
+                              'be skipped.')
+
+    @classmethod
     def resource_setup(cls):
         """Setup resources needed by the tests."""
         super(L7RuleScenarioTest, cls).resource_setup()
diff --git a/octavia_tempest_plugin/tests/scenario/v2/test_listener.py b/octavia_tempest_plugin/tests/scenario/v2/test_listener.py
index 7720d27..c504ea2 100644
--- a/octavia_tempest_plugin/tests/scenario/v2/test_listener.py
+++ b/octavia_tempest_plugin/tests/scenario/v2/test_listener.py
@@ -51,11 +51,15 @@
                                 const.ACTIVE,
                                 CONF.load_balancer.lb_build_interval,
                                 CONF.load_balancer.lb_build_timeout)
+        cls.protocol = const.HTTP
+        lb_feature_enabled = CONF.loadbalancer_feature_enabled
+        if not lb_feature_enabled.l7_protocol_enabled:
+            cls.protocol = lb_feature_enabled.l4_protocol
 
         pool1_name = data_utils.rand_name("lb_member_pool1_listener")
         pool1_kwargs = {
             const.NAME: pool1_name,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: cls.protocol,
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
             const.LOADBALANCER_ID: cls.lb_id,
         }
@@ -75,7 +79,7 @@
         pool2_name = data_utils.rand_name("lb_member_pool2_listener")
         pool2_kwargs = {
             const.NAME: pool2_name,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: cls.protocol,
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
             const.LOADBALANCER_ID: cls.lb_id,
         }
@@ -109,7 +113,7 @@
             const.NAME: listener_name,
             const.DESCRIPTION: listener_description,
             const.ADMIN_STATE_UP: False,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: self.protocol,
             const.PROTOCOL_PORT: 80,
             const.LOADBALANCER_ID: self.lb_id,
             const.CONNECTION_LIMIT: 200,
@@ -157,7 +161,7 @@
         UUID(listener[const.ID])
         # Operating status will be OFFLINE while admin_state_up = False
         self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
-        self.assertEqual(const.HTTP, listener[const.PROTOCOL])
+        self.assertEqual(self.protocol, listener[const.PROTOCOL])
         self.assertEqual(80, listener[const.PROTOCOL_PORT])
         self.assertEqual(200, listener[const.CONNECTION_LIMIT])
         insert_headers = listener[const.INSERT_HEADERS]
@@ -230,7 +234,7 @@
             self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
         else:
             self.assertEqual(const.ONLINE, listener[const.OPERATING_STATUS])
-        self.assertEqual(const.HTTP, listener[const.PROTOCOL])
+        self.assertEqual(self.protocol, listener[const.PROTOCOL])
         self.assertEqual(80, listener[const.PROTOCOL_PORT])
         self.assertEqual(400, listener[const.CONNECTION_LIMIT])
         insert_headers = listener[const.INSERT_HEADERS]
diff --git a/octavia_tempest_plugin/tests/scenario/v2/test_member.py b/octavia_tempest_plugin/tests/scenario/v2/test_member.py
index 6bd18de..d5c1b1b 100644
--- a/octavia_tempest_plugin/tests/scenario/v2/test_member.py
+++ b/octavia_tempest_plugin/tests/scenario/v2/test_member.py
@@ -50,11 +50,15 @@
                                 const.ACTIVE,
                                 CONF.load_balancer.lb_build_interval,
                                 CONF.load_balancer.lb_build_timeout)
+        protocol = const.HTTP
+        lb_feature_enabled = CONF.loadbalancer_feature_enabled
+        if not lb_feature_enabled.l7_protocol_enabled:
+            cls.protocol = lb_feature_enabled.l4_protocol
 
         listener_name = data_utils.rand_name("lb_member_listener1_member")
         listener_kwargs = {
             const.NAME: listener_name,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: protocol,
             const.PROTOCOL_PORT: '80',
             const.LOADBALANCER_ID: cls.lb_id,
         }
@@ -74,7 +78,7 @@
         pool_name = data_utils.rand_name("lb_member_pool1_member")
         pool_kwargs = {
             const.NAME: pool_name,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: protocol,
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
             const.LISTENER_ID: cls.listener_id,
         }
diff --git a/octavia_tempest_plugin/tests/scenario/v2/test_pool.py b/octavia_tempest_plugin/tests/scenario/v2/test_pool.py
index cd26687..1cdd727 100644
--- a/octavia_tempest_plugin/tests/scenario/v2/test_pool.py
+++ b/octavia_tempest_plugin/tests/scenario/v2/test_pool.py
@@ -50,11 +50,15 @@
                                 const.ACTIVE,
                                 CONF.load_balancer.lb_build_interval,
                                 CONF.load_balancer.lb_build_timeout)
+        cls.protocol = const.HTTP
+        lb_feature_enabled = CONF.loadbalancer_feature_enabled
+        if not lb_feature_enabled.l7_protocol_enabled:
+            cls.protocol = lb_feature_enabled.l4_protocol
 
         listener_name = data_utils.rand_name("lb_member_listener1_pool")
         listener_kwargs = {
             const.NAME: listener_name,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: cls.protocol,
             const.PROTOCOL_PORT: '80',
             const.LOADBALANCER_ID: cls.lb_id,
         }
@@ -95,7 +99,7 @@
             const.NAME: pool_name,
             const.DESCRIPTION: pool_description,
             const.ADMIN_STATE_UP: False,
-            const.PROTOCOL: const.HTTP,
+            const.PROTOCOL: self.protocol,
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
             const.SESSION_PERSISTENCE: {
                 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -132,7 +136,7 @@
         parser.parse(pool[const.UPDATED_AT])
         UUID(pool[const.ID])
         self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS])
-        self.assertEqual(const.HTTP, pool[const.PROTOCOL])
+        self.assertEqual(self.protocol, pool[const.PROTOCOL])
         self.assertEqual(1, len(pool[const.LOADBALANCERS]))
         self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
         if has_listener:
@@ -158,10 +162,10 @@
             const.DESCRIPTION: new_description,
             const.ADMIN_STATE_UP: True,
             const.LB_ALGORITHM: const.LB_ALGORITHM_LEAST_CONNECTIONS,
-            const.SESSION_PERSISTENCE: {
-                const.TYPE: const.SESSION_PERSISTENCE_HTTP_COOKIE,
-            },
         }
+        if self.protocol == const.HTTP:
+            pool_update_kwargs[const.SESSION_PERSISTENCE] = {
+                const.TYPE: const.SESSION_PERSISTENCE_HTTP_COOKIE}
         pool = self.mem_pool_client.update_pool(
             pool[const.ID], **pool_update_kwargs)
 
@@ -183,8 +187,9 @@
         self.assertEqual(const.LB_ALGORITHM_LEAST_CONNECTIONS,
                          pool[const.LB_ALGORITHM])
         self.assertIsNotNone(pool.get(const.SESSION_PERSISTENCE))
-        self.assertEqual(const.SESSION_PERSISTENCE_HTTP_COOKIE,
-                         pool[const.SESSION_PERSISTENCE][const.TYPE])
+        if self.protocol == const.HTTP:
+            self.assertEqual(const.SESSION_PERSISTENCE_HTTP_COOKIE,
+                             pool[const.SESSION_PERSISTENCE][const.TYPE])
         self.assertIsNone(
             pool[const.SESSION_PERSISTENCE].get(const.COOKIE_NAME))