Browse Source

Merge "Add configuration to enable/disable L7,L4 protocols"

tags/1.0.0
Zuul 4 months ago
parent
commit
a128c99bb3

+ 8
- 0
octavia_tempest_plugin/config.py View File

@@ -176,4 +176,12 @@ LBFeatureEnabledGroup = [
176 176
                 default=True,
177 177
                 help="Whether TLS termination is available with provider "
178 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
 ]

+ 9
- 0
octavia_tempest_plugin/tests/api/v2/test_l7policy.py View File

@@ -31,6 +31,15 @@ CONF = config.CONF
31 31
 class L7PolicyAPITest(test_base.LoadBalancerBaseTest):
32 32
     """Test the l7policy object API."""
33 33
 
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
+
34 43
     @classmethod
35 44
     def resource_setup(cls):
36 45
         """Setup resources needed by the tests."""

+ 8
- 0
octavia_tempest_plugin/tests/api/v2/test_l7rule.py View File

@@ -30,6 +30,14 @@ CONF = config.CONF
30 30
 
31 31
 class L7RuleAPITest(test_base.LoadBalancerBaseTest):
32 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 42
     @classmethod
35 43
     def resource_setup(cls):

+ 14
- 10
octavia_tempest_plugin/tests/api/v2/test_listener.py View File

@@ -42,6 +42,10 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
42 42
                      const.NAME: lb_name}
43 43
 
44 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 50
         lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs)
47 51
         cls.lb_id = lb[const.ID]
@@ -72,7 +76,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
72 76
             const.NAME: listener_name,
73 77
             const.DESCRIPTION: listener_description,
74 78
             const.ADMIN_STATE_UP: True,
75
-            const.PROTOCOL: const.HTTP,
79
+            const.PROTOCOL: self.protocol,
76 80
             const.PROTOCOL_PORT: 80,
77 81
             const.LOADBALANCER_ID: self.lb_id,
78 82
             const.CONNECTION_LIMIT: 200,
@@ -142,7 +146,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
142 146
             self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
143 147
         else:
144 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 150
         self.assertEqual(80, listener[const.PROTOCOL_PORT])
147 151
         self.assertEqual(200, listener[const.CONNECTION_LIMIT])
148 152
         insert_headers = listener[const.INSERT_HEADERS]
@@ -194,7 +198,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
194 198
             const.NAME: listener1_name,
195 199
             const.DESCRIPTION: listener1_desc,
196 200
             const.ADMIN_STATE_UP: True,
197
-            const.PROTOCOL: const.HTTP,
201
+            const.PROTOCOL: self.protocol,
198 202
             const.PROTOCOL_PORT: 80,
199 203
             const.LOADBALANCER_ID: lb_id,
200 204
         }
@@ -226,7 +230,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
226 230
             const.NAME: listener2_name,
227 231
             const.DESCRIPTION: listener2_desc,
228 232
             const.ADMIN_STATE_UP: True,
229
-            const.PROTOCOL: const.HTTP,
233
+            const.PROTOCOL: self.protocol,
230 234
             const.PROTOCOL_PORT: 81,
231 235
             const.LOADBALANCER_ID: lb_id,
232 236
         }
@@ -258,7 +262,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
258 262
             const.NAME: listener3_name,
259 263
             const.DESCRIPTION: listener3_desc,
260 264
             const.ADMIN_STATE_UP: False,
261
-            const.PROTOCOL: const.HTTP,
265
+            const.PROTOCOL: self.protocol,
262 266
             const.PROTOCOL_PORT: 82,
263 267
             const.LOADBALANCER_ID: lb_id,
264 268
         }
@@ -420,7 +424,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
420 424
             const.NAME: listener_name,
421 425
             const.DESCRIPTION: listener_description,
422 426
             const.ADMIN_STATE_UP: True,
423
-            const.PROTOCOL: const.HTTP,
427
+            const.PROTOCOL: self.protocol,
424 428
             const.PROTOCOL_PORT: 81,
425 429
             const.LOADBALANCER_ID: self.lb_id,
426 430
             const.CONNECTION_LIMIT: 200,
@@ -479,7 +483,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
479 483
             self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
480 484
         else:
481 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 487
         self.assertEqual(81, listener[const.PROTOCOL_PORT])
484 488
         self.assertEqual(200, listener[const.CONNECTION_LIMIT])
485 489
         insert_headers = listener[const.INSERT_HEADERS]
@@ -542,7 +546,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
542 546
             const.NAME: listener_name,
543 547
             const.DESCRIPTION: listener_description,
544 548
             const.ADMIN_STATE_UP: False,
545
-            const.PROTOCOL: const.HTTP,
549
+            const.PROTOCOL: self.protocol,
546 550
             const.PROTOCOL_PORT: 82,
547 551
             const.LOADBALANCER_ID: self.lb_id,
548 552
             const.CONNECTION_LIMIT: 200,
@@ -590,7 +594,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
590 594
         UUID(listener[const.ID])
591 595
         # Operating status will be OFFLINE while admin_state_up = False
592 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 598
         self.assertEqual(82, listener[const.PROTOCOL_PORT])
595 599
         self.assertEqual(200, listener[const.CONNECTION_LIMIT])
596 600
         insert_headers = listener[const.INSERT_HEADERS]
@@ -717,7 +721,7 @@ class ListenerAPITest(test_base.LoadBalancerBaseTest):
717 721
 
718 722
         listener_kwargs = {
719 723
             const.NAME: listener_name,
720
-            const.PROTOCOL: const.HTTP,
724
+            const.PROTOCOL: self.protocol,
721 725
             const.PROTOCOL_PORT: 83,
722 726
             const.LOADBALANCER_ID: self.lb_id,
723 727
         }

+ 10
- 5
octavia_tempest_plugin/tests/api/v2/test_member.py View File

@@ -40,8 +40,11 @@ class MemberAPITest(test_base.LoadBalancerBaseTest):
40 40
         lb_name = data_utils.rand_name("lb_member_lb1_member")
41 41
         lb_kwargs = {const.PROVIDER: CONF.load_balancer.provider,
42 42
                      const.NAME: lb_name}
43
-
44 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 49
         lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs)
47 50
         cls.lb_id = lb[const.ID]
@@ -58,7 +61,7 @@ class MemberAPITest(test_base.LoadBalancerBaseTest):
58 61
         listener_name = data_utils.rand_name("lb_member_listener1_member")
59 62
         listener_kwargs = {
60 63
             const.NAME: listener_name,
61
-            const.PROTOCOL: const.HTTP,
64
+            const.PROTOCOL: cls.protocol,
62 65
             const.PROTOCOL_PORT: '80',
63 66
             const.LOADBALANCER_ID: cls.lb_id,
64 67
         }
@@ -78,7 +81,7 @@ class MemberAPITest(test_base.LoadBalancerBaseTest):
78 81
         pool_name = data_utils.rand_name("lb_member_pool1_member")
79 82
         pool_kwargs = {
80 83
             const.NAME: pool_name,
81
-            const.PROTOCOL: const.HTTP,
84
+            const.PROTOCOL: cls.protocol,
82 85
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
83 86
             const.LISTENER_ID: cls.listener_id,
84 87
         }
@@ -211,7 +214,8 @@ class MemberAPITest(test_base.LoadBalancerBaseTest):
211 214
         pool_name = data_utils.rand_name("lb_member_pool2_member-list")
212 215
         pool = self.mem_pool_client.create_pool(
213 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 219
         pool_id = pool[const.ID]
216 220
         self.addCleanup(
217 221
             self.mem_pool_client.cleanup_pool, pool_id,
@@ -710,7 +714,8 @@ class MemberAPITest(test_base.LoadBalancerBaseTest):
710 714
         pool_name = data_utils.rand_name("lb_member_pool3_member-batch")
711 715
         pool = self.mem_pool_client.create_pool(
712 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 719
         pool_id = pool[const.ID]
715 720
         self.addClassResourceCleanup(
716 721
             self.mem_pool_client.cleanup_pool, pool_id,

+ 15
- 12
octavia_tempest_plugin/tests/api/v2/test_pool.py View File

@@ -39,8 +39,11 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
39 39
         lb_name = data_utils.rand_name("lb_member_lb1_pool")
40 40
         lb_kwargs = {const.PROVIDER: CONF.load_balancer.provider,
41 41
                      const.NAME: lb_name}
42
-
43 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 48
         lb = cls.mem_lb_client.create_loadbalancer(**lb_kwargs)
46 49
         cls.lb_id = lb[const.ID]
@@ -57,7 +60,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
57 60
         listener_name = data_utils.rand_name("lb_member_listener1_pool")
58 61
         listener_kwargs = {
59 62
             const.NAME: listener_name,
60
-            const.PROTOCOL: const.HTTP,
63
+            const.PROTOCOL: cls.protocol,
61 64
             const.PROTOCOL_PORT: '80',
62 65
             const.LOADBALANCER_ID: cls.lb_id,
63 66
         }
@@ -98,7 +101,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
98 101
             const.NAME: pool_name,
99 102
             const.DESCRIPTION: pool_description,
100 103
             const.ADMIN_STATE_UP: True,
101
-            const.PROTOCOL: const.HTTP,
104
+            const.PROTOCOL: self.protocol,
102 105
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
103 106
             const.SESSION_PERSISTENCE: {
104 107
                 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -156,7 +159,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
156 159
         else:
157 160
             # OFFLINE if it is just on the LB directly or is in noop mode
158 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 163
         self.assertEqual(1, len(pool[const.LOADBALANCERS]))
161 164
         self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
162 165
         if has_listener:
@@ -211,7 +214,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
211 214
             const.NAME: pool1_name,
212 215
             const.DESCRIPTION: pool1_desc,
213 216
             const.ADMIN_STATE_UP: True,
214
-            const.PROTOCOL: const.HTTP,
217
+            const.PROTOCOL: self.protocol,
215 218
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
216 219
             const.SESSION_PERSISTENCE: {
217 220
                 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -248,7 +251,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
248 251
             const.NAME: pool2_name,
249 252
             const.DESCRIPTION: pool2_desc,
250 253
             const.ADMIN_STATE_UP: True,
251
-            const.PROTOCOL: const.HTTP,
254
+            const.PROTOCOL: self.protocol,
252 255
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
253 256
             const.SESSION_PERSISTENCE: {
254 257
                 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -284,7 +287,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
284 287
             const.NAME: pool3_name,
285 288
             const.DESCRIPTION: pool3_desc,
286 289
             const.ADMIN_STATE_UP: False,
287
-            const.PROTOCOL: const.HTTP,
290
+            const.PROTOCOL: self.protocol,
288 291
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
289 292
             # No session persistence, just so there's one test for that
290 293
             const.LOADBALANCER_ID: lb_id,
@@ -425,7 +428,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
425 428
             const.NAME: pool_name,
426 429
             const.DESCRIPTION: pool_description,
427 430
             const.ADMIN_STATE_UP: True,
428
-            const.PROTOCOL: const.HTTP,
431
+            const.PROTOCOL: self.protocol,
429 432
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
430 433
             const.SESSION_PERSISTENCE: {
431 434
                 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -460,7 +463,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
460 463
         UUID(pool[const.ID])
461 464
         # Operating status for pools will always be offline without members
462 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 467
         self.assertEqual(1, len(pool[const.LOADBALANCERS]))
465 468
         self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
466 469
         self.assertEmpty(pool[const.LISTENERS])
@@ -519,7 +522,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
519 522
             const.NAME: pool_name,
520 523
             const.DESCRIPTION: pool_description,
521 524
             const.ADMIN_STATE_UP: False,
522
-            const.PROTOCOL: const.HTTP,
525
+            const.PROTOCOL: self.protocol,
523 526
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
524 527
             const.SESSION_PERSISTENCE: {
525 528
                 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -554,7 +557,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
554 557
         UUID(pool[const.ID])
555 558
         # Operating status for pools will always be offline without members
556 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 561
         self.assertEqual(1, len(pool[const.LOADBALANCERS]))
559 562
         self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
560 563
         self.assertEmpty(pool[const.LISTENERS])
@@ -667,7 +670,7 @@ class PoolAPITest(test_base.LoadBalancerBaseTest):
667 670
         pool_sp_cookie_name = 'my_cookie'
668 671
         pool_kwargs = {
669 672
             const.NAME: pool_name,
670
-            const.PROTOCOL: const.HTTP,
673
+            const.PROTOCOL: self.protocol,
671 674
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
672 675
             const.SESSION_PERSISTENCE: {
673 676
                 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,

+ 9
- 0
octavia_tempest_plugin/tests/scenario/v2/test_l7policy.py View File

@@ -28,6 +28,15 @@ CONF = config.CONF
28 28
 
29 29
 class L7PolicyScenarioTest(test_base.LoadBalancerBaseTest):
30 30
 
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
+
31 40
     @classmethod
32 41
     def resource_setup(cls):
33 42
         """Setup resources needed by the tests."""

+ 9
- 0
octavia_tempest_plugin/tests/scenario/v2/test_l7rule.py View File

@@ -28,6 +28,15 @@ CONF = config.CONF
28 28
 
29 29
 class L7RuleScenarioTest(test_base.LoadBalancerBaseTest):
30 30
 
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
+
31 40
     @classmethod
32 41
     def resource_setup(cls):
33 42
         """Setup resources needed by the tests."""

+ 9
- 5
octavia_tempest_plugin/tests/scenario/v2/test_listener.py View File

@@ -51,11 +51,15 @@ class ListenerScenarioTest(test_base.LoadBalancerBaseTest):
51 51
                                 const.ACTIVE,
52 52
                                 CONF.load_balancer.lb_build_interval,
53 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 59
         pool1_name = data_utils.rand_name("lb_member_pool1_listener")
56 60
         pool1_kwargs = {
57 61
             const.NAME: pool1_name,
58
-            const.PROTOCOL: const.HTTP,
62
+            const.PROTOCOL: cls.protocol,
59 63
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
60 64
             const.LOADBALANCER_ID: cls.lb_id,
61 65
         }
@@ -75,7 +79,7 @@ class ListenerScenarioTest(test_base.LoadBalancerBaseTest):
75 79
         pool2_name = data_utils.rand_name("lb_member_pool2_listener")
76 80
         pool2_kwargs = {
77 81
             const.NAME: pool2_name,
78
-            const.PROTOCOL: const.HTTP,
82
+            const.PROTOCOL: cls.protocol,
79 83
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
80 84
             const.LOADBALANCER_ID: cls.lb_id,
81 85
         }
@@ -109,7 +113,7 @@ class ListenerScenarioTest(test_base.LoadBalancerBaseTest):
109 113
             const.NAME: listener_name,
110 114
             const.DESCRIPTION: listener_description,
111 115
             const.ADMIN_STATE_UP: False,
112
-            const.PROTOCOL: const.HTTP,
116
+            const.PROTOCOL: self.protocol,
113 117
             const.PROTOCOL_PORT: 80,
114 118
             const.LOADBALANCER_ID: self.lb_id,
115 119
             const.CONNECTION_LIMIT: 200,
@@ -157,7 +161,7 @@ class ListenerScenarioTest(test_base.LoadBalancerBaseTest):
157 161
         UUID(listener[const.ID])
158 162
         # Operating status will be OFFLINE while admin_state_up = False
159 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 165
         self.assertEqual(80, listener[const.PROTOCOL_PORT])
162 166
         self.assertEqual(200, listener[const.CONNECTION_LIMIT])
163 167
         insert_headers = listener[const.INSERT_HEADERS]
@@ -230,7 +234,7 @@ class ListenerScenarioTest(test_base.LoadBalancerBaseTest):
230 234
             self.assertEqual(const.OFFLINE, listener[const.OPERATING_STATUS])
231 235
         else:
232 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 238
         self.assertEqual(80, listener[const.PROTOCOL_PORT])
235 239
         self.assertEqual(400, listener[const.CONNECTION_LIMIT])
236 240
         insert_headers = listener[const.INSERT_HEADERS]

+ 6
- 2
octavia_tempest_plugin/tests/scenario/v2/test_member.py View File

@@ -50,11 +50,15 @@ class MemberScenarioTest(test_base.LoadBalancerBaseTest):
50 50
                                 const.ACTIVE,
51 51
                                 CONF.load_balancer.lb_build_interval,
52 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 58
         listener_name = data_utils.rand_name("lb_member_listener1_member")
55 59
         listener_kwargs = {
56 60
             const.NAME: listener_name,
57
-            const.PROTOCOL: const.HTTP,
61
+            const.PROTOCOL: protocol,
58 62
             const.PROTOCOL_PORT: '80',
59 63
             const.LOADBALANCER_ID: cls.lb_id,
60 64
         }
@@ -74,7 +78,7 @@ class MemberScenarioTest(test_base.LoadBalancerBaseTest):
74 78
         pool_name = data_utils.rand_name("lb_member_pool1_member")
75 79
         pool_kwargs = {
76 80
             const.NAME: pool_name,
77
-            const.PROTOCOL: const.HTTP,
81
+            const.PROTOCOL: protocol,
78 82
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
79 83
             const.LISTENER_ID: cls.listener_id,
80 84
         }

+ 13
- 8
octavia_tempest_plugin/tests/scenario/v2/test_pool.py View File

@@ -50,11 +50,15 @@ class PoolScenarioTest(test_base.LoadBalancerBaseTest):
50 50
                                 const.ACTIVE,
51 51
                                 CONF.load_balancer.lb_build_interval,
52 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 58
         listener_name = data_utils.rand_name("lb_member_listener1_pool")
55 59
         listener_kwargs = {
56 60
             const.NAME: listener_name,
57
-            const.PROTOCOL: const.HTTP,
61
+            const.PROTOCOL: cls.protocol,
58 62
             const.PROTOCOL_PORT: '80',
59 63
             const.LOADBALANCER_ID: cls.lb_id,
60 64
         }
@@ -95,7 +99,7 @@ class PoolScenarioTest(test_base.LoadBalancerBaseTest):
95 99
             const.NAME: pool_name,
96 100
             const.DESCRIPTION: pool_description,
97 101
             const.ADMIN_STATE_UP: False,
98
-            const.PROTOCOL: const.HTTP,
102
+            const.PROTOCOL: self.protocol,
99 103
             const.LB_ALGORITHM: const.LB_ALGORITHM_ROUND_ROBIN,
100 104
             const.SESSION_PERSISTENCE: {
101 105
                 const.TYPE: const.SESSION_PERSISTENCE_APP_COOKIE,
@@ -132,7 +136,7 @@ class PoolScenarioTest(test_base.LoadBalancerBaseTest):
132 136
         parser.parse(pool[const.UPDATED_AT])
133 137
         UUID(pool[const.ID])
134 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 140
         self.assertEqual(1, len(pool[const.LOADBALANCERS]))
137 141
         self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
138 142
         if has_listener:
@@ -158,10 +162,10 @@ class PoolScenarioTest(test_base.LoadBalancerBaseTest):
158 162
             const.DESCRIPTION: new_description,
159 163
             const.ADMIN_STATE_UP: True,
160 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 169
         pool = self.mem_pool_client.update_pool(
166 170
             pool[const.ID], **pool_update_kwargs)
167 171
 
@@ -183,8 +187,9 @@ class PoolScenarioTest(test_base.LoadBalancerBaseTest):
183 187
         self.assertEqual(const.LB_ALGORITHM_LEAST_CONNECTIONS,
184 188
                          pool[const.LB_ALGORITHM])
185 189
         self.assertIsNotNone(pool.get(const.SESSION_PERSISTENCE))
186
-        self.assertEqual(const.SESSION_PERSISTENCE_HTTP_COOKIE,
187
-                         pool[const.SESSION_PERSISTENCE][const.TYPE])
190
+        if self.protocol == const.HTTP:
191
+            self.assertEqual(const.SESSION_PERSISTENCE_HTTP_COOKIE,
192
+                             pool[const.SESSION_PERSISTENCE][const.TYPE])
188 193
         self.assertIsNone(
189 194
             pool[const.SESSION_PERSISTENCE].get(const.COOKIE_NAME))
190 195
 

Loading…
Cancel
Save