[TF] Add support of tungstenfabric driver for octavia
Were skipped unsupported tests, avoided unsupported parameters
for loadbalancers, listeners, pools and members. Were met contrail
restrictions.
Related-PROD: PRODX-7072
Change-Id: I736f55fa4186464424e1ebc05c650f9a43375c62
(cherry picked from commit 0aece76a33ee755f6b56a70e8821b99c1f6b2600)
diff --git a/octavia_tempest_plugin/tests/test_base.py b/octavia_tempest_plugin/tests/test_base.py
index b0bd643..f485816 100644
--- a/octavia_tempest_plugin/tests/test_base.py
+++ b/octavia_tempest_plugin/tests/test_base.py
@@ -579,6 +579,48 @@
lb_kwargs[const.VIP_NETWORK_ID] = cls.lb_member_vip_net[const.ID]
lb_kwargs[const.VIP_SUBNET_ID] = None
+ @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,
+ const.TERMINATED_HTTPS]
+ tf_algorithms = [const.LB_ALGORITHM_ROUND_ROBIN,
+ const.LB_ALGORITHM_LEAST_CONNECTIONS,
+ const.LB_ALGORITHM_SOURCE_IP]
+
+ if algorithm and algorithm not in tf_algorithms:
+ raise cls.skipException(
+ 'TungstenFabric does not support {} algorithm.'
+ ''.format(algorithm))
+ if protocol and protocol not in tf_protocols:
+ raise cls.skipException(
+ 'TungstenFabric does not support {} protocol.'
+ ''.format(protocol))
+
+ @classmethod
+ def _tf_create_listener(cls, name, proto, port, lb_id):
+ listener_kwargs = {
+ const.NAME: name,
+ const.PROTOCOL: proto,
+ const.PROTOCOL_PORT: port,
+ const.LOADBALANCER_ID: lb_id,
+ }
+ listener = cls.mem_listener_client.create_listener(**listener_kwargs)
+ return listener
+
+ @classmethod
+ def _tf_get_free_port(cls, lb_id):
+ port = 8081
+ lb = cls.mem_lb_client.show_loadbalancer(lb_id)
+ listeners = lb[const.LISTENERS]
+ if not listeners:
+ return port
+ ports = [cls.mem_listener_client.show_listener(x[const.ID])[
+ const.PROTOCOL_PORT] for x in listeners]
+ while port in ports:
+ port = port + 1
+ return port
+
class LoadBalancerBaseTestWithCompute(LoadBalancerBaseTest):
@classmethod