Merge "Call super for skip_checks" into mcp/caracal
diff --git a/octavia_tempest_plugin/config.py b/octavia_tempest_plugin/config.py
index 58ddf13..0587a5c 100644
--- a/octavia_tempest_plugin/config.py
+++ b/octavia_tempest_plugin/config.py
@@ -15,6 +15,7 @@
from oslo_config import cfg
from oslo_log import log as logging
+from tempest import config
from octavia_tempest_plugin.common import constants as const
@@ -310,3 +311,12 @@
'scope? This configuration value should be same as '
'octavia.conf: [oslo_policy].enforce_scope option.'),
]
+
+
+def is_tungstenfabric_backend_enabled():
+ """Return True if TungstenFabric is used as a backend."""
+ try:
+ sdn = getattr(config.CONF, 'sdn')
+ return getattr(sdn, 'service_name', None) == 'tungstenfabric'
+ except cfg.NoSuchOptError:
+ return False
diff --git a/octavia_tempest_plugin/tests/api/v2/test_amphora.py b/octavia_tempest_plugin/tests/api/v2/test_amphora.py
index 3ecf664..9ce5fb1 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_amphora.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_amphora.py
@@ -76,9 +76,15 @@
* Validates that other accounts cannot see the amphora.
"""
lb_name = data_utils.rand_name("lb_member_lb2_amphora-list")
- lb = self.mem_lb_client.create_loadbalancer(
- name=lb_name, provider=CONF.load_balancer.provider,
- vip_network_id=self.lb_member_vip_net[const.ID])
+ lb_kwargs = {const.PROVIDER: CONF.load_balancer.provider,
+ const.NAME: lb_name}
+ if config.is_tungstenfabric_backend_enabled():
+ self._setup_lb_network_kwargs(lb_kwargs, 4)
+ else:
+ lb_kwargs.update({
+ const.VIP_NETWORK_ID: self.lb_member_vip_net[const.ID]
+ })
+ lb = self.mem_lb_client.create_loadbalancer(**lb_kwargs)
lb_id = lb[const.ID]
self.addCleanup(self.mem_lb_client.cleanup_loadbalancer, lb_id)
@@ -173,9 +179,15 @@
'Octavia API version 2.7 or newer.')
lb_name = data_utils.rand_name("lb_member_lb2_amphora-update")
- lb = self.mem_lb_client.create_loadbalancer(
- name=lb_name, provider=CONF.load_balancer.provider,
- vip_network_id=self.lb_member_vip_net[const.ID])
+ lb_kwargs = {const.PROVIDER: CONF.load_balancer.provider,
+ const.NAME: lb_name}
+ if config.is_tungstenfabric_backend_enabled():
+ self._setup_lb_network_kwargs(lb_kwargs, 4)
+ else:
+ lb_kwargs.update({
+ const.VIP_NETWORK_ID: self.lb_member_vip_net[const.ID]
+ })
+ lb = self.mem_lb_client.create_loadbalancer(**lb_kwargs)
lb_id = lb[const.ID]
self.addCleanup(self.mem_lb_client.cleanup_loadbalancer, lb_id)
diff --git a/octavia_tempest_plugin/tests/api/v2/test_listener.py b/octavia_tempest_plugin/tests/api/v2/test_listener.py
index f9b32c6..1868147 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_listener.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_listener.py
@@ -502,7 +502,7 @@
lb_name = data_utils.rand_name("lb_member_lb2_listener-list")
lb_kwargs = {const.NAME: lb_name,
const.PROVIDER: CONF.load_balancer.provider}
- if CONF.load_balancer.provider == 'tungstenfabric':
+ if config.is_tungstenfabric_backend_enabled():
self._setup_lb_network_kwargs(lb_kwargs, 4)
else:
lb_kwargs.update({
diff --git a/octavia_tempest_plugin/tests/api/v2/test_load_balancer.py b/octavia_tempest_plugin/tests/api/v2/test_load_balancer.py
index 50ad0e1..4aa3c46 100644
--- a/octavia_tempest_plugin/tests/api/v2/test_load_balancer.py
+++ b/octavia_tempest_plugin/tests/api/v2/test_load_balancer.py
@@ -175,7 +175,7 @@
lb_name = data_utils.rand_name("lb_member_lb1-delete")
lb_kwargs = {const.NAME: lb_name,
const.PROVIDER: CONF.load_balancer.provider}
- if CONF.load_balancer.provider == 'tungstenfabric':
+ if config.is_tungstenfabric_backend_enabled():
self._setup_lb_network_kwargs(lb_kwargs, 4)
else:
lb_kwargs.update({
@@ -229,9 +229,15 @@
* Validates the load balancer is in the DELETED state.
"""
lb_name = data_utils.rand_name("lb_member_lb1-cascade_delete")
- lb = self.mem_lb_client.create_loadbalancer(
- name=lb_name, provider=CONF.load_balancer.provider,
- vip_network_id=self.lb_member_vip_net[const.ID])
+ lb_kwargs = {const.NAME: lb_name,
+ const.PROVIDER: CONF.load_balancer.provider}
+ if config.is_tungstenfabric_backend_enabled():
+ self._setup_lb_network_kwargs(lb_kwargs, 4)
+ else:
+ lb_kwargs.update({
+ const.VIP_NETWORK_ID: self.lb_member_vip_net[const.ID]
+ })
+ lb = self.mem_lb_client.create_loadbalancer(**lb_kwargs)
self.addClassResourceCleanup(
self.mem_lb_client.cleanup_loadbalancer,
lb[const.ID])
@@ -277,7 +283,7 @@
return [lb for i, lb in enumerate(lbs) if i not in indexes]
def _setup_lb_kwargs(self, lb_kwargs):
- if CONF.load_balancer.provider == 'tungstenfabric':
+ if config.is_tungstenfabric_backend_enabled():
del lb_kwargs[const.VIP_NETWORK_ID]
self._setup_lb_network_kwargs(lb_kwargs, 4)
@@ -985,9 +991,15 @@
* Wait for the load balancer to go ACTIVE.
"""
lb_name = data_utils.rand_name("lb_member_lb1-failover")
- lb = self.mem_lb_client.create_loadbalancer(
- name=lb_name, provider=CONF.load_balancer.provider,
- vip_network_id=self.lb_member_vip_net[const.ID])
+ lb_kwargs = {const.NAME: lb_name,
+ const.PROVIDER: CONF.load_balancer.provider}
+ if config.is_tungstenfabric_backend_enabled():
+ self._setup_lb_network_kwargs(lb_kwargs, 4)
+ else:
+ lb_kwargs.update({
+ const.VIP_NETWORK_ID: self.lb_member_vip_net[const.ID]
+ })
+ lb = self.mem_lb_client.create_loadbalancer(**lb_kwargs)
self.addClassResourceCleanup(
self.mem_lb_client.cleanup_loadbalancer,
lb[const.ID])
diff --git a/octavia_tempest_plugin/tests/scenario/v2/test_pool.py b/octavia_tempest_plugin/tests/scenario/v2/test_pool.py
index d3959e7..07394cf 100644
--- a/octavia_tempest_plugin/tests/scenario/v2/test_pool.py
+++ b/octavia_tempest_plugin/tests/scenario/v2/test_pool.py
@@ -448,6 +448,12 @@
parser.parse(pool[const.CREATED_AT])
parser.parse(pool[const.UPDATED_AT])
UUID(pool[const.ID])
+ if CONF.load_balancer.provider == 'tungstenfabric':
+ # Operating status for a pool without members will be ONLINE if
+ # it is attached to a listener
+ self.assertEqual(const.ONLINE, pool[const.OPERATING_STATUS])
+ else:
+ self.assertEqual(const.OFFLINE, pool[const.OPERATING_STATUS])
self.assertEqual(pool_protocol, pool[const.PROTOCOL])
self.assertEqual(1, len(pool[const.LOADBALANCERS]))
self.assertEqual(self.lb_id, pool[const.LOADBALANCERS][0][const.ID])
diff --git a/octavia_tempest_plugin/tests/test_base.py b/octavia_tempest_plugin/tests/test_base.py
index a4e28b0..e758be3 100644
--- a/octavia_tempest_plugin/tests/test_base.py
+++ b/octavia_tempest_plugin/tests/test_base.py
@@ -34,6 +34,7 @@
from octavia_tempest_plugin.common import cert_utils
from octavia_tempest_plugin.common import constants as const
+from octavia_tempest_plugin import config as config_octavia
from octavia_tempest_plugin.tests import RBAC_tests
from octavia_tempest_plugin.tests import validators
from octavia_tempest_plugin.tests import waiters
@@ -596,7 +597,7 @@
@classmethod
def check_tf_compatibility(cls, protocol=None, algorithm=None):
# TungstenFabric supported protocols and algorithms
- tf_protocols = [const.HTTP, const.HTTPS, const.TCP, const.UDP,
+ tf_protocols = [const.HTTP, const.HTTPS, const.TCP,
const.TERMINATED_HTTPS]
tf_algorithms = [const.LB_ALGORITHM_ROUND_ROBIN,
const.LB_ALGORITHM_LEAST_CONNECTIONS,
@@ -873,7 +874,8 @@
LOG.debug('Octavia Setup: webserver2_public_ip = {}'.format(
cls.webserver2_public_ip))
- if CONF.load_balancer.test_with_ipv6:
+ if (CONF.load_balancer.test_with_ipv6 and not
+ config_octavia.is_tungstenfabric_backend_enabled()):
# Enable the IPv6 nic in webserver 1
cls._enable_ipv6_nic_webserver(
cls.webserver1_public_ip, cls.lb_member_keypair['private_key'],
@@ -1053,9 +1055,24 @@
network_id=network['id'],
mac_address=instance_network[0]['OS-EXT-IPS-MAC:mac_addr'])
port_id = result['ports'][0]['id']
- result = cls.lb_mem_float_ip_client.create_floatingip(
- floating_network_id=CONF.network.public_network_id,
- port_id=port_id)
+ if config_octavia.is_tungstenfabric_backend_enabled():
+ port = result['ports'][0]
+ fixed_ip = None
+ for ip in port["fixed_ips"]:
+ if (type(ipaddress.ip_address(ip["ip_address"])) is
+ ipaddress.IPv4Address):
+ fixed_ip = ip["ip_address"]
+ break
+ assert fixed_ip is not None, (f"Port doesn't have ipv4 "
+ f"address: {port['fixed_ips']}")
+ result = cls.lb_mem_float_ip_client.create_floatingip(
+ floating_network_id=CONF.network.public_network_id,
+ port_id=port_id,
+ fixed_ip_address=fixed_ip)
+ else:
+ result = cls.lb_mem_float_ip_client.create_floatingip(
+ floating_network_id=CONF.network.public_network_id,
+ port_id=port_id)
floating_ip = result['floatingip']
LOG.info('webserver1_floating_ip: {}'.format(floating_ip))
cls.addClassResourceCleanup(