659 lines
31 KiB
Python
659 lines
31 KiB
Python
# Copyright 2019 VMware Inc
|
|
# All Rights Reserved
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from tempest import config
|
|
from tempest.lib.common.utils import test_utils
|
|
from tempest.lib import decorators
|
|
from tempest import test
|
|
|
|
from vmware_nsx_tempest_plugin.common import constants
|
|
from vmware_nsx_tempest_plugin.lib import feature_manager
|
|
|
|
|
|
LOG = constants.log.getLogger(__name__)
|
|
CONF = config.CONF
|
|
|
|
|
|
class OctaviaRoundRobin(feature_manager.FeatureManager):
|
|
|
|
"""Base class to support LBaaS ROUND-ROBIN test.
|
|
|
|
It provides the methods to create loadbalancer network, and
|
|
start web servers.
|
|
|
|
Default lb_algorithm is ROUND_ROBIND.
|
|
"""
|
|
@classmethod
|
|
def setup_clients(cls):
|
|
super(OctaviaRoundRobin, cls).setup_clients()
|
|
cls.cmgr_adm = cls.get_client_manager('admin')
|
|
cls.cmgr_alt = cls.get_client_manager('alt')
|
|
cls.cmgr_adm = cls.get_client_manager('admin')
|
|
|
|
@classmethod
|
|
def skip_checks(cls):
|
|
super(OctaviaRoundRobin, cls).skip_checks()
|
|
cfg = CONF.network
|
|
if not test.is_extension_enabled('lbaasv2', 'network'):
|
|
msg = 'lbaasv2 extension is not enabled.'
|
|
raise cls.skipException(msg)
|
|
if not (cfg.project_networks_reachable or cfg.public_network_id):
|
|
msg = ('Either project_networks_reachable must be "true", or '
|
|
'public_network_id must be defined.')
|
|
raise cls.skipException(msg)
|
|
|
|
@classmethod
|
|
def resource_setup(cls):
|
|
super(OctaviaRoundRobin, cls).resource_setup()
|
|
|
|
@classmethod
|
|
def setup_credentials(cls):
|
|
# Ask framework to not create network resources for these tests.
|
|
cls.set_network_resources()
|
|
super(OctaviaRoundRobin, cls).setup_credentials()
|
|
|
|
def setUp(self):
|
|
super(OctaviaRoundRobin, self).setUp()
|
|
CONF.validation.ssh_shell_prologue = ''
|
|
self.vip_ip_address = ''
|
|
self.namestart = 'lbaas-ops'
|
|
self.poke_counters = 12
|
|
self.hm_delay = 4
|
|
self.hm_max_retries = 3
|
|
self.hm_timeout = 10
|
|
self.server_names = []
|
|
self.loadbalancer = None
|
|
self.vip_fip = None
|
|
self.web_service_start_delay = 2.5
|
|
|
|
def tearDown(self):
|
|
if self.vip_fip:
|
|
LOG.debug("tearDown lbass vip fip")
|
|
self.disassociate_floatingip(self.vip_fip, and_delete=True)
|
|
if self.loadbalancer:
|
|
LOG.debug("tearDown lbass")
|
|
lb_id = self.loadbalancer['id']
|
|
self.delete_octavia_lb_resources(lb_id)
|
|
|
|
LOG.debug("tearDown lbaas exiting...")
|
|
super(OctaviaRoundRobin, self).tearDown()
|
|
|
|
def deploy_octavia_topology(self, no_of_servers=2, image_id=None):
|
|
kwargs = {'name': "router_lbaas",
|
|
'external_gateway_info':
|
|
{"network_id": CONF.network.public_network_id}}
|
|
router_lbaas = self.cmgr_adm.routers_client.create_router(**kwargs)
|
|
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
|
self.routers_client.delete_router,
|
|
router_lbaas['router']['id'])
|
|
networks_client = self.cmgr_adm.networks_client
|
|
name = "network_lbaas_1"
|
|
network_lbaas_1 = self.\
|
|
create_topology_network(name,
|
|
networks_client=networks_client)
|
|
sec_rule_client = self.cmgr_adm.security_group_rules_client
|
|
sec_client = self.cmgr_adm.security_groups_client
|
|
kwargs = dict(tenant_id=network_lbaas_1['tenant_id'],
|
|
security_group_rules_client=sec_rule_client,
|
|
security_groups_client=sec_client)
|
|
self.sg = self.create_topology_security_group(**kwargs)
|
|
lbaas_rules = [dict(direction='ingress', protocol='tcp',
|
|
port_range_min=constants.HTTP_PORT,
|
|
port_range_max=constants.HTTP_PORT, ),
|
|
dict(direction='ingress', protocol='tcp',
|
|
port_range_min=443, port_range_max=443, )]
|
|
t_id = network_lbaas_1['tenant_id']
|
|
for rule in lbaas_rules:
|
|
self.add_security_group_rule(self.sg, rule,
|
|
secclient=sec_client,
|
|
ruleclient=sec_rule_client,
|
|
tenant_id=t_id)
|
|
body = {"network_id": network_lbaas_1['id'],
|
|
"allocation_pools": [{"start": "2.0.0.2", "end": "2.0.0.254"}],
|
|
"ip_version": 4, "cidr": "2.0.0.0/24"}
|
|
subnet_client = self.cmgr_adm.subnets_client
|
|
subnet_lbaas = subnet_client.create_subnet(**body)
|
|
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
|
subnet_client.delete_subnet,
|
|
subnet_lbaas['subnet']['id'])
|
|
self.cmgr_adm.routers_client.\
|
|
add_router_interface(router_lbaas['router']['id'],
|
|
subnet_id=subnet_lbaas['subnet']['id'])
|
|
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
|
self.cmgr_adm.routers_client.remove_router_interface,
|
|
router_lbaas['router']['id'],
|
|
subnet_id=subnet_lbaas['subnet']['id'])
|
|
for instance in range(0, no_of_servers):
|
|
self.create_topology_instance(
|
|
"server_lbaas_%s" % instance, [network_lbaas_1],
|
|
security_groups=[{'name': self.sg['name']}],
|
|
image_id=image_id, clients=self.cmgr_adm)
|
|
return dict(router=router_lbaas, subnet=subnet_lbaas,
|
|
network=network_lbaas_1)
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('c5ac8546-6867-4b7a-8704-3844b11b1a34')
|
|
def test_create_verify_octavia_lb_with_vip_subnet_id_rr(self):
|
|
"""
|
|
This testcase creates an octavia Loadbalancer with vip-subnet-ip
|
|
option, and verifies the traffic on the loadbalancer vip
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
self.create_project_octavia(protocol_type="HTTP", protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_subnet_id=subnet_id)
|
|
self.check_project_lbaas()
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('c5ac8546-6867-4b7a-8704-3844b11b1a34')
|
|
def test_create_verify_octavia_lb_with_vip_net_id_rr(self):
|
|
"""
|
|
This testcase creates an octavia Loadbalancer with vip-net-ip
|
|
option, and verifies the traffic on the loadbalancer vip
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
net_id = diction['network']['id']
|
|
self.create_project_octavia(protocol_type="HTTP", protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_net_id=net_id)
|
|
self.check_project_lbaas()
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('c5ac8546-6867-4b7a-8704-3844b11b1a34')
|
|
def test_create_verify_octavia_lb_with_vip_net_id_LC(self):
|
|
"""
|
|
This testcase creates an octavia Loadbalancer with vip-net-ip
|
|
option, and verifies the traffic on the loadbalancer vip
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
net_id = diction['network']['id']
|
|
self.create_project_octavia(protocol_type="HTTP", protocol_port="80",
|
|
lb_algorithm="LEAST_CONNECTIONS",
|
|
vip_net_id=net_id)
|
|
self.check_project_lbaas()
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('c5ac8546-6867-4b7a-8704-3844b11b1a34')
|
|
def test_create_verify_octavia_lb_with_vip_subnet_id_LC(self):
|
|
"""
|
|
This testcase creates an octavia Loadbalancer with vip-subnet-ip
|
|
option, and verifies the traffic on the loadbalancer vip
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
self.create_project_octavia(protocol_type="HTTP", protocol_port="80",
|
|
lb_algorithm="LEAST_CONNECTIONS",
|
|
vip_subnet_id=subnet_id)
|
|
self.check_project_lbaas()
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('c5ac8546-6867-4b7a-8704-3844b11b1a34')
|
|
def test_create_verify_octavia_lb_with_vip_subnet_id(self):
|
|
"""
|
|
This testcase creates an octavia Loadbalancer with vip-subnet-ip
|
|
option, and verifies the traffic on the loadbalancer vip
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
self.create_project_octavia(protocol_type="HTTP", protocol_port="80",
|
|
lb_algorithm="LEAST_CONNECTIONS",
|
|
vip_subnet_id=subnet_id)
|
|
self.check_project_lbaas()
|
|
get_lb = self.octavia_admin_client.list_octavia_load_balancers()
|
|
lb_id = get_lb['loadbalancers'][0]['id']
|
|
stat = self.octavia_admin_client.\
|
|
show_octavia_load_balancer_stats(lb_id)
|
|
assert (stat['stats']['bytes_in'] == 0 and
|
|
stat['stats']['bytes_out'] == 0)
|
|
self.check_lbaas_project_weight_values(constants.NO_OF_VMS_2)
|
|
stat = self.octavia_admin_client.\
|
|
show_octavia_load_balancer_stats(lb_id)
|
|
assert (stat['stats']['bytes_in'] >= 0 and
|
|
stat['stats']['bytes_out'] >= 0)
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('60e9ecaf-b8d6-48a9-b0d2-942e5bb38f38')
|
|
def test_octavia_http_round_robin_with_session_persistence(self):
|
|
"""
|
|
To verify the server count for LB pool with SOURCE_IP
|
|
session persistence and ROUND_ROBIN lb-algorithm
|
|
expected outcome is only one server responds to the
|
|
client requests
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
self.create_project_octavia(protocol_type="HTTP", protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_subnet_id=subnet_id, persistence=True,
|
|
persistence_type="SOURCE_IP")
|
|
self.check_lbaas_project_weight_values(constants.NO_OF_VMS_2,
|
|
hash_persistence=True)
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('60e9ecaf-b8d6-48a9-b0d2-942e5bb38f38')
|
|
def test_octavia_http_round_robin_with_net_id_session_persistence(self):
|
|
"""
|
|
To verify the server count for LB pool with SOURCE_IP
|
|
session persistence and ROUND_ROBIN lb-algorithm,
|
|
expected outcome is only one server responds to the
|
|
client requests.
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
net_id = diction['network']['id']
|
|
self.create_project_octavia(protocol_type="HTTP", protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_net_id=net_id, persistence=True,
|
|
persistence_type="SOURCE_IP")
|
|
self.check_lbaas_project_weight_values(constants.NO_OF_VMS_2,
|
|
hash_persistence=True)
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('c5ac8546-6768-4b7a-8704-3844b11b1a34')
|
|
def test_create_verify_lb_rr_with_allowed_cidr_on_listener(self):
|
|
"""
|
|
The Loadbalancer listener is created with allowed_cidrs specified
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
cidr_list = ['192.92.0.0/24', '192.94.0.0/16']
|
|
if not CONF.nsxv3.ens:
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
self.create_project_octavia(protocol_type="HTTP", protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_subnet_id=subnet_id,
|
|
allowed_cidrs=cidr_list)
|
|
|
|
self.check_project_lbaas()
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('ca5c8546-6768-4b7a-8704-3844b11b1a34')
|
|
def test_create_verify_lb_rr_with_allowed_cidr_0_0_0_0_on_listener(self):
|
|
"""
|
|
The Loadbalancer listener is created with allowed_cidrs specified
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
cidr_list = ['0.0.0.0/0']
|
|
if not CONF.nsxv3.ens:
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
self.create_project_octavia(protocol_type="HTTP", protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_subnet_id=subnet_id,
|
|
allowed_cidrs=cidr_list)
|
|
|
|
self.check_project_lbaas()
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('ca5c5468-6768-4b7a-8704-3844b11b1a34')
|
|
def test_create_REJECT_l7policies_listeneres(self):
|
|
"""
|
|
The Loadbalancer listener is created with allowed_cidrs specified
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
if not CONF.nsxv3.ens:
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
self.create_project_octavia(protocol_type="HTTP",
|
|
protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_subnet_id=subnet_id,
|
|
l7policy=True, action='REJECT')
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('ca5c4368-6768-4b7a-8704-3844b11b1a34')
|
|
def test_create_REDIRECT_TO_URL_l7policies_listeneres(self):
|
|
"""
|
|
The Loadbalancer listener is created with redirect_url l7policy
|
|
with no url specified.
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
if not CONF.nsxv3.ens:
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
self.create_project_octavia(protocol_type="HTTP",
|
|
protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_subnet_id=subnet_id,
|
|
l7policy=True,
|
|
action='REDIRECT_TO_URL')
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('ca5c4368-6768-4b7a-8704-3844b11b1b34')
|
|
def test_create_REDIRECT_TO_URL_url_l7policies_listeneres(self):
|
|
"""
|
|
The Loadbalancer listener is created with redirect_url l7policy
|
|
with url specified.
|
|
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
if not CONF.nsxv3.ens:
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
self.create_project_octavia(protocol_type="HTTP",
|
|
protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_subnet_id=subnet_id,
|
|
l7policy=True,
|
|
action='REDIRECT_TO_URL',
|
|
redirect_url='http://www.vmware.com')
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('ca5c4368-6768-4a7b-8704-3844b11b1b34')
|
|
def test_create_REDIRECT_TO_POOL_l7policies_listeneres(self):
|
|
"""
|
|
The Loadbalancer listener is created with redirect_pool l7policy
|
|
with url specified.
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
if not CONF.nsxv3.ens:
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
lb = self.create_project_octavia(protocol_type="HTTP",
|
|
protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_subnet_id=subnet_id)
|
|
listener = lb['listener_id']
|
|
self.octavia_admin_l7policies_client.create_octavia_l7policies(
|
|
listener_id=listener, action='REDIRECT_TO_POOL',
|
|
redirect_pool_id=lb['pool_id'])
|
|
self.octavia_admin_client.wait_for_load_balancer_status(lb['lb_id'])
|
|
l7p = self.octavia_admin_l7policies_client.list_octavia_l7policies(
|
|
lb['listener_id'])
|
|
for i in l7p['l7policies']:
|
|
if lb['listener_id'] == i['listener_id']:
|
|
l7p_id = i['id']
|
|
self.octavia_admin_l7policies_client.delete_octavia_l7policy(
|
|
l7p_id)
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('ca5c5468-6768-4a7a-8704-3844b11b1a34')
|
|
def test_create_REJECT_l7policies_with_rules_REGEX_compare_type(self):
|
|
"""
|
|
This testcase creates a l7policy to reject particular regex i.e
|
|
regex rule is added to the l7policy.
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
if not CONF.nsxv3.ens:
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
self.create_project_octavia(protocol_type="HTTP",
|
|
protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_subnet_id=subnet_id,
|
|
l7policy=True, action='REJECT',
|
|
compare_type='REGEX', type='PATH',
|
|
value='.*', l7rule=True)
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('ca5c5468-6768-4a7a-8704-3844b11b1a34')
|
|
def test_create_REJECT_l7policies_with_rules_CONTAINS_compare_type(self):
|
|
"""
|
|
This testcase creates a l7policy to reject particular regex i.e
|
|
regex rule is added to the l7policy.
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
if not CONF.nsxv3.ens:
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
self.create_project_octavia(protocol_type="HTTP",
|
|
protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_subnet_id=subnet_id,
|
|
l7policy=True, action='REJECT',
|
|
compare_type='CONTAINS', type='PATH',
|
|
value='.*', l7rule=True)
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('ca5c5468-6768-4a7a-8704-3844b11b1a34')
|
|
def test_create_REJECT_l7policies_with_rules_ENDS_WITH_compare_type(self):
|
|
"""
|
|
This testcase creates a l7policy to reject particular regex i.e
|
|
regex rule is added to the l7policy.
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
if not CONF.nsxv3.ens:
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
self.create_project_octavia(protocol_type="HTTP",
|
|
protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_subnet_id=subnet_id,
|
|
l7policy=True, action='REJECT',
|
|
compare_type='ENDS_WITH', type='PATH',
|
|
value='*', l7rule=True)
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('ca5c5468-6768-4a7a-8704-3844b11b1a34')
|
|
def test_create_REJECT_l7policies_with_rules_STARTS_WITH_cmpr_type(self):
|
|
"""
|
|
This testcase creates a l7policy to reject particular regex i.e
|
|
regex rule is added to the l7policy.
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
if not CONF.nsxv3.ens:
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
self.create_project_octavia(protocol_type="HTTP",
|
|
protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_subnet_id=subnet_id,
|
|
l7policy=True, action='REJECT',
|
|
compare_type='STARTS_WITH', type='PATH',
|
|
value='', l7rule=True)
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('ca5c5468-6768-4a7a-8704-3844b11b1a34')
|
|
def test_create_REJECT_l7policies_with_invert_enabled(self):
|
|
"""
|
|
This testcase creates a l7policy to reject particular regex i.e
|
|
regex rule is added to the l7policy.
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
if not CONF.nsxv3.ens:
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
self.create_project_octavia(protocol_type="HTTP",
|
|
protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_subnet_id=subnet_id,
|
|
l7policy=True, action='REJECT',
|
|
invert=True)
|
|
self.check_project_lbaas()
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('74f022d6-a6ef-4458-96a7-541deadacf99')
|
|
def test_octavia_http_http_traffic_with_barbican_secrets(self):
|
|
"""
|
|
Create octavia loadbalancer with http traffic with barbican enabled.
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
if not CONF.nsxv3.ens:
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
barbican_secrets = self.create_barbican_secret_conatainer(
|
|
constants.CERT_FILE, constants.KEY_FILE)
|
|
barbican_container = barbican_secrets['secret_container']
|
|
self.create_project_octavia(protocol_type="TERMINATED_HTTPS",
|
|
protocol_port="443",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_subnet_id=subnet_id,
|
|
barbican_container=barbican_container,
|
|
barbican=True, pool_protocol='HTTP')
|
|
self.check_project_lbaas()
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('74f022d6-a6ef-4458-96a7-541deadacf99')
|
|
def test_octavia_https_http_traffic_with_barbican_secrets(self):
|
|
"""
|
|
Create octavia loadbalancer with http traffic with barbican enabled.
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
if not CONF.nsxv3.ens:
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
barbican_secrets = self.create_barbican_secret_conatainer(
|
|
constants.CERT_FILE, constants.KEY_FILE)
|
|
barbican_container = barbican_secrets['secret_container']
|
|
self.create_project_octavia(protocol_type="TERMINATED_HTTPS",
|
|
protocol_port="443",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_subnet_id=subnet_id,
|
|
barbican_container=barbican_container,
|
|
barbican=True, pool_protocol='HTTPS')
|
|
self.check_project_lbaas()
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('c5ac8546-6867-4b7a-8704-3844b11b1a34')
|
|
def test_create_verify_octavia_lb_with_vip_net_id_LC_hm_ping(self):
|
|
"""
|
|
This testcase creates an octavia Loadbalancer with vip-net-ip
|
|
option, and verifies the traffic on the loadbalancer vip
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
net_id = diction['network']['id']
|
|
self.create_project_octavia(protocol_type="HTTP", protocol_port="80",
|
|
lb_algorithm="LEAST_CONNECTIONS",
|
|
vip_net_id=net_id, hm_type='PING',
|
|
timeout=self.hm_timeout,
|
|
max_retries=self.hm_max_retries,
|
|
delay=self.hm_delay)
|
|
self.check_project_lbaas()
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('c5ac8546-6867-4b7a-8704-3844b11b1a34')
|
|
def test_create_verify_octavia_lb_with_vip_net_id_LC_hm_ping_https(self):
|
|
"""
|
|
This testcase creates an octavia Loadbalancer with vip-net-ip
|
|
option, and verifies the traffic on the loadbalancer vip
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
net_id = diction['network']['id']
|
|
self.create_project_octavia(protocol_type="HTTPS", protocol_port="443",
|
|
lb_algorithm="LEAST_CONNECTIONS",
|
|
vip_net_id=net_id, hm_type='PING',
|
|
timeout=self.hm_timeout,
|
|
max_retries=self.hm_max_retries,
|
|
delay=self.hm_delay)
|
|
self.check_project_lbaas()
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('c5ac8546-6867-4b7a-8704-3844b11b1a34')
|
|
def test_create_verify_octavia_lb_with_vip_net_id_RR_hm_ping(self):
|
|
"""
|
|
This testcase creates an octavia Loadbalancer with vip-net-ip
|
|
option, and verifies the traffic on the loadbalancer vip
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
net_id = diction['network']['id']
|
|
self.create_project_octavia(protocol_type="HTTP", protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_net_id=net_id, hm_type='PING',
|
|
timeout=self.hm_timeout,
|
|
max_retries=self.hm_max_retries,
|
|
delay=self.hm_delay)
|
|
self.check_project_lbaas()
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('c5ac8546-6867-4b7a-8704-3844b11b1a34')
|
|
def test_create_verify_octavia_lb_with_vip_net_id_SOURCE_IP_hm_ping(self):
|
|
"""
|
|
This testcase creates an octavia Loadbalancer with vip-net-ip
|
|
option, and verifies the traffic on the loadbalancer vip
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
net_id = diction['network']['id']
|
|
self.create_project_octavia(protocol_type="HTTP", protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_net_id=net_id, hm_type='PING',
|
|
timeout=self.hm_timeout,
|
|
max_retries=self.hm_max_retries,
|
|
delay=self.hm_delay)
|
|
self.check_project_lbaas()
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('c5ac8546-6867-4b7a-8704-3844b11b1b43')
|
|
def test_verify_octavia_lb_vip_net_id_ROUND_ROBIN_default_pool(self):
|
|
"""
|
|
This testcase is for verifying the loadbalancer with net-id and
|
|
the pool is created using lb option and attached to a listener
|
|
with default-pool option
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
net_id = diction['network']['id']
|
|
self.create_project_octavia(protocol_type="HTTP", protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_net_id=net_id, hm_type='PING',
|
|
timeout=self.hm_timeout,
|
|
max_retries=self.hm_max_retries,
|
|
delay=self.hm_delay, default_pool=True)
|
|
self.check_project_lbaas()
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('c5ac8546-6867-4b7a-8704-3844b11a1b34')
|
|
def test_verify_octavia_lb_vip_subnet_id_rr_default_pool(self):
|
|
"""
|
|
This testcase is for verifying the loadbalancer with subnet-id and
|
|
the pool is created using lb option and attached to a listener
|
|
with default-pool option
|
|
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
subnet_id = diction['subnet']['subnet']['id']
|
|
self.create_project_octavia(protocol_type="HTTP", protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_subnet_id=subnet_id, hm_type='PING',
|
|
timeout=self.hm_timeout,
|
|
max_retries=self.hm_max_retries,
|
|
delay=self.hm_delay, default_pool=True)
|
|
self.check_project_lbaas()
|
|
|
|
@decorators.attr(type='nsxv3')
|
|
@decorators.idempotent_id('c5ac8546-6867-4b7a-8704-3843a11b1a34')
|
|
def test_verify_octavia_lb_port_id_rr_default_pool(self):
|
|
"""
|
|
This testcase is for verifying the loadbalancer with port-id and
|
|
the pool is created using lb option and attached to a listener
|
|
with default-pool option
|
|
|
|
"""
|
|
diction = self.deploy_octavia_topology()
|
|
self.start_web_servers(constants.HTTP_PORT)
|
|
net_id = diction['network']['id']
|
|
port_id = self.cmgr_adm.ports_client.create_port(
|
|
network_id=net_id)['port']['id']
|
|
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
|
self.cmgr_adm.ports_client.delete_port, port_id)
|
|
self.create_project_octavia(protocol_type="HTTP", protocol_port="80",
|
|
lb_algorithm="ROUND_ROBIN",
|
|
vip_port_id=port_id, hm_type='PING',
|
|
timeout=self.hm_timeout,
|
|
max_retries=self.hm_max_retries,
|
|
delay=self.hm_delay, default_pool=True)
|
|
self.check_project_lbaas()
|