Split out listener api tests
Related-Prod: PRODX-35575
Change-Id: Ic893e96014133f710edf13bd285b60e1e1f9bcad
diff --git a/octavia_tempest_plugin/tests/api/v2/test_listener.py b/octavia_tempest_plugin/tests/api/v2/test_listener.py
index 4805487..e015c82 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_listener.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_listener.py
@@ -22,7 +22,6 @@
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions
-import testtools
from octavia_tempest_plugin.common import constants as const
from octavia_tempest_plugin.tests import test_base
@@ -32,13 +31,13 @@
LOG = logging.getLogger(__name__)
-class ListenerAPITest(test_base.LoadBalancerBaseTest):
+class ListenerAPIBase(test_base.LoadBalancerBaseTest):
"""Test the listener object API."""
@classmethod
def resource_setup(cls):
"""Setup resources needed by the tests."""
- super(ListenerAPITest, cls).resource_setup()
+ super().resource_setup()
lb_name = data_utils.rand_name("lb_member_lb1_listener")
lb_kwargs = {const.PROVIDER: CONF.load_balancer.provider,
@@ -65,44 +64,11 @@
@classmethod
def setup_clients(cls):
"""Setup client aliases."""
- super(ListenerAPITest, cls).setup_clients()
+ super().setup_clients()
cls.listener_client = cls.os_primary.load_balancer_v2.ListenerClient()
cls.member2_listener_client = (
cls.os_roles_lb_member2.load_balancer_v2.ListenerClient())
- @decorators.idempotent_id('88d0ec83-7b08-48d9-96e2-0df1d2f8cd98')
- def test_http_listener_create(self):
- self._test_listener_create(const.HTTP, 8000)
-
- @decorators.idempotent_id('2cc89237-fc6b-434d-b38e-b3309823e71f')
- def test_https_listener_create(self):
- self._test_listener_create(const.HTTPS, 8001)
-
- @decorators.idempotent_id('45580065-5653-436b-aaff-dc465fa0a542')
- def test_tcp_listener_create(self):
- self._test_listener_create(const.TCP, 8002)
-
- @testtools.skipIf(CONF.load_balancer.provider == 'tungstenfabric',
- "Not supported by TungstenFabric")
- @decorators.idempotent_id('1a6ba0d0-f309-4088-a686-dda0e9ab7e43')
- @testtools.skipUnless(
- CONF.loadbalancer_feature_enabled.prometheus_listener_enabled,
- 'PROMETHEUS listener tests are disabled in the tempest configuration.')
- def test_prometheus_listener_create(self):
- if not self.mem_listener_client.is_version_supported(
- self.api_version, '2.25'):
- raise self.skipException('PROMETHEUS listeners are only available '
- 'on Octavia API version 2.25 or newer.')
- self._test_listener_create(const.PROMETHEUS, 8090)
-
- @decorators.idempotent_id('7b53f336-47bc-45ae-bbd7-4342ef0673fc')
- def test_udp_listener_create(self):
- self._test_listener_create(const.UDP, 8003)
-
- @decorators.idempotent_id('d6d36c32-27ff-4977-9d21-fd71a14e3b20')
- def test_sctp_listener_create(self):
- self._test_listener_create(const.SCTP, 8004)
-
def _test_listener_create(self, protocol, protocol_port):
"""Tests listener create and basic show APIs.
@@ -259,30 +225,6 @@
CONF.load_balancer.provider != 'tungstenfabric'):
self.assertEqual(self.allowed_cidrs, listener[const.ALLOWED_CIDRS])
- @decorators.idempotent_id('cceac303-4db5-4d5a-9f6e-ff33780a5f29')
- def test_http_udp_sctp_tcp_listener_create_on_same_port(self):
- self._test_listener_create_on_same_port(const.HTTP, const.UDP,
- const.SCTP,
- const.TCP, 8010)
-
- @decorators.idempotent_id('930338b8-3029-48a6-89b2-8b062060fe61')
- def test_http_udp_sctp_https_listener_create_on_same_port(self):
- self._test_listener_create_on_same_port(const.HTTP, const.UDP,
- const.SCTP,
- const.HTTPS, 8011)
-
- @decorators.idempotent_id('01a21892-008a-4327-b4fd-fbf194ecb1a5')
- def test_tcp_udp_sctp_http_listener_create_on_same_port(self):
- self._test_listener_create_on_same_port(const.TCP, const.UDP,
- const.SCTP,
- const.HTTP, 8012)
-
- @decorators.idempotent_id('5da764a4-c03a-46ed-848b-98b9d9fa9089')
- def test_tcp_udp_sctp_https_listener_create_on_same_port(self):
- self._test_listener_create_on_same_port(const.TCP, const.UDP,
- const.SCTP,
- const.HTTPS, 8013)
-
def _test_listener_create_on_same_port(self, protocol1, protocol2,
protocol3, protocol4,
protocol_port):
@@ -447,39 +389,6 @@
self.mem_listener_client.create_listener,
**listener5_kwargs)
- @decorators.idempotent_id('78ba6eb0-178c-477e-9156-b6775ca7b271')
- def test_http_listener_list(self):
- self._test_listener_list(const.HTTP, 8020)
-
- @decorators.idempotent_id('61b7c643-f5fa-4471-8f9e-2e0ccdaf5ac7')
- def test_https_listener_list(self):
- self._test_listener_list(const.HTTPS, 8030)
-
- @testtools.skipIf(CONF.load_balancer.provider == 'tungstenfabric',
- "Not supported by TungstenFabric")
- @decorators.idempotent_id('5473e071-8277-4ac5-9277-01ecaf46e274')
- @testtools.skipUnless(
- CONF.loadbalancer_feature_enabled.prometheus_listener_enabled,
- 'PROMETHEUS listener tests are disabled in the tempest configuration.')
- def test_prometheus_listener_list(self):
- if not self.mem_listener_client.is_version_supported(
- self.api_version, '2.25'):
- raise self.skipException('PROMETHEUS listeners are only available '
- 'on Octavia API version 2.25 or newer.')
- self._test_listener_list(const.PROMETHEUS, 8091)
-
- @decorators.idempotent_id('1cd476e2-7788-415e-bcaf-c377acfc9794')
- def test_tcp_listener_list(self):
- self._test_listener_list(const.TCP, 8030)
-
- @decorators.idempotent_id('c08fb77e-b317-4d6f-b430-91f5b27ebac6')
- def test_udp_listener_list(self):
- self._test_listener_list(const.UDP, 8040)
-
- @decorators.idempotent_id('0abc3998-aacd-4edd-88f5-c5c35557646f')
- def test_sctp_listener_list(self):
- self._test_listener_list(const.SCTP, 8041)
-
def _test_listener_list(self, protocol, protocol_port_base):
"""Tests listener list API and field filtering.
@@ -835,39 +744,6 @@
self.assertTrue(not any(["" in listener[const.TAGS]
for listener in list_of_listeners]))
- @decorators.idempotent_id('6e299eae-6907-4dfc-89c2-e57709d25d3d')
- def test_http_listener_show(self):
- self._test_listener_show(const.HTTP, 8050)
-
- @decorators.idempotent_id('aa838646-435f-4a20-8442-519a7a138e7e')
- def test_https_listener_show(self):
- self._test_listener_show(const.HTTPS, 8051)
-
- @testtools.skipIf(CONF.load_balancer.provider == 'tungstenfabric',
- "Not supported by TungstenFabric")
- @decorators.idempotent_id('b851b754-4333-4115-9063-a9fce44c2e46')
- @testtools.skipUnless(
- CONF.loadbalancer_feature_enabled.prometheus_listener_enabled,
- 'PROMETHEUS listener tests are disabled in the tempest configuration.')
- def test_prometheus_listener_show(self):
- if not self.mem_listener_client.is_version_supported(
- self.api_version, '2.25'):
- raise self.skipException('PROMETHEUS listeners are only available '
- 'on Octavia API version 2.25 or newer.')
- self._test_listener_show(const.PROMETHEUS, 8092)
-
- @decorators.idempotent_id('1fcbbee2-b697-4890-b6bf-d308ac1c94cd')
- def test_tcp_listener_show(self):
- self._test_listener_show(const.TCP, 8052)
-
- @decorators.idempotent_id('1dea3a6b-c95b-4e91-b591-1aa9cbcd0d1d')
- def test_udp_listener_show(self):
- self._test_listener_show(const.UDP, 8053)
-
- @decorators.idempotent_id('10992529-1d0a-47a3-855c-3dbcd868db4e')
- def test_sctp_listener_show(self):
- self._test_listener_show(const.SCTP, 8054)
-
def _test_listener_show(self, protocol, protocol_port):
"""Tests listener show API.
@@ -1011,39 +887,6 @@
'ListenerClient', 'show_listener',
expected_allowed, listener[const.ID])
- @decorators.idempotent_id('aaae0298-5778-4c7e-a27a-01549a71b319')
- def test_http_listener_update(self):
- self._test_listener_update(const.HTTP, 8060)
-
- @decorators.idempotent_id('9679b061-2b2c-469f-abd9-26ed140ef001')
- def test_https_listener_update(self):
- self._test_listener_update(const.HTTPS, 8061)
-
- @testtools.skipIf(CONF.load_balancer.provider == 'tungstenfabric',
- "Not supported by TungstenFabric")
- @decorators.idempotent_id('cbba6bf8-9184-4da5-95e9-5efe1f89ddf0')
- @testtools.skipUnless(
- CONF.loadbalancer_feature_enabled.prometheus_listener_enabled,
- 'PROMETHEUS listener tests are disabled in the tempest configuration.')
- def test_prometheus_listener_update(self):
- if not self.mem_listener_client.is_version_supported(
- self.api_version, '2.25'):
- raise self.skipException('PROMETHEUS listeners are only available '
- 'on Octavia API version 2.25 or newer.')
- self._test_listener_update(const.PROMETHEUS, 8093)
-
- @decorators.idempotent_id('8d933121-db03-4ccc-8b77-4e879064a9ba')
- def test_tcp_listener_update(self):
- self._test_listener_update(const.TCP, 8062)
-
- @decorators.idempotent_id('fd02dbfd-39ce-41c2-b181-54fc7ad91707')
- def test_udp_listener_update(self):
- self._test_listener_update(const.UDP, 8063)
-
- @decorators.idempotent_id('c590b485-4e08-4e49-b384-2282b3f6f1b9')
- def test_sctp_listener_update(self):
- self._test_listener_update(const.SCTP, 8064)
-
def _test_listener_update(self, protocol, protocol_port):
"""Tests listener update and show APIs.
@@ -1292,39 +1135,6 @@
expected_cidrs = ['2001:db8::/64']
self.assertEqual(expected_cidrs, listener[const.ALLOWED_CIDRS])
- @decorators.idempotent_id('16f11c82-f069-4592-8954-81b35a98e3b7')
- def test_http_listener_delete(self):
- self._test_listener_delete(const.HTTP, 8070)
-
- @decorators.idempotent_id('769526a0-df71-47cd-996e-46484de32223')
- def test_https_listener_delete(self):
- self._test_listener_delete(const.HTTPS, 8071)
-
- @testtools.skipIf(CONF.load_balancer.provider == 'tungstenfabric',
- "Not supported by TungstenFabric")
- @decorators.idempotent_id('322a6372-6b56-4a3c-87e3-dd82074bc83e')
- @testtools.skipUnless(
- CONF.loadbalancer_feature_enabled.prometheus_listener_enabled,
- 'PROMETHEUS listener tests are disabled in the tempest configuration.')
- def test_prometheus_listener_delete(self):
- if not self.mem_listener_client.is_version_supported(
- self.api_version, '2.25'):
- raise self.skipException('PROMETHEUS listeners are only available '
- 'on Octavia API version 2.25 or newer.')
- self._test_listener_delete(const.PROMETHEUS, 8094)
-
- @decorators.idempotent_id('f5ca019d-2b33-48f9-9c2d-2ec169b423ca')
- def test_tcp_listener_delete(self):
- self._test_listener_delete(const.TCP, 8072)
-
- @decorators.idempotent_id('86bd9717-e3e9-41e3-86c4-888c64455926')
- def test_udp_listener_delete(self):
- self._test_listener_delete(const.UDP, 8073)
-
- @decorators.idempotent_id('0de6f1ad-58ae-4b31-86b6-b440fce70244')
- def test_sctp_listener_delete(self):
- self._test_listener_delete(const.SCTP, 8074)
-
def _test_listener_delete(self, protocol, protocol_port):
"""Tests listener create and delete APIs.
@@ -1391,26 +1201,6 @@
CONF.load_balancer.check_interval,
CONF.load_balancer.check_timeout)
- @decorators.idempotent_id('6f14a6c1-945e-43bc-8215-410c8a5edb25')
- def test_http_listener_show_stats(self):
- self._test_listener_show_stats(const.HTTP, 8080)
-
- @decorators.idempotent_id('f8a43c27-f0a0-496d-a287-1958f337ac04')
- def test_https_listener_show_stats(self):
- self._test_listener_show_stats(const.HTTPS, 8081)
-
- @decorators.idempotent_id('8a999856-f448-498c-b891-21af449b5208')
- def test_tcp_listener_show_stats(self):
- self._test_listener_show_stats(const.TCP, 8082)
-
- @decorators.idempotent_id('a4c1f199-923b-41e4-a134-c91e590e20c4')
- def test_udp_listener_show_stats(self):
- self._test_listener_show_stats(const.UDP, 8083)
-
- @decorators.idempotent_id('7f6d3906-529c-4b99-8376-b836059df220')
- def test_sctp_listener_show_stats(self):
- self._test_listener_show_stats(const.SCTP, 8084)
-
def _test_listener_show_stats(self, protocol, protocol_port):
"""Tests listener show statistics API.
@@ -1484,3 +1274,218 @@
self.assertEqual(0, stats[const.BYTES_OUT])
self.assertEqual(0, stats[const.REQUEST_ERRORS])
self.assertEqual(0, stats[const.TOTAL_CONNECTIONS])
+
+
+class ListenerAPITestTCP(ListenerAPIBase):
+
+ @decorators.idempotent_id('45580065-5653-436b-aaff-dc465fa0a542')
+ def test_tcp_listener_create(self):
+ self._test_listener_create(const.TCP, 8002)
+
+ @decorators.idempotent_id('1cd476e2-7788-415e-bcaf-c377acfc9794')
+ def test_tcp_listener_list(self):
+ self._test_listener_list(const.TCP, 8030)
+
+ @decorators.idempotent_id('1fcbbee2-b697-4890-b6bf-d308ac1c94cd')
+ def test_tcp_listener_show(self):
+ self._test_listener_show(const.TCP, 8052)
+
+ @decorators.idempotent_id('8d933121-db03-4ccc-8b77-4e879064a9ba')
+ def test_tcp_listener_update(self):
+ self._test_listener_update(const.TCP, 8062)
+
+ @decorators.idempotent_id('f5ca019d-2b33-48f9-9c2d-2ec169b423ca')
+ def test_tcp_listener_delete(self):
+ self._test_listener_delete(const.TCP, 8072)
+
+ @decorators.idempotent_id('8a999856-f448-498c-b891-21af449b5208')
+ def test_tcp_listener_show_stats(self):
+ self._test_listener_show_stats(const.TCP, 8082)
+
+
+class ListenerAPITestUDP(ListenerAPIBase):
+ @decorators.idempotent_id('7b53f336-47bc-45ae-bbd7-4342ef0673fc')
+ def test_udp_listener_create(self):
+ self._test_listener_create(const.UDP, 8003)
+
+ @decorators.idempotent_id('c08fb77e-b317-4d6f-b430-91f5b27ebac6')
+ def test_udp_listener_list(self):
+ self._test_listener_list(const.UDP, 8040)
+
+ @decorators.idempotent_id('1dea3a6b-c95b-4e91-b591-1aa9cbcd0d1d')
+ def test_udp_listener_show(self):
+ self._test_listener_show(const.UDP, 8053)
+
+ @decorators.idempotent_id('fd02dbfd-39ce-41c2-b181-54fc7ad91707')
+ def test_udp_listener_update(self):
+ self._test_listener_update(const.UDP, 8063)
+
+ @decorators.idempotent_id('86bd9717-e3e9-41e3-86c4-888c64455926')
+ def test_udp_listener_delete(self):
+ self._test_listener_delete(const.UDP, 8073)
+
+ @decorators.idempotent_id('a4c1f199-923b-41e4-a134-c91e590e20c4')
+ def test_udp_listener_show_stats(self):
+ self._test_listener_show_stats(const.UDP, 8083)
+
+
+class ListenerAPITestSCTP(ListenerAPIBase):
+
+ @decorators.idempotent_id('d6d36c32-27ff-4977-9d21-fd71a14e3b20')
+ def test_sctp_listener_create(self):
+ self._test_listener_create(const.SCTP, 8004)
+
+ @decorators.idempotent_id('0abc3998-aacd-4edd-88f5-c5c35557646f')
+ def test_sctp_listener_list(self):
+ self._test_listener_list(const.SCTP, 8041)
+
+ @decorators.idempotent_id('10992529-1d0a-47a3-855c-3dbcd868db4e')
+ def test_sctp_listener_show(self):
+ self._test_listener_show(const.SCTP, 8054)
+
+ @decorators.idempotent_id('c590b485-4e08-4e49-b384-2282b3f6f1b9')
+ def test_sctp_listener_update(self):
+ self._test_listener_update(const.SCTP, 8064)
+
+ @decorators.idempotent_id('0de6f1ad-58ae-4b31-86b6-b440fce70244')
+ def test_sctp_listener_delete(self):
+ self._test_listener_delete(const.SCTP, 8074)
+
+ @decorators.idempotent_id('7f6d3906-529c-4b99-8376-b836059df220')
+ def test_sctp_listener_show_stats(self):
+ self._test_listener_show_stats(const.SCTP, 8084)
+
+
+class ListenerAPITestHTTP(ListenerAPIBase):
+
+ @decorators.idempotent_id('88d0ec83-7b08-48d9-96e2-0df1d2f8cd98')
+ def test_http_listener_create(self):
+ self._test_listener_create(const.HTTP, 8000)
+
+ @decorators.idempotent_id('78ba6eb0-178c-477e-9156-b6775ca7b271')
+ def test_http_listener_list(self):
+ self._test_listener_list(const.HTTP, 8020)
+
+ @decorators.idempotent_id('6e299eae-6907-4dfc-89c2-e57709d25d3d')
+ def test_http_listener_show(self):
+ self._test_listener_show(const.HTTP, 8050)
+
+ @decorators.idempotent_id('aaae0298-5778-4c7e-a27a-01549a71b319')
+ def test_http_listener_update(self):
+ self._test_listener_update(const.HTTP, 8060)
+
+ @decorators.idempotent_id('16f11c82-f069-4592-8954-81b35a98e3b7')
+ def test_http_listener_delete(self):
+ self._test_listener_delete(const.HTTP, 8070)
+
+ @decorators.idempotent_id('6f14a6c1-945e-43bc-8215-410c8a5edb25')
+ def test_http_listener_show_stats(self):
+ self._test_listener_show_stats(const.HTTP, 8080)
+
+
+class ListenerAPITestHTTPS(ListenerAPIBase):
+
+ @decorators.idempotent_id('2cc89237-fc6b-434d-b38e-b3309823e71f')
+ def test_https_listener_create(self):
+ self._test_listener_create(const.HTTPS, 8001)
+
+ @decorators.idempotent_id('61b7c643-f5fa-4471-8f9e-2e0ccdaf5ac7')
+ def test_https_listener_list(self):
+ self._test_listener_list(const.HTTPS, 8030)
+
+ @decorators.idempotent_id('aa838646-435f-4a20-8442-519a7a138e7e')
+ def test_https_listener_show(self):
+ self._test_listener_show(const.HTTPS, 8051)
+
+ @decorators.idempotent_id('9679b061-2b2c-469f-abd9-26ed140ef001')
+ def test_https_listener_update(self):
+ self._test_listener_update(const.HTTPS, 8061)
+
+ @decorators.idempotent_id('769526a0-df71-47cd-996e-46484de32223')
+ def test_https_listener_delete(self):
+ self._test_listener_delete(const.HTTPS, 8071)
+
+ @decorators.idempotent_id('f8a43c27-f0a0-496d-a287-1958f337ac04')
+ def test_https_listener_show_stats(self):
+ self._test_listener_show_stats(const.HTTPS, 8081)
+
+
+class ListenerAPITestPrometheus(ListenerAPIBase):
+
+ @classmethod
+ def skip_checks(cls):
+ super().skip_checks()
+ if CONF.load_balancer.provider == 'tungstenfabric':
+ raise cls.skipException("Not supported by TungstenFabric")
+ if not CONF.loadbalancer_feature_enabled.prometheus_listener_enabled:
+ raise cls.skipException(
+ 'PROMETHEUS listener tests are disabled '
+ 'in the tempest configuration.'
+ )
+
+ @decorators.idempotent_id('1a6ba0d0-f309-4088-a686-dda0e9ab7e43')
+ def test_prometheus_listener_create(self):
+ if not self.mem_listener_client.is_version_supported(
+ self.api_version, '2.25'):
+ raise self.skipException('PROMETHEUS listeners are only available '
+ 'on Octavia API version 2.25 or newer.')
+ self._test_listener_create(const.PROMETHEUS, 8090)
+
+ @decorators.idempotent_id('5473e071-8277-4ac5-9277-01ecaf46e274')
+ def test_prometheus_listener_list(self):
+ if not self.mem_listener_client.is_version_supported(
+ self.api_version, '2.25'):
+ raise self.skipException('PROMETHEUS listeners are only available '
+ 'on Octavia API version 2.25 or newer.')
+ self._test_listener_list(const.PROMETHEUS, 8091)
+
+ @decorators.idempotent_id('b851b754-4333-4115-9063-a9fce44c2e46')
+ def test_prometheus_listener_show(self):
+ if not self.mem_listener_client.is_version_supported(
+ self.api_version, '2.25'):
+ raise self.skipException('PROMETHEUS listeners are only available '
+ 'on Octavia API version 2.25 or newer.')
+ self._test_listener_show(const.PROMETHEUS, 8092)
+
+ @decorators.idempotent_id('cbba6bf8-9184-4da5-95e9-5efe1f89ddf0')
+ def test_prometheus_listener_update(self):
+ if not self.mem_listener_client.is_version_supported(
+ self.api_version, '2.25'):
+ raise self.skipException('PROMETHEUS listeners are only available '
+ 'on Octavia API version 2.25 or newer.')
+ self._test_listener_update(const.PROMETHEUS, 8093)
+
+ @decorators.idempotent_id('322a6372-6b56-4a3c-87e3-dd82074bc83e')
+ def test_prometheus_listener_delete(self):
+ if not self.mem_listener_client.is_version_supported(
+ self.api_version, '2.25'):
+ raise self.skipException('PROMETHEUS listeners are only available '
+ 'on Octavia API version 2.25 or newer.')
+ self._test_listener_delete(const.PROMETHEUS, 8094)
+
+
+class ListenerAPITestMultiprotocol(ListenerAPIBase):
+
+ @decorators.idempotent_id('01a21892-008a-4327-b4fd-fbf194ecb1a5')
+ def test_tcp_udp_sctp_http_listener_create_on_same_port(self):
+ self._test_listener_create_on_same_port(const.TCP, const.UDP,
+ const.SCTP,
+ const.HTTP, 8012)
+
+ @decorators.idempotent_id('cceac303-4db5-4d5a-9f6e-ff33780a5f29')
+ def test_http_udp_sctp_tcp_listener_create_on_same_port(self):
+ self._test_listener_create_on_same_port(const.HTTP, const.UDP,
+ const.SCTP,
+ const.TCP, 8010)
+
+ @decorators.idempotent_id('930338b8-3029-48a6-89b2-8b062060fe61')
+ def test_http_udp_sctp_https_listener_create_on_same_port(self):
+ self._test_listener_create_on_same_port(const.HTTP, const.UDP,
+ const.SCTP,
+ const.HTTPS, 8011)
+
+ @decorators.idempotent_id('5da764a4-c03a-46ed-848b-98b9d9fa9089')
+ def test_tcp_udp_sctp_https_listener_create_on_same_port(self):
+ self._test_listener_create_on_same_port(const.TCP, const.UDP,
+ const.SCTP,
+ const.HTTPS, 8013)