summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-01-31 20:30:32 +0000
committerGerrit Code Review <review@openstack.org>2019-01-31 20:30:32 +0000
commita128c99bb3d386d15d9e55a88c83181068865425 (patch)
treea744df3e206cdc1bd370dec6dfaf7c50b23af572
parent08a0ef50bbbbad9dee6a21a76e23bbc09907fbfc (diff)
parent6626f25a81b9e503a3ccedce6455f342de2e0307 (diff)
Merge "Add configuration to enable/disable L7,L4 protocols"
-rw-r--r--octavia_tempest_plugin/config.py8
-rw-r--r--octavia_tempest_plugin/tests/api/v2/test_l7policy.py9
-rw-r--r--octavia_tempest_plugin/tests/api/v2/test_l7rule.py8
-rw-r--r--octavia_tempest_plugin/tests/api/v2/test_listener.py24
-rw-r--r--octavia_tempest_plugin/tests/api/v2/test_member.py15
-rw-r--r--octavia_tempest_plugin/tests/api/v2/test_pool.py27
-rw-r--r--octavia_tempest_plugin/tests/scenario/v2/test_l7policy.py9
-rw-r--r--octavia_tempest_plugin/tests/scenario/v2/test_l7rule.py9
-rw-r--r--octavia_tempest_plugin/tests/scenario/v2/test_listener.py14
-rw-r--r--octavia_tempest_plugin/tests/scenario/v2/test_member.py8
-rw-r--r--octavia_tempest_plugin/tests/scenario/v2/test_pool.py21
11 files changed, 110 insertions, 42 deletions
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 @@ LBFeatureEnabledGroup = [
176 default=True, 176 default=True,
177 help="Whether TLS termination is available with provider " 177 help="Whether TLS termination is available with provider "
178 "driver or not."), 178 "driver or not."),
179 cfg.BoolOpt('l7_protocol_enabled',
180 default=True,
181 help="Whether L7 Protocols are available with the provider"
182 " driver or not."),
183 cfg.StrOpt('l4_protocol',
184 default="TCP",
185 help="The type of L4 Protocol which is supported with the"
186 " provider driver."),
179] 187]
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 @@ class L7PolicyAPITest(test_base.LoadBalancerBaseTest):
32 """Test the l7policy object API.""" 32 """Test the l7policy object API."""
33 33
34 @classmethod 34 @classmethod
35 def skip_checks(cls):
36 super(L7PolicyAPITest, cls).skip_checks()
37 if not CONF.loadbalancer_feature_enabled.l7_protocol_enabled:
38 cls.skipException('[loadbalancer-feature-enabled] '
39 '"l7_protocol_enabled" is set to False in the '
40 'Tempest configuration. L7 Scenario tests will '
41 'be skipped.')
42
43 @classmethod
35 def resource_setup(cls): 44 def resource_setup(cls):
36 """Setup resources needed by the tests.""" 45 """Setup resources needed by the tests."""
37 super(L7PolicyAPITest, cls).resource_setup() 46 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 @@ CONF = config.CONF
30 30
31class L7RuleAPITest(test_base.LoadBalancerBaseTest): 31class L7RuleAPITest(test_base.LoadBalancerBaseTest):
32 """Test the l7rule object API.""" 32 """Test the l7rule object API."""
33 @classmethod
34 def skip_checks(cls):
35 super(L7RuleAPITest, cls).skip_checks()
36 if not CONF.loadbalancer_feature_enabled.l7_protocol_enabled:
37 cls.skipException('[loadbalancer-feature-enabled]'
38 ' "l7_protocol_enabled" is set to False in the'
39 ' Tempest configuration.L7 Scenario tests would'
40 ' be skipped.')
33 41
34 @classmethod 42 @classmethod
35 def resource_setup(cls): 43 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 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
42 const.NAME: lb_name} 42 const.NAME: lb_name}
43 43
44 cls._setup_lb_network_kwargs(lb_kwargs) 44 cls._setup_lb_network_kwargs(lb_kwargs)
45 cls.protocol = const.HTTP
46 lb_feature_enabled = CONF.loadbalancer_feature_enabled
47 if not lb_feature_enabled.l7_protocol_enabled:
48 cls.protocol = lb_feature_enabled.l4_protocol
45 49
46 lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs) 50 lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs)
47 cls.lb_id = lb[const.ID] 51 cls.lb_id = lb[const.ID]
@@ -72,7 +76,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
72 const.NAME: listener_name, 76 const.NAME: listener_name,
73 const.DESCRIPTION: listener_description, 77 const.DESCRIPTION: listener_description,
74 const.ADMIN_STATE_UP: True, 78 const.ADMIN_STATE_UP: True,
75 const.PROTOCOL: const.HTTP, 79 const.PROTOCOL: self.protocol,
76 const.PROTOCOL_PORT: 80, 80 const.PROTOCOL_PORT: 80,
77 const.LOADBALANCER_ID: self.lb_id, 81 const.LOADBALANCER_ID: self.lb_id,
78 const.CONNECTION_LIMIT: 200, 82 const.CONNECTION_LIMIT: 200,
@@ -142,7 +146,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
142 self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS]) 146 self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
143 else: 147 else:
144 self.assertEqual(const.ONLINE, listener[const.OPERATING_STATUS]) 148 self.assertEqual(const.ONLINE, listener[const.OPERATING_STATUS])
145 self.assertEqual(const.HTTP, listener[const.PROTOCOL]) 149 self.assertEqual(self.protocol, listener[const.PROTOCOL])
146 self.assertEqual(80, listener[const.PROTOCOL_PORT]) 150 self.assertEqual(80, listener[const.PROTOCOL_PORT])
147 self.assertEqual(200, listener[const.CONNECTION_LIMIT]) 151 self.assertEqual(200, listener[const.CONNECTION_LIMIT])
148 insert_headers = listener[const.INSERT_HEADERS] 152 insert_headers = listener[const.INSERT_HEADERS]
@@ -194,7 +198,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
194 const.NAME: listener1_name, 198 const.NAME: listener1_name,
195 const.DESCRIPTION: listener1_desc, 199 const.DESCRIPTION: listener1_desc,
196 const.ADMIN_STATE_UP: True, 200 const.ADMIN_STATE_UP: True,
197 const.PROTOCOL: const.HTTP, 201 const.PROTOCOL: self.protocol,
198 const.PROTOCOL_PORT: 80, 202 const.PROTOCOL_PORT: 80,
199 const.LOADBALANCER_ID: lb_id, 203 const.LOADBALANCER_ID: lb_id,
200 } 204 }
@@ -226,7 +230,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
226 const.NAME: listener2_name, 230 const.NAME: listener2_name,
227 const.DESCRIPTION: listener2_desc, 231 const.DESCRIPTION: listener2_desc,
228 const.ADMIN_STATE_UP: True, 232 const.ADMIN_STATE_UP: True,
229 const.PROTOCOL: const.HTTP, 233 const.PROTOCOL: self.protocol,
230 const.PROTOCOL_PORT: 81, 234 const.PROTOCOL_PORT: 81,
231 const.LOADBALANCER_ID: lb_id, 235 const.LOADBALANCER_ID: lb_id,
232 } 236 }
@@ -258,7 +262,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
258 const.NAME: listener3_name, 262 const.NAME: listener3_name,
259 const.DESCRIPTION: listener3_desc, 263 const.DESCRIPTION: listener3_desc,
260 const.ADMIN_STATE_UP: False, 264 const.ADMIN_STATE_UP: False,
261 const.PROTOCOL: const.HTTP, 265 const.PROTOCOL: self.protocol,
262 const.PROTOCOL_PORT: 82, 266 const.PROTOCOL_PORT: 82,
263 const.LOADBALANCER_ID: lb_id, 267 const.LOADBALANCER_ID: lb_id,
264 } 268 }
@@ -420,7 +424,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
420 const.NAME: listener_name, 424 const.NAME: listener_name,
421 const.DESCRIPTION: listener_description, 425 const.DESCRIPTION: listener_description,
422 const.ADMIN_STATE_UP: True, 426 const.ADMIN_STATE_UP: True,
423 const.PROTOCOL: const.HTTP, 427 const.PROTOCOL: self.protocol,
424 const.PROTOCOL_PORT: 81, 428 const.PROTOCOL_PORT: 81,
425 const.LOADBALANCER_ID: self.lb_id, 429 const.LOADBALANCER_ID: self.lb_id,
426 const.CONNECTION_LIMIT: 200, 430 const.CONNECTION_LIMIT: 200,
@@ -479,7 +483,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
479 self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS]) 483 self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
480 else: 484 else:
481 self.assertEqual(const.ONLINE, listener[const.OPERATING_STATUS]) 485 self.assertEqual(const.ONLINE, listener[const.OPERATING_STATUS])
482 self.assertEqual(const.HTTP, listener[const.PROTOCOL]) 486 self.assertEqual(self.protocol, listener[const.PROTOCOL])
483 self.assertEqual(81, listener[const.PROTOCOL_PORT]) 487 self.assertEqual(81, listener[const.PROTOCOL_PORT])
484 self.assertEqual(200, listener[const.CONNECTION_LIMIT]) 488 self.assertEqual(200, listener[const.CONNECTION_LIMIT])
485 insert_headers = listener[const.INSERT_HEADERS] 489 insert_headers = listener[const.INSERT_HEADERS]
@@ -542,7 +546,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
542 const.NAME: listener_name, 546 const.NAME: listener_name,
543 const.DESCRIPTION: listener_description, 547 const.DESCRIPTION: listener_description,
544 const.ADMIN_STATE_UP: False, 548 const.ADMIN_STATE_UP: False,
545 const.PROTOCOL: const.HTTP, 549 const.PROTOCOL: self.protocol,
546 const.PROTOCOL_PORT: 82, 550 const.PROTOCOL_PORT: 82,
547 const.LOADBALANCER_ID: self.lb_id, 551 const.LOADBALANCER_ID: self.lb_id,
548 const.CONNECTION_LIMIT: 200, 552 const.CONNECTION_LIMIT: 200,
@@ -590,7 +594,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
590 UUID(listener[const.ID]) 594 UUID(listener[const.ID])
591 # Operating status will be OFFLINE while admin_state_up = False 595 # Operating status will be OFFLINE while admin_state_up = False
592 self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS]) 596 self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
593 self.assertEqual(const.HTTP, listener[const.PROTOCOL]) 597 self.assertEqual(self.protocol, listener[const.PROTOCOL])
594 self.assertEqual(82, listener[const.PROTOCOL_PORT]) 598 self.assertEqual(82, listener[const.PROTOCOL_PORT])
595 self.assertEqual(200, listener[const.CONNECTION_LIMIT]) 599 self.assertEqual(200, listener[const.CONNECTION_LIMIT])
596 insert_headers = listener[const.INSERT_HEADERS] 600 insert_headers = listener[const.INSERT_HEADERS]
@@ -717,7 +721,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
717 721
718 listener_kwargs = { 722 listener_kwargs = {
719 const.NAME: listener_name, 723 const.NAME: listener_name,
720 const.PROTOCOL: const.HTTP, 724 const.PROTOCOL: self.protocol,
721 const.PROTOCOL_PORT: 83, 725 const.PROTOCOL_PORT: 83,
722 const.LOADBALANCER_ID: self.lb_id, 726 const.LOADBALANCER_ID: self.lb_id,
723 } 727 }
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 @@ class MemberAPITest(test_base.LoadBalancerBaseTest):
40 lb_name = data_utils.rand_name("lb_member_lb1_member") 40 lb_name = data_utils.rand_name("lb_member_lb1_member")
41 lb_kwargs = {const.PROVIDER: CONF.load_balancer.provider, 41 lb_kwargs = {const.PROVIDER: CONF.load_balancer.provider,
42 const.NAME: lb_name} 42 const.NAME: lb_name}
43
44 cls._setup_lb_network_kwargs(lb_kwargs) 43 cls._setup_lb_network_kwargs(lb_kwargs)
44 cls.protocol = const.HTTP
45 lb_feature_enabled = CONF.loadbalancer_feature_enabled
46 if not lb_feature_enabled.l7_protocol_enabled:
47 cls.protocol = lb_feature_enabled.l4_protocol
45 48
46 lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs) 49 lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs)
47 cls.lb_id = lb[const.ID] 50 cls.lb_id = lb[const.ID]
@@ -58,7 +61,7 @@ class MemberAPITest(test_base.LoadBalancerBaseTest):
58 listener_name = data_utils.rand_name("lb_member_listener1_member") 61 listener_name = data_utils.rand_name("lb_member_listener1_member")
59 listener_kwargs = { 62 listener_kwargs = {
60 const.NAME: listener_name, 63 const.NAME: listener_name,
61 const.PROTOCOL: const.HTTP, 64 const.PROTOCOL: cls.protocol,
62 const.PROTOCOL_PORT: '80', 65 const.PROTOCOL_PORT: '80',
63 const.LOADBALANCER_ID: cls.lb_id, 66 const.LOADBALANCER_ID: cls.lb_id,
64 } 67 }
@@ -78,7 +81,7 @@ class MemberAPITest(test_base.LoadBalancerBaseTest):
78 pool_name = data_utils.rand_name("lb_member_pool1_member") 81 pool_name = data_utils.rand_name("lb_member_pool1_member")
79 pool_kwargs = { 82 pool_kwargs = {
80 const.NAME: pool_name, 83 const.NAME: pool_name,
81 const.PROTOCOL: const.HTTP, 84 const.PROTOCOL: cls.protocol,
82 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN, 85 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
83 const.LISTENER_ID: cls.listener_id, 86 const.LISTENER_ID: cls.listener_id,
84 } 87 }
@@ -211,7 +214,8 @@ class MemberAPITest(test_base.LoadBalancerBaseTest):
211 pool_name = data_utils.rand_name("lb_member_pool2_member-list") 214 pool_name = data_utils.rand_name("lb_member_pool2_member-list")
212 pool = self.mem_pool_client.create_pool( 215 pool = self.mem_pool_client.create_pool(
213 name=pool_name, loadbalancer_id=self.lb_id, 216 name=pool_name, loadbalancer_id=self.lb_id,
214 protocol=const.HTTP, lb_algorithm=const.LB_ALGORITHM_ROUND_ROBIN) 217 protocol=self.protocol,
218 lb_algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
215 pool_id = pool[const.ID] 219 pool_id = pool[const.ID]
216 self.addCleanup( 220 self.addCleanup(
217 self.mem_pool_client.cleanup_pool, pool_id, 221 self.mem_pool_client.cleanup_pool, pool_id,
@@ -710,7 +714,8 @@ class MemberAPITest(test_base.LoadBalancerBaseTest):
710 pool_name = data_utils.rand_name("lb_member_pool3_member-batch") 714 pool_name = data_utils.rand_name("lb_member_pool3_member-batch")
711 pool = self.mem_pool_client.create_pool( 715 pool = self.mem_pool_client.create_pool(
712 name=pool_name, loadbalancer_id=self.lb_id, 716 name=pool_name, loadbalancer_id=self.lb_id,
713 protocol=const.HTTP, lb_algorithm=const.LB_ALGORITHM_ROUND_ROBIN) 717 protocol=self.protocol,
718 lb_algorithm=const.LB_ALGORITHM_ROUND_ROBIN)
714 pool_id = pool[const.ID] 719 pool_id = pool[const.ID]
715 self.addClassResourceCleanup( 720 self.addClassResourceCleanup(
716 self.mem_pool_client.cleanup_pool, pool_id, 721 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 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
39 lb_name = data_utils.rand_name("lb_member_lb1_pool") 39 lb_name = data_utils.rand_name("lb_member_lb1_pool")
40 lb_kwargs = {const.PROVIDER: CONF.load_balancer.provider, 40 lb_kwargs = {const.PROVIDER: CONF.load_balancer.provider,
41 const.NAME: lb_name} 41 const.NAME: lb_name}
42
43 cls._setup_lb_network_kwargs(lb_kwargs) 42 cls._setup_lb_network_kwargs(lb_kwargs)
43 cls.protocol = const.HTTP
44 lb_feature_enabled = CONF.loadbalancer_feature_enabled
45 if not lb_feature_enabled.l7_protocol_enabled:
46 cls.protocol = lb_feature_enabled.l4_protocol
44 47
45 lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs) 48 lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs)
46 cls.lb_id = lb[const.ID] 49 cls.lb_id = lb[const.ID]
@@ -57,7 +60,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
57 listener_name = data_utils.rand_name("lb_member_listener1_pool") 60 listener_name = data_utils.rand_name("lb_member_listener1_pool")
58 listener_kwargs = { 61 listener_kwargs = {
59 const.NAME: listener_name, 62 const.NAME: listener_name,
60 const.PROTOCOL: const.HTTP, 63 const.PROTOCOL: cls.protocol,
61 const.PROTOCOL_PORT: '80', 64 const.PROTOCOL_PORT: '80',
62 const.LOADBALANCER_ID: cls.lb_id, 65 const.LOADBALANCER_ID: cls.lb_id,
63 } 66 }
@@ -98,7 +101,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
98 const.NAME: pool_name, 101 const.NAME: pool_name,
99 const.DESCRIPTION: pool_description, 102 const.DESCRIPTION: pool_description,
100 const.ADMIN_STATE_UP: True, 103 const.ADMIN_STATE_UP: True,
101 const.PROTOCOL: const.HTTP, 104 const.PROTOCOL: self.protocol,
102 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN, 105 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
103 const.SESSION_PERSISTENCE: { 106 const.SESSION_PERSISTENCE: {
104 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE, 107 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -156,7 +159,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
156 else: 159 else:
157 # OFFLINE if it is just on the LB directly or is in noop mode 160 # OFFLINE if it is just on the LB directly or is in noop mode
158 self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS]) 161 self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS])
159 self.assertEqual(const.HTTP, pool[const.PROTOCOL]) 162 self.assertEqual(self.protocol, pool[const.PROTOCOL])
160 self.assertEqual(1, len(pool[const.LOADBALANCERS])) 163 self.assertEqual(1, len(pool[const.LOADBALANCERS]))
161 self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID]) 164 self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
162 if has_listener: 165 if has_listener:
@@ -211,7 +214,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
211 const.NAME: pool1_name, 214 const.NAME: pool1_name,
212 const.DESCRIPTION: pool1_desc, 215 const.DESCRIPTION: pool1_desc,
213 const.ADMIN_STATE_UP: True, 216 const.ADMIN_STATE_UP: True,
214 const.PROTOCOL: const.HTTP, 217 const.PROTOCOL: self.protocol,
215 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN, 218 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
216 const.SESSION_PERSISTENCE: { 219 const.SESSION_PERSISTENCE: {
217 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE, 220 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -248,7 +251,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
248 const.NAME: pool2_name, 251 const.NAME: pool2_name,
249 const.DESCRIPTION: pool2_desc, 252 const.DESCRIPTION: pool2_desc,
250 const.ADMIN_STATE_UP: True, 253 const.ADMIN_STATE_UP: True,
251 const.PROTOCOL: const.HTTP, 254 const.PROTOCOL: self.protocol,
252 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN, 255 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
253 const.SESSION_PERSISTENCE: { 256 const.SESSION_PERSISTENCE: {
254 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE, 257 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -284,7 +287,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
284 const.NAME: pool3_name, 287 const.NAME: pool3_name,
285 const.DESCRIPTION: pool3_desc, 288 const.DESCRIPTION: pool3_desc,
286 const.ADMIN_STATE_UP: False, 289 const.ADMIN_STATE_UP: False,
287 const.PROTOCOL: const.HTTP, 290 const.PROTOCOL: self.protocol,
288 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN, 291 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
289 # No session persistence, just so there's one test for that 292 # No session persistence, just so there's one test for that
290 const.LOADBALANCER_ID: lb_id, 293 const.LOADBALANCER_ID: lb_id,
@@ -425,7 +428,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
425 const.NAME: pool_name, 428 const.NAME: pool_name,
426 const.DESCRIPTION: pool_description, 429 const.DESCRIPTION: pool_description,
427 const.ADMIN_STATE_UP: True, 430 const.ADMIN_STATE_UP: True,
428 const.PROTOCOL: const.HTTP, 431 const.PROTOCOL: self.protocol,
429 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN, 432 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
430 const.SESSION_PERSISTENCE: { 433 const.SESSION_PERSISTENCE: {
431 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE, 434 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -460,7 +463,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
460 UUID(pool[const.ID]) 463 UUID(pool[const.ID])
461 # Operating status for pools will always be offline without members 464 # Operating status for pools will always be offline without members
462 self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS]) 465 self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS])
463 self.assertEqual(const.HTTP, pool[const.PROTOCOL]) 466 self.assertEqual(self.protocol, pool[const.PROTOCOL])
464 self.assertEqual(1, len(pool[const.LOADBALANCERS])) 467 self.assertEqual(1, len(pool[const.LOADBALANCERS]))
465 self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID]) 468 self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
466 self.assertEmpty(pool[const.LISTENERS]) 469 self.assertEmpty(pool[const.LISTENERS])
@@ -519,7 +522,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
519 const.NAME: pool_name, 522 const.NAME: pool_name,
520 const.DESCRIPTION: pool_description, 523 const.DESCRIPTION: pool_description,
521 const.ADMIN_STATE_UP: False, 524 const.ADMIN_STATE_UP: False,
522 const.PROTOCOL: const.HTTP, 525 const.PROTOCOL: self.protocol,
523 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN, 526 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
524 const.SESSION_PERSISTENCE: { 527 const.SESSION_PERSISTENCE: {
525 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE, 528 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -554,7 +557,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
554 UUID(pool[const.ID]) 557 UUID(pool[const.ID])
555 # Operating status for pools will always be offline without members 558 # Operating status for pools will always be offline without members
556 self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS]) 559 self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS])
557 self.assertEqual(const.HTTP, pool[const.PROTOCOL]) 560 self.assertEqual(self.protocol, pool[const.PROTOCOL])
558 self.assertEqual(1, len(pool[const.LOADBALANCERS])) 561 self.assertEqual(1, len(pool[const.LOADBALANCERS]))
559 self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID]) 562 self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
560 self.assertEmpty(pool[const.LISTENERS]) 563 self.assertEmpty(pool[const.LISTENERS])
@@ -667,7 +670,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
667 pool_sp_cookie_name = 'my_cookie' 670 pool_sp_cookie_name = 'my_cookie'
668 pool_kwargs = { 671 pool_kwargs = {
669 const.NAME: pool_name, 672 const.NAME: pool_name,
670 const.PROTOCOL: const.HTTP, 673 const.PROTOCOL: self.protocol,
671 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN, 674 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
672 const.SESSION_PERSISTENCE: { 675 const.SESSION_PERSISTENCE: {
673 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE, 676 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 @@ CONF = config.CONF
29class L7PolicyScenarioTest(test_base.LoadBalancerBaseTest): 29class L7PolicyScenarioTest(test_base.LoadBalancerBaseTest):
30 30
31 @classmethod 31 @classmethod
32 def skip_checks(cls):
33 super(L7PolicyScenarioTest, cls).skip_checks()
34 if not CONF.loadbalancer_feature_enabled.l7_protocol_enabled:
35 cls.skipException('[loadbalancer-feature-enabled] '
36 '"l7_protocol_enabled" is set to False in the '
37 'Tempest configuration. L7 Scenario tests will '
38 'be skipped.')
39
40 @classmethod
32 def resource_setup(cls): 41 def resource_setup(cls):
33 """Setup resources needed by the tests.""" 42 """Setup resources needed by the tests."""
34 super(L7PolicyScenarioTest, cls).resource_setup() 43 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 @@ CONF = config.CONF
29class L7RuleScenarioTest(test_base.LoadBalancerBaseTest): 29class L7RuleScenarioTest(test_base.LoadBalancerBaseTest):
30 30
31 @classmethod 31 @classmethod
32 def skip_checks(cls):
33 super(L7RuleScenarioTest, cls).skip_checks()
34 if not CONF.loadbalancer_feature_enabled.l7_protocol_enabled:
35 cls.skipException('[loadbalancer-feature-enabled] '
36 '"l7_protocol_enabled" is set to False in the '
37 'Tempest configuration. L7 Scenario tests will '
38 'be skipped.')
39
40 @classmethod
32 def resource_setup(cls): 41 def resource_setup(cls):
33 """Setup resources needed by the tests.""" 42 """Setup resources needed by the tests."""
34 super(L7RuleScenarioTest, cls).resource_setup() 43 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 @@ class ListenerScenarioTest(test_base.LoadBalancerBaseTest):
51 const.ACTIVE, 51 const.ACTIVE,
52 CONF.load_balancer.lb_build_interval, 52 CONF.load_balancer.lb_build_interval,
53 CONF.load_balancer.lb_build_timeout) 53 CONF.load_balancer.lb_build_timeout)
54 cls.protocol = const.HTTP
55 lb_feature_enabled = CONF.loadbalancer_feature_enabled
56 if not lb_feature_enabled.l7_protocol_enabled:
57 cls.protocol = lb_feature_enabled.l4_protocol
54 58
55 pool1_name = data_utils.rand_name("lb_member_pool1_listener") 59 pool1_name = data_utils.rand_name("lb_member_pool1_listener")
56 pool1_kwargs = { 60 pool1_kwargs = {
57 const.NAME: pool1_name, 61 const.NAME: pool1_name,
58 const.PROTOCOL: const.HTTP, 62 const.PROTOCOL: cls.protocol,
59 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN, 63 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
60 const.LOADBALANCER_ID: cls.lb_id, 64 const.LOADBALANCER_ID: cls.lb_id,
61 } 65 }
@@ -75,7 +79,7 @@ class ListenerScenarioTest(test_base.LoadBalancerBaseTest):
75 pool2_name = data_utils.rand_name("lb_member_pool2_listener") 79 pool2_name = data_utils.rand_name("lb_member_pool2_listener")
76 pool2_kwargs = { 80 pool2_kwargs = {
77 const.NAME: pool2_name, 81 const.NAME: pool2_name,
78 const.PROTOCOL: const.HTTP, 82 const.PROTOCOL: cls.protocol,
79 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN, 83 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
80 const.LOADBALANCER_ID: cls.lb_id, 84 const.LOADBALANCER_ID: cls.lb_id,
81 } 85 }
@@ -109,7 +113,7 @@ class ListenerScenarioTest(test_base.LoadBalancerBaseTest):
109 const.NAME: listener_name, 113 const.NAME: listener_name,
110 const.DESCRIPTION: listener_description, 114 const.DESCRIPTION: listener_description,
111 const.ADMIN_STATE_UP: False, 115 const.ADMIN_STATE_UP: False,
112 const.PROTOCOL: const.HTTP, 116 const.PROTOCOL: self.protocol,
113 const.PROTOCOL_PORT: 80, 117 const.PROTOCOL_PORT: 80,
114 const.LOADBALANCER_ID: self.lb_id, 118 const.LOADBALANCER_ID: self.lb_id,
115 const.CONNECTION_LIMIT: 200, 119 const.CONNECTION_LIMIT: 200,
@@ -157,7 +161,7 @@ class ListenerScenarioTest(test_base.LoadBalancerBaseTest):
157 UUID(listener[const.ID]) 161 UUID(listener[const.ID])
158 # Operating status will be OFFLINE while admin_state_up = False 162 # Operating status will be OFFLINE while admin_state_up = False
159 self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS]) 163 self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
160 self.assertEqual(const.HTTP, listener[const.PROTOCOL]) 164 self.assertEqual(self.protocol, listener[const.PROTOCOL])
161 self.assertEqual(80, listener[const.PROTOCOL_PORT]) 165 self.assertEqual(80, listener[const.PROTOCOL_PORT])
162 self.assertEqual(200, listener[const.CONNECTION_LIMIT]) 166 self.assertEqual(200, listener[const.CONNECTION_LIMIT])
163 insert_headers = listener[const.INSERT_HEADERS] 167 insert_headers = listener[const.INSERT_HEADERS]
@@ -230,7 +234,7 @@ class ListenerScenarioTest(test_base.LoadBalancerBaseTest):
230 self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS]) 234 self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
231 else: 235 else:
232 self.assertEqual(const.ONLINE, listener[const.OPERATING_STATUS]) 236 self.assertEqual(const.ONLINE, listener[const.OPERATING_STATUS])
233 self.assertEqual(const.HTTP, listener[const.PROTOCOL]) 237 self.assertEqual(self.protocol, listener[const.PROTOCOL])
234 self.assertEqual(80, listener[const.PROTOCOL_PORT]) 238 self.assertEqual(80, listener[const.PROTOCOL_PORT])
235 self.assertEqual(400, listener[const.CONNECTION_LIMIT]) 239 self.assertEqual(400, listener[const.CONNECTION_LIMIT])
236 insert_headers = listener[const.INSERT_HEADERS] 240 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 @@ class MemberScenarioTest(test_base.LoadBalancerBaseTest):
50 const.ACTIVE, 50 const.ACTIVE,
51 CONF.load_balancer.lb_build_interval, 51 CONF.load_balancer.lb_build_interval,
52 CONF.load_balancer.lb_build_timeout) 52 CONF.load_balancer.lb_build_timeout)
53 protocol = const.HTTP
54 lb_feature_enabled = CONF.loadbalancer_feature_enabled
55 if not lb_feature_enabled.l7_protocol_enabled:
56 cls.protocol = lb_feature_enabled.l4_protocol
53 57
54 listener_name = data_utils.rand_name("lb_member_listener1_member") 58 listener_name = data_utils.rand_name("lb_member_listener1_member")
55 listener_kwargs = { 59 listener_kwargs = {
56 const.NAME: listener_name, 60 const.NAME: listener_name,
57 const.PROTOCOL: const.HTTP, 61 const.PROTOCOL: protocol,
58 const.PROTOCOL_PORT: '80', 62 const.PROTOCOL_PORT: '80',
59 const.LOADBALANCER_ID: cls.lb_id, 63 const.LOADBALANCER_ID: cls.lb_id,
60 } 64 }
@@ -74,7 +78,7 @@ class MemberScenarioTest(test_base.LoadBalancerBaseTest):
74 pool_name = data_utils.rand_name("lb_member_pool1_member") 78 pool_name = data_utils.rand_name("lb_member_pool1_member")
75 pool_kwargs = { 79 pool_kwargs = {
76 const.NAME: pool_name, 80 const.NAME: pool_name,
77 const.PROTOCOL: const.HTTP, 81 const.PROTOCOL: protocol,
78 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN, 82 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
79 const.LISTENER_ID: cls.listener_id, 83 const.LISTENER_ID: cls.listener_id,
80 } 84 }
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 @@ class PoolScenarioTest(test_base.LoadBalancerBaseTest):
50 const.ACTIVE, 50 const.ACTIVE,
51 CONF.load_balancer.lb_build_interval, 51 CONF.load_balancer.lb_build_interval,
52 CONF.load_balancer.lb_build_timeout) 52 CONF.load_balancer.lb_build_timeout)
53 cls.protocol = const.HTTP
54 lb_feature_enabled = CONF.loadbalancer_feature_enabled
55 if not lb_feature_enabled.l7_protocol_enabled:
56 cls.protocol = lb_feature_enabled.l4_protocol
53 57
54 listener_name = data_utils.rand_name("lb_member_listener1_pool") 58 listener_name = data_utils.rand_name("lb_member_listener1_pool")
55 listener_kwargs = { 59 listener_kwargs = {
56 const.NAME: listener_name, 60 const.NAME: listener_name,
57 const.PROTOCOL: const.HTTP, 61 const.PROTOCOL: cls.protocol,
58 const.PROTOCOL_PORT: '80', 62 const.PROTOCOL_PORT: '80',
59 const.LOADBALANCER_ID: cls.lb_id, 63 const.LOADBALANCER_ID: cls.lb_id,
60 } 64 }
@@ -95,7 +99,7 @@ class PoolScenarioTest(test_base.LoadBalancerBaseTest):
95 const.NAME: pool_name, 99 const.NAME: pool_name,
96 const.DESCRIPTION: pool_description, 100 const.DESCRIPTION: pool_description,
97 const.ADMIN_STATE_UP: False, 101 const.ADMIN_STATE_UP: False,
98 const.PROTOCOL: const.HTTP, 102 const.PROTOCOL: self.protocol,
99 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN, 103 const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
100 const.SESSION_PERSISTENCE: { 104 const.SESSION_PERSISTENCE: {
101 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE, 105 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -132,7 +136,7 @@ class PoolScenarioTest(test_base.LoadBalancerBaseTest):
132 parser.parse(pool[const.UPDATED_AT]) 136 parser.parse(pool[const.UPDATED_AT])
133 UUID(pool[const.ID]) 137 UUID(pool[const.ID])
134 self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS]) 138 self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS])
135 self.assertEqual(const.HTTP, pool[const.PROTOCOL]) 139 self.assertEqual(self.protocol, pool[const.PROTOCOL])
136 self.assertEqual(1, len(pool[const.LOADBALANCERS])) 140 self.assertEqual(1, len(pool[const.LOADBALANCERS]))
137 self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID]) 141 self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
138 if has_listener: 142 if has_listener:
@@ -158,10 +162,10 @@ class PoolScenarioTest(test_base.LoadBalancerBaseTest):
158 const.DESCRIPTION: new_description, 162 const.DESCRIPTION: new_description,
159 const.ADMIN_STATE_UP: True, 163 const.ADMIN_STATE_UP: True,
160 const.LB_ALGORITHM: const.LB_ALGORITHM_LEAST_CONNECTIONS, 164 const.LB_ALGORITHM: const.LB_ALGORITHM_LEAST_CONNECTIONS,
161 const.SESSION_PERSISTENCE: {
162 const.TYPE: const.SESSION_PERSISTENCE_HTTP_COOKIE,
163 },
164 } 165 }
166 if self.protocol == const.HTTP:
167 pool_update_kwargs[const.SESSION_PERSISTENCE] = {
168 const.TYPE: const.SESSION_PERSISTENCE_HTTP_COOKIE}
165 pool = self.mem_pool_client.update_pool( 169 pool = self.mem_pool_client.update_pool(
166 pool[const.ID], **pool_update_kwargs) 170 pool[const.ID], **pool_update_kwargs)
167 171
@@ -183,8 +187,9 @@ class PoolScenarioTest(test_base.LoadBalancerBaseTest):
183 self.assertEqual(const.LB_ALGORITHM_LEAST_CONNECTIONS, 187 self.assertEqual(const.LB_ALGORITHM_LEAST_CONNECTIONS,
184 pool[const.LB_ALGORITHM]) 188 pool[const.LB_ALGORITHM])
185 self.assertIsNotNone(pool.get(const.SESSION_PERSISTENCE)) 189 self.assertIsNotNone(pool.get(const.SESSION_PERSISTENCE))
186 self.assertEqual(const.SESSION_PERSISTENCE_HTTP_COOKIE, 190 if self.protocol == const.HTTP:
187 pool[const.SESSION_PERSISTENCE][const.TYPE]) 191 self.assertEqual(const.SESSION_PERSISTENCE_HTTP_COOKIE,
192 pool[const.SESSION_PERSISTENCE][const.TYPE])
188 self.assertIsNone( 193 self.assertIsNone(
189 pool[const.SESSION_PERSISTENCE].get(const.COOKIE_NAME)) 194 pool[const.SESSION_PERSISTENCE].get(const.COOKIE_NAME))
190 195