ipv6 and octavia cases
Change-Id: I26c4cfa265feaf4ac8f568fac3851d1b70c30e39
This commit is contained in:
parent
30d21c198b
commit
fd3e4da19c
@ -1643,14 +1643,20 @@ class FeatureManager(traffic_manager.IperfManager,
|
||||
self.members = []
|
||||
for server_name in self.topology_servers.keys():
|
||||
if count < member_count:
|
||||
fip_data = self.servers_details[server_name].floating_ips[0]
|
||||
if fip_disassociate is True:
|
||||
x = str(self.topology_servers[server_name]['addresses'].
|
||||
keys()).split("'")[1]
|
||||
m = self.topology_servers[server_name]
|
||||
fixed_ip_address = m['addresses'][x][0]['addr']
|
||||
else:
|
||||
f_d = self.servers_details[server_name]
|
||||
fip_data = f_d.floating_ips[0]
|
||||
fixed_ip_address = fip_data['fixed_ip_address']
|
||||
if fip_disassociate is None:
|
||||
kwargs = dict(port_id=None)
|
||||
self.cmgr_adm.floating_ips_client.\
|
||||
update_floatingip(fip_data['id'],
|
||||
**kwargs)['floatingip']
|
||||
|
||||
if weight:
|
||||
weight += count
|
||||
member = self.octavia_admin_members_client.\
|
||||
@ -1673,6 +1679,9 @@ class FeatureManager(traffic_manager.IperfManager,
|
||||
update_port(self.loadbalancer['vip_port_id'],
|
||||
security_groups=[self.sg['id']])
|
||||
# create floatingip for public network
|
||||
if fip_disassociate is True:
|
||||
self.vip_ip_address = self.loadbalancer['vip_port_id']
|
||||
else:
|
||||
self.cmgr_adm.ports_client.update_port(
|
||||
self.loadbalancer['vip_port_id'],
|
||||
security_groups=[
|
||||
|
@ -16,6 +16,7 @@
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions
|
||||
from tempest import test
|
||||
|
||||
from vmware_nsx_tempest_plugin.common import constants
|
||||
@ -90,13 +91,14 @@ class OctaviaRoundRobin(feature_manager.FeatureManager):
|
||||
LOG.debug("tearDown lbaas exiting...")
|
||||
super(OctaviaRoundRobin, self).tearDown()
|
||||
|
||||
def deploy_octavia_topology(self, no_of_servers=2, image_id=None):
|
||||
def deploy_octavia_topology(self, no_of_servers=2,
|
||||
image_id=None, slaac=False):
|
||||
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,
|
||||
self.cmgr_adm.routers_client.delete_router,
|
||||
router_lbaas['router']['id'])
|
||||
networks_client = self.cmgr_adm.networks_client
|
||||
name = "network_lbaas_1"
|
||||
@ -120,9 +122,25 @@ class OctaviaRoundRobin(feature_manager.FeatureManager):
|
||||
secclient=sec_client,
|
||||
ruleclient=sec_rule_client,
|
||||
tenant_id=t_id)
|
||||
if slaac:
|
||||
address_cidr = CONF.network.project_network_v6_cidr
|
||||
address_prefixlen = CONF.network.project_network_v6_mask_bits
|
||||
if ((address_prefixlen >= 126)):
|
||||
msg = ("Subnet %s isn't large" % address_cidr)
|
||||
raise exceptions.InvalidConfiguration(msg)
|
||||
body = {'ip_version': 6, 'ipv6_ra_mode': 'slaac',
|
||||
'ipv6_address_mode': 'slaac', 'cidr': '2001:db8::/64',
|
||||
"network_id": network_lbaas_1['id'],
|
||||
'allocation_pools': [{
|
||||
'start': str(address_cidr).split('/')[0] + '2',
|
||||
'end': str(address_cidr).split('/')[0] + '70'}]}
|
||||
create_floating_ip = False
|
||||
else:
|
||||
body = {"network_id": network_lbaas_1['id'],
|
||||
"allocation_pools": [{"start": "2.0.0.2", "end": "2.0.0.254"}],
|
||||
"allocation_pools":
|
||||
[{"start": "2.0.0.2", "end": "2.0.0.254"}],
|
||||
"ip_version": 4, "cidr": "2.0.0.0/24"}
|
||||
create_floating_ip = True
|
||||
subnet_client = self.cmgr_adm.subnets_client
|
||||
subnet_lbaas = subnet_client.create_subnet(**body)
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
@ -139,7 +157,8 @@ class OctaviaRoundRobin(feature_manager.FeatureManager):
|
||||
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)
|
||||
image_id=image_id, clients=self.cmgr_adm,
|
||||
create_floating_ip=create_floating_ip)
|
||||
return dict(router=router_lbaas, subnet=subnet_lbaas,
|
||||
network=network_lbaas_1)
|
||||
|
||||
@ -330,7 +349,9 @@ class OctaviaRoundRobin(feature_manager.FeatureManager):
|
||||
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",
|
||||
self.assertRaises(exceptions.BadRequest,
|
||||
self.create_project_octavia,
|
||||
protocol_type="HTTP",
|
||||
protocol_port="80",
|
||||
lb_algorithm="ROUND_ROBIN",
|
||||
vip_subnet_id=subnet_id,
|
||||
@ -453,7 +474,9 @@ class OctaviaRoundRobin(feature_manager.FeatureManager):
|
||||
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",
|
||||
self.assertRaises(exceptions.BadRequest,
|
||||
self.create_project_octavia,
|
||||
protocol_type="HTTP",
|
||||
protocol_port="80",
|
||||
lb_algorithm="ROUND_ROBIN",
|
||||
vip_subnet_id=subnet_id,
|
||||
@ -478,7 +501,7 @@ class OctaviaRoundRobin(feature_manager.FeatureManager):
|
||||
vip_subnet_id=subnet_id,
|
||||
l7policy=True, action='REJECT',
|
||||
invert=True)
|
||||
self.check_project_lbaas()
|
||||
self.assertIn("KeyError", self.check_project_lbaas())
|
||||
|
||||
@decorators.attr(type='nsxv3')
|
||||
@decorators.idempotent_id('74f022d6-a6ef-4458-96a7-541deadacf99')
|
||||
@ -515,7 +538,7 @@ class OctaviaRoundRobin(feature_manager.FeatureManager):
|
||||
constants.CERT_FILE, constants.KEY_FILE)
|
||||
barbican_container = barbican_secrets['secret_container']
|
||||
self.create_project_octavia(protocol_type="TERMINATED_HTTPS",
|
||||
protocol_port="443",
|
||||
protocol_port="80",
|
||||
lb_algorithm="ROUND_ROBIN",
|
||||
vip_subnet_id=subnet_id,
|
||||
barbican_container=barbican_container,
|
||||
@ -550,7 +573,7 @@ class OctaviaRoundRobin(feature_manager.FeatureManager):
|
||||
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",
|
||||
self.create_project_octavia(protocol_type="HTTPS", protocol_port="80",
|
||||
lb_algorithm="LEAST_CONNECTIONS",
|
||||
vip_net_id=net_id, hm_type='PING',
|
||||
timeout=self.hm_timeout,
|
||||
@ -715,13 +738,13 @@ class OctaviaRoundRobin(feature_manager.FeatureManager):
|
||||
|
||||
"""
|
||||
diction = self.deploy_octavia_topology()
|
||||
self.start_web_servers(constants.HTTPS_PORT)
|
||||
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="HTTPS", protocol_port="443",
|
||||
self.create_project_octavia(protocol_type="HTTPS", protocol_port="80",
|
||||
lb_algorithm="SOURCE_IP",
|
||||
vip_port_id=port_id, hm_type='PING',
|
||||
timeout=self.hm_timeout,
|
||||
@ -739,13 +762,13 @@ class OctaviaRoundRobin(feature_manager.FeatureManager):
|
||||
|
||||
"""
|
||||
diction = self.deploy_octavia_topology()
|
||||
self.start_web_servers(constants.HTTPS_PORT)
|
||||
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="HTTPS", protocol_port="443",
|
||||
self.create_project_octavia(protocol_type="HTTPS", protocol_port="80",
|
||||
lb_algorithm="ROUND_ROBIN",
|
||||
vip_port_id=port_id, hm_type='PING',
|
||||
timeout=self.hm_timeout,
|
||||
@ -769,7 +792,7 @@ class OctaviaRoundRobin(feature_manager.FeatureManager):
|
||||
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="HTTPS", protocol_port="443",
|
||||
self.create_project_octavia(protocol_type="HTTPS", protocol_port="80",
|
||||
lb_algorithm="LEAST_CONNECTIONS",
|
||||
vip_port_id=port_id, hm_type='PING',
|
||||
timeout=self.hm_timeout,
|
||||
@ -894,3 +917,115 @@ class OctaviaRoundRobin(feature_manager.FeatureManager):
|
||||
delay=self.hm_delay, default_pool=True,
|
||||
qos_policy_id=policy['policy']['id'])
|
||||
self.check_project_lbaas()
|
||||
|
||||
@decorators.attr(type='nsxv3')
|
||||
@decorators.idempotent_id('c5ac8546-5677-4b7a-8704-3843a12b1a98')
|
||||
def test_verify_octavia_https_lb_port_id_source_ipv6_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, source_ip algorithm, https protocol.
|
||||
|
||||
"""
|
||||
diction = self.deploy_octavia_topology(slaac=True)
|
||||
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="HTTPS", protocol_port="80",
|
||||
lb_algorithm="SOURCE_IP",
|
||||
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,
|
||||
fip_disassociate=True)
|
||||
|
||||
@decorators.attr(type='nsxv3')
|
||||
@decorators.idempotent_id('c5ac8546-6867-4b7a-8704-3844b11b1b43')
|
||||
def test_ipv6__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,
|
||||
fip_disassociate=True)
|
||||
|
||||
@decorators.attr(type='nsxv3')
|
||||
@decorators.idempotent_id('c5ac8546-6867-4b7a-8544-3843a11b1a24')
|
||||
def test_ipv6_verify_octavia_https_lb_port_id_source_ip_default_pool_qos(
|
||||
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,SOURCE_IP https traffic
|
||||
|
||||
"""
|
||||
diction = self.deploy_octavia_topology()
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
net_id = diction['network']['id']
|
||||
policy = self.cmgr_adm.qos_client.create_qos_policy(
|
||||
name='test-policy', description='test policy desc1',
|
||||
shared=False)
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.cmgr_adm.qos_client.delete_qos_policy,
|
||||
policy['policy']['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="SOURCE_IP",
|
||||
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,
|
||||
qos_policy_id=policy['policy']['id'],
|
||||
fip_disassociate=True)
|
||||
|
||||
@decorators.attr(type='nsxv3')
|
||||
@decorators.idempotent_id('ca5c5468-6768-4b7a-8704-3844b11b1a34')
|
||||
def test_ipv6_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',
|
||||
fip_disassociate=True)
|
||||
|
||||
@decorators.attr(type='nsxv3')
|
||||
@decorators.idempotent_id('ca5c4368-6768-4b7a-8704-3844b11b1a34')
|
||||
def test_ipv6_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.assertRaises(exceptions.BadRequest,
|
||||
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',
|
||||
fip_disassociate=True)
|
||||
|
Loading…
Reference in New Issue
Block a user