Merge "Add configuration to enable/disable L7,L4 protocols"
diff --git a/octavia_tempest_plugin/config.py b/octavia_tempest_plugin/config.py
index 1bc4a63..628664b 100644
--- a/octavia_tempest_plugin/config.py
+++ b/octavia_tempest_plugin/config.py
@@ -176,4 +176,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..e65dd99 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,
         }
@@ -211,7 +214,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,
@@ -710,7 +714,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,
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))