[Tempest]: Added ENS scenario cases for overlay/vlan
Added vlan provider network ens based cases Added MDProxy ens overlay based cases Added Router NAT-NoNAt ens overlay based cases Added some of the upstream scenario cases for ens overlay Added some of the upstream scenario cases for ens vlan Added Lbaas cases Change-Id: I980d0e9fd89a000aaa60cab5c672f22d2f3f3fef
This commit is contained in:
parent
bad93f5922
commit
0fca206560
@ -65,7 +65,7 @@ TIME = {"SEC": {"SIXTY": 60}}
|
||||
|
||||
VLAN_TYPE = 'vlan'
|
||||
VXLAN_TYPE = 'geneve'
|
||||
VLAN = 2099
|
||||
VLAN = 4050
|
||||
|
||||
NO_OF_VMS_2 = 2
|
||||
NO_OF_VMS_4 = 4
|
||||
@ -77,7 +77,7 @@ REJECT = "REJECT"
|
||||
|
||||
# ZONE Designate
|
||||
ZONE_WAIT_TIME = 120
|
||||
#VPN
|
||||
# VPN
|
||||
PEER_ID = "172.24.4.12"
|
||||
PFS = "group14"
|
||||
ENCRYPTION_ALGO = "aes-128"
|
||||
|
@ -17,6 +17,7 @@ import collections
|
||||
import netaddr
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import netutils
|
||||
import re
|
||||
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
@ -105,7 +106,7 @@ class ApplianceManager(manager.NetworkScenarioTest):
|
||||
router = routers_client.create_router(
|
||||
name=name, admin_state_up=True, tenant_id=tenant_id)['router']
|
||||
if set_gateway is not False:
|
||||
if kwargs.get("enable_snat"):
|
||||
if kwargs.get("enable_snat") is not None:
|
||||
public_network_info = {"external_gateway_info": dict(
|
||||
network_id=self.topology_public_network_id,
|
||||
enable_snat=kwargs["enable_snat"])}
|
||||
@ -114,10 +115,38 @@ class ApplianceManager(manager.NetworkScenarioTest):
|
||||
network_id=self.topology_public_network_id)}
|
||||
routers_client.update_router(router['id'], **public_network_info)
|
||||
self.topology_routers[router_name] = router
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
routers_client.delete_router, router['id'])
|
||||
if CONF.nsxv3.ens:
|
||||
pass
|
||||
else:
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
routers_client.delete_router, router['id'])
|
||||
return router
|
||||
|
||||
def get_server_nics(self, ssh_client):
|
||||
reg = re.compile(r'(?P<num>\d+): (?P<nic_name>\w+)[@]?.*:')
|
||||
ipatxt = ssh_client.exec_command("ip address")
|
||||
return reg.findall(ipatxt)
|
||||
|
||||
def create_instance_interface(self, server):
|
||||
old_floating_ip, server = self.floating_ip_tuple
|
||||
ip_address = old_floating_ip['floating_ip_address']
|
||||
private_key = self._get_server_key(server)
|
||||
ssh_client = self.get_remote_client(
|
||||
ip_address, private_key=private_key, server=server)
|
||||
self.get_server_nics(ssh_client)
|
||||
# get a port from a list of one item
|
||||
port_list = self.os_admin.ports_client.list_ports(
|
||||
device_id=server['id'])['ports']
|
||||
self.assertEqual(1, len(port_list))
|
||||
interface = self.interface_client.create_interface(
|
||||
server_id=server['id'],
|
||||
net_id=self.new_net['id'])['interfaceAttachment']
|
||||
self.addCleanup(self.ports_client.wait_for_resource_deletion,
|
||||
interface['port_id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.interface_client.delete_interface,
|
||||
server['id'], interface['port_id'])
|
||||
|
||||
def update_topology_router(
|
||||
self, router_id, routers_client=None, **update_kwargs):
|
||||
if not routers_client:
|
||||
@ -134,7 +163,7 @@ class ApplianceManager(manager.NetworkScenarioTest):
|
||||
|
||||
def create_topology_network(
|
||||
self, network_name, networks_client=None,
|
||||
tenant_id=None, port_security_enabled=True, **kwargs):
|
||||
tenant_id=None, **kwargs):
|
||||
if not networks_client:
|
||||
networks_client = self.networks_client
|
||||
if not tenant_id:
|
||||
@ -144,7 +173,10 @@ class ApplianceManager(manager.NetworkScenarioTest):
|
||||
# Neutron disables port security by default so we have to check the
|
||||
# config before trying to create the network with port_security_enabled
|
||||
if CONF.network_feature_enabled.port_security:
|
||||
port_security_enabled = True
|
||||
if not CONF.nsxv3.ens:
|
||||
port_security_enabled = True
|
||||
else:
|
||||
port_security_enabled = False
|
||||
else:
|
||||
port_security_enabled = False
|
||||
result = networks_client.create_network(
|
||||
|
@ -401,20 +401,28 @@ class FeatureManager(traffic_manager.IperfManager,
|
||||
time.sleep(constants.SLEEP_BETWEEN_VIRTUAL_SEREVRS_OPEARTIONS)
|
||||
self.do_http_request(vip=vip, send_counts=self.poke_counters)
|
||||
# ROUND_ROUBIN, so equal counts
|
||||
no_of_vms = len(self.http_cnt)
|
||||
if no_of_vms:
|
||||
if (self.http_cnt['server_lbaas_0'] <
|
||||
(self.poke_counters / no_of_vms)):
|
||||
self.assertGreater(self.http_cnt['server_lbaas_1'],
|
||||
self.poke_counters / no_of_vms)
|
||||
elif (self.http_cnt['server_lbaas_0'] >
|
||||
(self.poke_counters / no_of_vms)):
|
||||
self.assertLess(self.http_cnt['server_lbaas_1'],
|
||||
self.poke_counters / no_of_vms)
|
||||
else:
|
||||
self.assertEqual(self.http_cnt['server_lbaas_1'],
|
||||
self.poke_counters / no_of_vms,
|
||||
if CONF.nsxv3.ens:
|
||||
vms = len(self.topology_servers.keys())
|
||||
if vms:
|
||||
self.assertEqual(self.http_cnt["Welcome vm"] / 2, 3 * vms,
|
||||
"LB fails with weighted values")
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
no_of_vms = len(self.http_cnt)
|
||||
if no_of_vms:
|
||||
if (self.http_cnt['server_lbaas_0'] <
|
||||
(self.poke_counters / no_of_vms)):
|
||||
self.assertGreater(self.http_cnt['server_lbaas_1'],
|
||||
self.poke_counters / no_of_vms)
|
||||
elif (self.http_cnt['server_lbaas_0'] >
|
||||
(self.poke_counters / no_of_vms)):
|
||||
self.assertLess(self.http_cnt['server_lbaas_1'],
|
||||
self.poke_counters / no_of_vms)
|
||||
else:
|
||||
self.assertEqual(self.http_cnt['server_lbaas_1'],
|
||||
self.poke_counters / no_of_vms,
|
||||
"LB fails with weighted values")
|
||||
|
||||
def check_project_lbaas(self, count=2):
|
||||
i = 0
|
||||
@ -423,13 +431,19 @@ class FeatureManager(traffic_manager.IperfManager,
|
||||
self.do_http_request(vip=vip, send_counts=self.poke_counters)
|
||||
# ROUND_ROUBIN, so equal counts
|
||||
no_of_vms = len(self.http_cnt)
|
||||
for server_name in self.topology_servers.keys():
|
||||
if i < count:
|
||||
i += 1
|
||||
self.assertEqual(self.poke_counters / no_of_vms,
|
||||
self.http_cnt[server_name])
|
||||
else:
|
||||
break
|
||||
if CONF.nsxv3.ens:
|
||||
vms = len(self.topology_servers.keys())
|
||||
if self.http_cnt["Welcome vm"] == self.poke_counters:
|
||||
self.assertEqual(self.http_cnt["Welcome vm"] / vms,
|
||||
3 * vms)
|
||||
else:
|
||||
for server_name in self.topology_servers.keys():
|
||||
if i < count:
|
||||
i += 1
|
||||
self.assertEqual(self.poke_counters / no_of_vms,
|
||||
self.http_cnt[server_name])
|
||||
else:
|
||||
break
|
||||
|
||||
def count_response(self, response):
|
||||
if response in self.http_cnt:
|
||||
@ -501,9 +515,10 @@ class FeatureManager(traffic_manager.IperfManager,
|
||||
count += 1
|
||||
else:
|
||||
break
|
||||
self.ports_client.update_port(
|
||||
self.loadbalancer['vip_port_id'],
|
||||
security_groups=[self.sg['id']])
|
||||
if not CONF.nsxv3.ens:
|
||||
self.ports_client.update_port(
|
||||
self.loadbalancer['vip_port_id'],
|
||||
security_groups=[self.sg['id']])
|
||||
# create lbaas public interface
|
||||
vip_fip = \
|
||||
self.create_floatingip(self.loadbalancer,
|
||||
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
import shlex
|
||||
import subprocess
|
||||
import tempfile
|
||||
@ -22,6 +23,7 @@ import urllib3
|
||||
from oslo_log import log as logging
|
||||
|
||||
from tempest.common.utils.linux import remote_client
|
||||
from tempest.common import waiters
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
from tempest.lib.common.utils import test_utils
|
||||
@ -45,6 +47,15 @@ class TrafficManager(appliance_manager.ApplianceManager):
|
||||
self.check_remote_connectivity(ssh_source, remote_ip,
|
||||
should_succeed=should_connect)
|
||||
|
||||
def wait_server_status(self, client, server_id, state='ACTIVE'):
|
||||
if client is None:
|
||||
servers_client = self.servers_client
|
||||
else:
|
||||
servers_client = client
|
||||
waiters.wait_for_server_status(servers_client, server_id,
|
||||
state)
|
||||
time.sleep(60)
|
||||
|
||||
def check_network_internal_connectivity(
|
||||
self, network, floating_ip, server, should_connect=True):
|
||||
"""via ssh check VM internal connectivity:
|
||||
@ -101,7 +112,7 @@ class TrafficManager(appliance_manager.ApplianceManager):
|
||||
username = CONF.validation.image_ssh_user
|
||||
# Set this with 'keypair' or others to log in with keypair or
|
||||
# username/password.
|
||||
if use_password:
|
||||
if CONF.nsxv3.ens or use_password:
|
||||
password = CONF.validation.image_ssh_password
|
||||
private_key = None
|
||||
else:
|
||||
@ -134,6 +145,10 @@ class TrafficManager(appliance_manager.ApplianceManager):
|
||||
if not floating_ip:
|
||||
LOG.error("Without floating ip, failed to verify SSH connectivity")
|
||||
raise
|
||||
if CONF.nsxv3.ens or use_password:
|
||||
private_key = None
|
||||
else:
|
||||
private_key = private_key
|
||||
ssh_client = self._get_remote_client(
|
||||
ip_address=floating_ip, username=self.ssh_user,
|
||||
private_key=private_key, use_password=use_password)
|
||||
@ -170,13 +185,24 @@ class TrafficManager(appliance_manager.ApplianceManager):
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def query_ens(self, web_ip):
|
||||
wget = "curl http://{0}/".format(web_ip)
|
||||
resp = os.popen(wget).read().rstrip()
|
||||
if "vm" in resp:
|
||||
self.count_response(resp)
|
||||
return self.http_cnt
|
||||
|
||||
def do_http_request(self, vip, start_path='', send_counts=None):
|
||||
# http_cnt stores no of requests made for each members
|
||||
self.http_cnt = {}
|
||||
for x in range(send_counts):
|
||||
resp = self.query_webserver(vip)
|
||||
if not CONF.nsxv3.ens:
|
||||
for x in range(send_counts):
|
||||
resp = self.query_webserver(vip)
|
||||
self.count_response(resp)
|
||||
else:
|
||||
for x in range(send_counts):
|
||||
self.http_cnt = self.query_ens(vip)
|
||||
# count_response counts the no of requests made for each members
|
||||
self.count_response(resp)
|
||||
return self.http_cnt
|
||||
|
||||
def start_web_server(self, protocol_port, server, server_name=None):
|
||||
|
@ -127,7 +127,6 @@ class BaseTestCase(base.BaseNetworkTest):
|
||||
test_utils.call_and_ignore_notfound_exc(
|
||||
cls._delete_load_balancer, lb_id)
|
||||
# NSX-v: delete exclusive router
|
||||
cls.delete_router(cls.router)
|
||||
super(BaseTestCase, cls).resource_cleanup()
|
||||
|
||||
@classmethod
|
||||
|
@ -13,9 +13,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import time
|
||||
|
||||
from tempest import config
|
||||
from tempest.lib import decorators
|
||||
|
||||
from vmware_nsx_tempest.common import constants
|
||||
from vmware_nsx_tempest.lib import feature_manager
|
||||
from vmware_nsx_tempest.services import nsx_client
|
||||
|
||||
@ -64,17 +67,192 @@ class TestEnsOps(feature_manager.FeatureManager):
|
||||
ping_cmd = "ping -c 1 %s " % fip
|
||||
self.exec_cmd_on_server_using_fip(ping_cmd, ssh_client=client)
|
||||
|
||||
def provider_networks_topoloy(self, net_type,
|
||||
admin_state_up=True,
|
||||
tz_id=None,
|
||||
vlan_id_unique=None):
|
||||
networks_client = self.admin_mgr.networks_client
|
||||
name = "provider_network_vlan"
|
||||
if vlan_id_unique is None:
|
||||
vlan_id_no = constants.VLAN
|
||||
else:
|
||||
vlan_id_no = vlan_id_unique
|
||||
body = {"provider:segmentation_id": vlan_id_no,
|
||||
"provider:network_type": net_type,
|
||||
"admin_state_up": admin_state_up}
|
||||
network = self.create_topology_network(name,
|
||||
networks_client=networks_client,
|
||||
**body)
|
||||
return network
|
||||
|
||||
|
||||
class EnsScenarioTest(TestEnsOps):
|
||||
|
||||
@decorators.idempotent_id('a57de68f-24e5-4cae-833f-0244e4eb3960')
|
||||
def test_ens_vlan_traffic_across_networks_scenario(self):
|
||||
provider_network = self.provider_networks_topoloy(
|
||||
constants.VLAN_TYPE)
|
||||
subnet_client = self.admin_mgr.subnets_client
|
||||
router = self.create_topology_router(
|
||||
"rtr-provider", routers_client=self.admin_mgr.routers_client)
|
||||
subnet_name = provider_network['name'] + '_subnet'
|
||||
self.create_topology_subnet(
|
||||
subnet_name,
|
||||
provider_network,
|
||||
subnets_client=subnet_client,
|
||||
routers_client=self.admin_mgr.routers_client,
|
||||
router_id=router['id'])
|
||||
provider_network1 = self.provider_networks_topoloy(
|
||||
constants.VLAN_TYPE,
|
||||
vlan_id_unique=1003)
|
||||
subnet_name = provider_network1['name'] + '_subnet1'
|
||||
kwargs = {"enable_dhcp": "True"}
|
||||
self.create_topology_subnet(
|
||||
subnet_name,
|
||||
provider_network1,
|
||||
subnets_client=subnet_client,
|
||||
routers_client=self.admin_mgr.routers_client,
|
||||
router_id=router['id'],
|
||||
cidr="19.0.0.0/24",
|
||||
**kwargs)
|
||||
image_id = self.get_glance_image_id(['cirros'])
|
||||
self.create_topology_instance(
|
||||
"ens_vm_1", [provider_network],
|
||||
create_floating_ip=True, image_id=image_id, clients=self.admin_mgr)
|
||||
self.create_topology_instance(
|
||||
"ens_vm_2", [provider_network1],
|
||||
create_floating_ip=True, image_id=image_id, clients=self.admin_mgr)
|
||||
# Verify E-W traffic
|
||||
self.check_cross_network_connectivity(
|
||||
provider_network,
|
||||
self.servers_details["ens_vm_1"].floating_ips[0],
|
||||
self.servers_details["ens_vm_1"].server, should_connect=True)
|
||||
self.check_cross_network_connectivity(
|
||||
provider_network1,
|
||||
self.servers_details["ens_vm_2"].floating_ips[0],
|
||||
self.servers_details["ens_vm_2"].server, should_connect=True)
|
||||
# Verify fip ping N-S traffic
|
||||
for server, details in self.servers_details.items():
|
||||
self.verify_ping_to_fip_from_ext_vm(details)
|
||||
|
||||
@decorators.idempotent_id('3db32aec-afe9-4b94-9a3f-763f5fe0eb50')
|
||||
def test_server_vlan_connectivity_suspend_resume(self):
|
||||
network_ens = self.provider_networks_topoloy(
|
||||
constants.VLAN_TYPE)
|
||||
subnet_client = self.admin_mgr.subnets_client
|
||||
router_ens = self.create_topology_router(
|
||||
"rtr-provider", routers_client=self.admin_mgr.routers_client)
|
||||
subnet_name = "subnet_ens"
|
||||
self.create_topology_subnet(
|
||||
subnet_name,
|
||||
network_ens,
|
||||
subnets_client=subnet_client,
|
||||
routers_client=self.admin_mgr.routers_client,
|
||||
router_id=router_ens['id'])
|
||||
image_id = self.get_glance_image_id(['cirros'])
|
||||
self.create_topology_instance(
|
||||
"ens_vm_1", [network_ens],
|
||||
create_floating_ip=True, image_id=image_id, clients=self.admin_mgr)
|
||||
server = self.servers_details["ens_vm_1"].server
|
||||
server_id = self.servers_details["ens_vm_1"].server['id']
|
||||
self.admin_mgr.servers_client.suspend_server(server_id)
|
||||
self.wait_server_status(
|
||||
self.admin_mgr.servers_client,
|
||||
server_id,
|
||||
'SUSPENDED')
|
||||
fip_data = server.get('floating_ips')[0]
|
||||
self.admin_mgr.servers_client.resume_server(server_id)
|
||||
self.wait_server_status(self.admin_mgr.servers_client, server_id)
|
||||
self.check_network_internal_connectivity(network_ens, fip_data,
|
||||
server, should_connect=True)
|
||||
for server, details in self.servers_details.items():
|
||||
self.verify_ping_to_fip_from_ext_vm(details)
|
||||
|
||||
@decorators.idempotent_id('5a908dfb-b16b-430a-93c6-be7b28b36b6c')
|
||||
def test_server_vlan_connectivity_stop_start(self):
|
||||
network_ens = self.provider_networks_topoloy(
|
||||
constants.VLAN_TYPE)
|
||||
subnet_client = self.admin_mgr.subnets_client
|
||||
router_ens = self.create_topology_router(
|
||||
"rtr-provider", routers_client=self.admin_mgr.routers_client)
|
||||
subnet_name = "subnet_ens"
|
||||
self.create_topology_subnet(
|
||||
subnet_name,
|
||||
network_ens,
|
||||
subnets_client=subnet_client,
|
||||
routers_client=self.admin_mgr.routers_client,
|
||||
router_id=router_ens['id'])
|
||||
image_id = self.get_glance_image_id(['cirros'])
|
||||
self.create_topology_instance(
|
||||
"ens_vm_1", [network_ens],
|
||||
create_floating_ip=True, image_id=image_id, clients=self.admin_mgr)
|
||||
server = self.servers_details["ens_vm_1"].server
|
||||
server_id = self.servers_details["ens_vm_1"].server['id']
|
||||
self.admin_mgr.servers_client.stop_server(server_id)
|
||||
time.sleep(60)
|
||||
fip_data = server.get('floating_ips')[0]
|
||||
self.admin_mgr.servers_client.start_server(server_id)
|
||||
self.wait_server_status(self.admin_mgr.servers_client, server_id)
|
||||
self.check_network_internal_connectivity(network_ens, fip_data,
|
||||
server, should_connect=True)
|
||||
for server, details in self.servers_details.items():
|
||||
self.verify_ping_to_fip_from_ext_vm(details)
|
||||
|
||||
@decorators.idempotent_id('14dd6559-8855-4f53-b1cd-82a9ccc98179')
|
||||
def test_ens_vlan_traffic_scenario(self):
|
||||
provider_network = self.provider_networks_topoloy(
|
||||
constants.VLAN_TYPE)
|
||||
subnet_client = self.admin_mgr.subnets_client
|
||||
router = self.create_topology_router(
|
||||
"rtr-provider", routers_client=self.admin_mgr.routers_client)
|
||||
subnet_name = provider_network['name'] + '_subnet'
|
||||
self.create_topology_subnet(
|
||||
subnet_name,
|
||||
provider_network,
|
||||
subnets_client=subnet_client,
|
||||
routers_client=self.admin_mgr.routers_client,
|
||||
router_id=router['id'])
|
||||
provider_network1 = self.provider_networks_topoloy(
|
||||
constants.VLAN_TYPE,
|
||||
vlan_id_unique=1003)
|
||||
subnet_name = provider_network1['name'] + '_subnet1'
|
||||
kwargs = {"enable_dhcp": "True"}
|
||||
self.create_topology_subnet(
|
||||
subnet_name,
|
||||
provider_network1,
|
||||
subnets_client=subnet_client,
|
||||
routers_client=self.admin_mgr.routers_client,
|
||||
router_id=router['id'],
|
||||
cidr="19.0.0.0/24",
|
||||
**kwargs)
|
||||
image_id = self.get_glance_image_id(['cirros'])
|
||||
self.create_topology_instance(
|
||||
"ens_vm_1", [provider_network],
|
||||
create_floating_ip=True, image_id=image_id, clients=self.admin_mgr)
|
||||
self.create_topology_instance(
|
||||
"ens_vm_2", [provider_network],
|
||||
create_floating_ip=True, image_id=image_id, clients=self.admin_mgr)
|
||||
# Verify E-W traffic
|
||||
self.check_cross_network_connectivity(
|
||||
provider_network,
|
||||
self.servers_details["ens_vm_1"].floating_ips[0],
|
||||
self.servers_details["ens_vm_1"].server, should_connect=True)
|
||||
self.check_cross_network_connectivity(
|
||||
provider_network,
|
||||
self.servers_details["ens_vm_2"].floating_ips[0],
|
||||
self.servers_details["ens_vm_2"].server, should_connect=True)
|
||||
# Verify fip ping N-S traffic
|
||||
for server, details in self.servers_details.items():
|
||||
self.verify_ping_to_fip_from_ext_vm(details)
|
||||
|
||||
@decorators.idempotent_id('2544b6e2-f61b-4f0a-8821-5274e8e1baa1')
|
||||
def test_ens_overlay_traffic_scenario(self):
|
||||
router_ens = self.create_topology_router("router_ens")
|
||||
# Qos network
|
||||
network_ens = self.create_topology_network("network_ens")
|
||||
self.create_topology_subnet("subnet_ens", network_ens,
|
||||
router_id=router_ens["id"])
|
||||
image_id = self.get_glance_image_id(['cirros', 'esx'])
|
||||
router_id=router_ens["id"])
|
||||
image_id = self.get_glance_image_id(['cirros'])
|
||||
self.create_topology_instance(
|
||||
"ens_vm_1", [network_ens],
|
||||
create_floating_ip=True, image_id=image_id)
|
||||
@ -95,3 +273,193 @@ class EnsScenarioTest(TestEnsOps):
|
||||
self.verify_ping_to_fip_from_ext_vm(details)
|
||||
self.verify_ping_own_fip(self.topology_servers["ens_vm_1"])
|
||||
self.verify_ping_own_fip(self.topology_servers["ens_vm_2"])
|
||||
|
||||
@decorators.idempotent_id('660a02f0-c01b-4e0e-9a99-7e6337b895f8')
|
||||
def test_ens_overlay_traffic_scenario_diff_tenants(self):
|
||||
router_ens = self.create_topology_router("router_ens")
|
||||
network_ens1 = self.create_topology_network("network_ens1")
|
||||
network_ens2 = self.create_topology_network("network_ens2")
|
||||
self.create_topology_subnet("subnet_ens1", network_ens1,
|
||||
router_id=router_ens["id"])
|
||||
self.create_topology_subnet("subnet_ens2", network_ens2,
|
||||
router_id=router_ens["id"])
|
||||
image_id = self.get_glance_image_id(['cirros'])
|
||||
self.create_topology_instance(
|
||||
"ens_vm_1", [network_ens1],
|
||||
create_floating_ip=True, image_id=image_id)
|
||||
self.create_topology_instance(
|
||||
"ens_vm_2", [network_ens2],
|
||||
create_floating_ip=True, image_id=image_id)
|
||||
# Verify E-W traffic
|
||||
self.check_cross_network_connectivity(
|
||||
self.topology_networks["network_ens1"],
|
||||
self.servers_details["ens_vm_1"].floating_ips[0],
|
||||
self.servers_details["ens_vm_1"].server, should_connect=True)
|
||||
self.check_cross_network_connectivity(
|
||||
self.topology_networks["network_ens2"],
|
||||
self.servers_details["ens_vm_2"].floating_ips[0],
|
||||
self.servers_details["ens_vm_2"].server, should_connect=True)
|
||||
# Verify fip ping N-S traffic
|
||||
for server, details in self.servers_details.items():
|
||||
self.verify_ping_to_fip_from_ext_vm(details)
|
||||
self.verify_ping_own_fip(self.topology_servers["ens_vm_1"])
|
||||
self.verify_ping_own_fip(self.topology_servers["ens_vm_2"])
|
||||
|
||||
@decorators.idempotent_id('fc93db11-164c-40af-8484-ab7561e040e9')
|
||||
def test_ens_overlay_traffic_scenario_diff_tier1_routers(self):
|
||||
router_ens1 = self.create_topology_router("router_ens1")
|
||||
router_ens2 = self.create_topology_router("router_ens2")
|
||||
network_ens1 = self.create_topology_network("network_ens1")
|
||||
network_ens2 = self.create_topology_network("network_ens2")
|
||||
self.create_topology_subnet("subnet_ens1", network_ens1,
|
||||
router_id=router_ens1["id"])
|
||||
self.create_topology_subnet("subnet_ens2", network_ens2,
|
||||
router_id=router_ens2["id"])
|
||||
image_id = self.get_glance_image_id(['cirros'])
|
||||
self.create_topology_instance(
|
||||
"ens_vm_1", [network_ens1],
|
||||
create_floating_ip=True, image_id=image_id)
|
||||
self.create_topology_instance(
|
||||
"ens_vm_2", [network_ens2],
|
||||
create_floating_ip=True, image_id=image_id)
|
||||
# Verify E-W traffic
|
||||
self.check_cross_network_connectivity(
|
||||
self.topology_networks["network_ens1"],
|
||||
self.servers_details["ens_vm_1"].floating_ips[0],
|
||||
self.servers_details["ens_vm_1"].server, should_connect=True)
|
||||
self.check_cross_network_connectivity(
|
||||
self.topology_networks["network_ens2"],
|
||||
self.servers_details["ens_vm_2"].floating_ips[0],
|
||||
self.servers_details["ens_vm_2"].server, should_connect=True)
|
||||
# Verify fip ping N-S traffic
|
||||
for server, details in self.servers_details.items():
|
||||
self.verify_ping_to_fip_from_ext_vm(details)
|
||||
self.verify_ping_own_fip(self.topology_servers["ens_vm_1"])
|
||||
self.verify_ping_own_fip(self.topology_servers["ens_vm_2"])
|
||||
|
||||
@decorators.idempotent_id('b1496d96-baf3-4ee1-9fda-80b155b95cac')
|
||||
def test_server_connectivity_stop_start(self):
|
||||
router_ens1 = self.create_topology_router("router_ens1")
|
||||
network_ens1 = self.create_topology_network("network_ens1")
|
||||
self.create_topology_subnet("subnet_ens1", network_ens1,
|
||||
router_id=router_ens1["id"])
|
||||
image_id = self.get_glance_image_id(['cirros'])
|
||||
self.create_topology_instance(
|
||||
"ens_vm_1", [network_ens1],
|
||||
create_floating_ip=True, image_id=image_id)
|
||||
server_id = self.servers_details["ens_vm_1"].server['id']
|
||||
self.admin_mgr.servers_client.stop_server(server_id)
|
||||
time.sleep(60)
|
||||
self.wait_server_status(self.admin_mgr.servers_client, server_id)
|
||||
server = self.servers_details["ens_vm_1"].server
|
||||
fip_data = server.get('floating_ips')[0]
|
||||
self.admin_mgr.servers_client.start_server(server_id)
|
||||
self.wait_server_status(self.admin_mgr.servers_client, server_id)
|
||||
self.check_network_internal_connectivity(network_ens1, fip_data,
|
||||
server, should_connect=True)
|
||||
for server, details in self.servers_details.items():
|
||||
self.verify_ping_to_fip_from_ext_vm(details)
|
||||
|
||||
@decorators.idempotent_id('e8ab2c41-cee4-4b4b-aa7f-da0cb6c37684')
|
||||
def test_server_connectivity_reboot(self):
|
||||
router_ens1 = self.create_topology_router("router_ens1")
|
||||
network_ens1 = self.create_topology_network("network_ens1")
|
||||
self.create_topology_subnet("subnet_ens1", network_ens1,
|
||||
router_id=router_ens1["id"])
|
||||
image_id = self.get_glance_image_id(['cirros'])
|
||||
self.create_topology_instance(
|
||||
"ens_vm_1", [network_ens1],
|
||||
create_floating_ip=True, image_id=image_id)
|
||||
server_id = self.servers_details["ens_vm_1"].server['id']
|
||||
server = self.servers_details["ens_vm_1"].server
|
||||
fip_data = server.get('floating_ips')[0]
|
||||
self.admin_mgr.servers_client.reboot_server(server_id, type='SOFT')
|
||||
self.wait_server_status(self.admin_mgr.servers_client, server_id)
|
||||
self.check_network_internal_connectivity(network_ens1, fip_data,
|
||||
server, should_connect=True)
|
||||
for server, details in self.servers_details.items():
|
||||
self.verify_ping_to_fip_from_ext_vm(details)
|
||||
|
||||
@decorators.idempotent_id('2ca25c94-195b-4223-921b-1b973da09d29')
|
||||
def test_server_connectivity_rebuild(self):
|
||||
router_ens1 = self.create_topology_router("router_ens1")
|
||||
network_ens1 = self.create_topology_network("network_ens1")
|
||||
self.create_topology_subnet("subnet_ens1", network_ens1,
|
||||
router_id=router_ens1["id"])
|
||||
image_id = self.get_glance_image_id(['cirros'])
|
||||
self.create_topology_instance(
|
||||
"ens_vm_1", [network_ens1],
|
||||
create_floating_ip=True, image_id=image_id)
|
||||
server_id = self.servers_details["ens_vm_1"].server['id']
|
||||
server = self.servers_details["ens_vm_1"].server
|
||||
fip_data = server.get('floating_ips')[0]
|
||||
image_ref_alt = CONF.compute.image_ref_alt
|
||||
self.admin_mgr.servers_client.rebuild_server(server_id,
|
||||
image_ref=image_ref_alt)
|
||||
self.wait_server_status(self.admin_mgr.servers_client, server_id)
|
||||
self.check_network_internal_connectivity(network_ens1, fip_data,
|
||||
server, should_connect=True)
|
||||
for server, details in self.servers_details.items():
|
||||
self.verify_ping_to_fip_from_ext_vm(details)
|
||||
|
||||
@decorators.idempotent_id('3468a7bd-085f-4e22-9149-61226964b039')
|
||||
def test_server_connectivity_suspend_resume(self):
|
||||
router_ens1 = self.create_topology_router("router_ens1")
|
||||
network_ens1 = self.create_topology_network("network_ens1")
|
||||
self.create_topology_subnet("subnet_ens1", network_ens1,
|
||||
router_id=router_ens1["id"])
|
||||
image_id = self.get_glance_image_id(['cirros'])
|
||||
self.create_topology_instance(
|
||||
"ens_vm_1", [network_ens1],
|
||||
create_floating_ip=True, image_id=image_id)
|
||||
server_id = self.servers_details["ens_vm_1"].server['id']
|
||||
server = self.servers_details["ens_vm_1"].server
|
||||
fip_data = server.get('floating_ips')[0]
|
||||
|
||||
self.admin_mgr.servers_client.suspend_server(server_id)
|
||||
self.wait_server_status(
|
||||
self.admin_mgr.servers_client,
|
||||
server_id,
|
||||
'SUSPENDED')
|
||||
self.check_network_internal_connectivity(network_ens1, fip_data,
|
||||
server, should_connect=False)
|
||||
|
||||
self.admin_mgr.servers_client.resume_server(server_id)
|
||||
self.wait_server_status(self.admin_mgr.servers_client, server_id)
|
||||
self.check_network_internal_connectivity(network_ens1, fip_data,
|
||||
server, should_connect=True)
|
||||
for server, details in self.servers_details.items():
|
||||
self.verify_ping_to_fip_from_ext_vm(details)
|
||||
|
||||
@decorators.idempotent_id('4130df8c-8091-42a8-b90a-4a95ad6de89b')
|
||||
def test_server_connectivity_resize(self):
|
||||
resize_flavor = CONF.compute.flavor_ref_alt
|
||||
router_ens1 = self.create_topology_router("router_ens1")
|
||||
network_ens1 = self.create_topology_network("network_ens1")
|
||||
self.create_topology_subnet("subnet_ens1", network_ens1,
|
||||
router_id=router_ens1["id"])
|
||||
image_id = self.get_glance_image_id(['cirros'])
|
||||
self.create_topology_instance(
|
||||
"ens_vm_1", [network_ens1],
|
||||
create_floating_ip=True, image_id=image_id)
|
||||
server_id = self.servers_details["ens_vm_1"].server['id']
|
||||
server = self.servers_details["ens_vm_1"].server
|
||||
fip_data = server.get('floating_ips')[0]
|
||||
|
||||
self.admin_mgr.servers_client.resize_server(server['id'],
|
||||
flavor_ref=resize_flavor)
|
||||
self.wait_server_status(
|
||||
self.admin_mgr.servers_client,
|
||||
server_id,
|
||||
'VERIFY_RESIZE')
|
||||
|
||||
self.admin_mgr.servers_client.confirm_resize_server(server_id)
|
||||
server = \
|
||||
self.admin_mgr.servers_client.show_server(server['id'])[
|
||||
'server']
|
||||
self.assertEqual(resize_flavor, server['flavor']['id'])
|
||||
self.wait_server_status(self.admin_mgr.servers_client, server_id)
|
||||
self.check_network_internal_connectivity(network_ens1, fip_data,
|
||||
server, should_connect=True)
|
||||
for server, details in self.servers_details.items():
|
||||
self.verify_ping_to_fip_from_ext_vm(details)
|
||||
|
@ -125,7 +125,8 @@ class LBaasRoundRobinBaseTest(feature_manager.FeatureManager):
|
||||
@decorators.idempotent_id('c5ac853b-6867-4b7a-8704-3844b11b1a34')
|
||||
def test_lbaas_http_traffic_roundrobin_with_ping_health_type(self):
|
||||
self.deploy_lbaas_topology()
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
if not CONF.nsxv3.ens:
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
self.create_project_lbaas(protocol_type="HTTP", protocol_port="80",
|
||||
lb_algorithm="ROUND_ROBIN", hm_type='PING')
|
||||
self.check_project_lbaas()
|
||||
@ -134,7 +135,8 @@ class LBaasRoundRobinBaseTest(feature_manager.FeatureManager):
|
||||
@decorators.idempotent_id('87b709bf-127f-4161-b43f-3915c216c44b')
|
||||
def test_lbaas_http_traffic_roundrobin_with_http_health_type(self):
|
||||
self.deploy_lbaas_topology()
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
if not CONF.nsxv3.ens:
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
self.create_project_lbaas(protocol_type="HTTP", protocol_port="80",
|
||||
lb_algorithm="ROUND_ROBIN", hm_type='HTTP')
|
||||
self.check_lbaas_project_weight_values(constants.NO_OF_VMS_2)
|
||||
@ -143,7 +145,8 @@ class LBaasRoundRobinBaseTest(feature_manager.FeatureManager):
|
||||
@decorators.idempotent_id('60e9facf-b8d6-48a9-b0d2-942e5bb38f38')
|
||||
def test_lbaas_http_leastconnections_with_ping_health_type(self):
|
||||
self.deploy_lbaas_topology()
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
if not CONF.nsxv3.ens:
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
self.create_project_lbaas(protocol_type="HTTP", protocol_port="80",
|
||||
lb_algorithm="LEAST_CONNECTIONS",
|
||||
hm_type='PING')
|
||||
@ -153,7 +156,8 @@ class LBaasRoundRobinBaseTest(feature_manager.FeatureManager):
|
||||
@decorators.idempotent_id('3041a103-e03d-4660-b411-2f9d5987dba8')
|
||||
def test_lbaas_http_leastconnections_with_http_health_type(self):
|
||||
self.deploy_lbaas_topology()
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
if not CONF.nsxv3.ens:
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
self.create_project_lbaas(protocol_type="HTTP", protocol_port="80",
|
||||
lb_algorithm="LEAST_CONNECTIONS",
|
||||
hm_type='HTTP')
|
||||
@ -163,7 +167,8 @@ class LBaasRoundRobinBaseTest(feature_manager.FeatureManager):
|
||||
@decorators.idempotent_id('73190a30-3879-4828-a198-4d3fff4cea3a')
|
||||
def test_lbaas_http_leastconnection_with_weighted_value(self):
|
||||
self.deploy_lbaas_topology()
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
if not CONF.nsxv3.ens:
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
self.create_project_lbaas(protocol_type="HTTP", protocol_port="80",
|
||||
lb_algorithm="LEAST_CONNECTIONS",
|
||||
hm_type='HTTP', weight=1)
|
||||
@ -173,7 +178,8 @@ class LBaasRoundRobinBaseTest(feature_manager.FeatureManager):
|
||||
@decorators.idempotent_id('a18347f8-9de0-49b0-8935-5fd26c135afb')
|
||||
def test_lbaas_http_leastconnection_updated_weighted_value(self):
|
||||
self.deploy_lbaas_topology()
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
if not CONF.nsxv3.ens:
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
self.create_project_lbaas(protocol_type="HTTP", protocol_port="80",
|
||||
lb_algorithm="LEAST_CONNECTIONS",
|
||||
hm_type='HTTP')
|
||||
@ -185,7 +191,8 @@ class LBaasRoundRobinBaseTest(feature_manager.FeatureManager):
|
||||
@decorators.idempotent_id('5041a903-e03d-4660-e421-2f9d5987dba9')
|
||||
def test_lbaas_http_leastconnection_updated_algorithm(self):
|
||||
self.deploy_lbaas_topology()
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
if not CONF.nsxv3.ens:
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
self.create_project_lbaas(protocol_type="HTTP", protocol_port="80",
|
||||
lb_algorithm="LEAST_CONNECTIONS",
|
||||
hm_type='HTTP')
|
||||
@ -197,7 +204,8 @@ class LBaasRoundRobinBaseTest(feature_manager.FeatureManager):
|
||||
@decorators.idempotent_id('cb9f483b-a7b3-41fc-9a5f-86a8738f853b')
|
||||
def test_lbaas_http_roundrobin_with_weighted_value(self):
|
||||
self.deploy_lbaas_topology()
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
if not CONF.nsxv3.ens:
|
||||
self.start_web_servers(constants.HTTP_PORT)
|
||||
self.create_project_lbaas(protocol_type="HTTP", protocol_port="80",
|
||||
lb_algorithm="ROUND_ROBIN",
|
||||
hm_type='HTTP', weight=1)
|
||||
|
@ -34,25 +34,31 @@ class TestMDProxy(feature_manager.FeatureManager):
|
||||
with nsxv3 backend, test MDProxy with isolated network and so on.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(TestMDProxy, self).setUp()
|
||||
self.nsx = nsxv3_client.NSXV3Client(CONF.nsxv3.nsx_manager,
|
||||
CONF.nsxv3.nsx_user,
|
||||
CONF.nsxv3.nsx_password)
|
||||
|
||||
@classmethod
|
||||
def skip_checks(cls):
|
||||
"""Class level skip checks.
|
||||
|
||||
Class level check. Skip all the MDproxy tests, if native_dhcp_metadata
|
||||
is not True under nsxv3 section of the config
|
||||
"""
|
||||
super(TestMDProxy, cls).skip_checks()
|
||||
if not CONF.nsxv3.native_dhcp_metadata:
|
||||
msg = " native_dhcp_metadata is not enabled under nsxv3 config" \
|
||||
", skipping all the MDProxy tests!!!"
|
||||
raise cls.skipException(msg)
|
||||
|
||||
@classmethod
|
||||
def setup_credentials(cls):
|
||||
cls.set_network_resources()
|
||||
cls.admin_mgr = cls.get_client_manager('admin')
|
||||
super(TestMDProxy, cls).setup_credentials()
|
||||
|
||||
@classmethod
|
||||
def setup_clients(cls):
|
||||
"""
|
||||
Create various client connections. Such as NSX.
|
||||
"""
|
||||
super(TestMDProxy, cls).setup_clients()
|
||||
cls.nsx = nsxv3_client.NSXV3Client(
|
||||
CONF.nsxv3.nsx_manager,
|
||||
CONF.nsxv3.nsx_user,
|
||||
CONF.nsxv3.nsx_password)
|
||||
|
||||
def _verify_md(self, md_url, expected_value="",
|
||||
sub_result=None, ssh_client=None):
|
||||
cmd = "curl " + md_url
|
||||
|
@ -146,16 +146,18 @@ class TestRouterNoNATOps(manager.NetworkScenarioTest):
|
||||
return subnet
|
||||
|
||||
def _create_server(self, name, network, image_id=None):
|
||||
kwargs = {}
|
||||
keypair = self.create_keypair()
|
||||
self.keypairs[keypair['name']] = keypair
|
||||
security_groups = [{'name': self.security_group['name']}]
|
||||
if CONF.nsxv3.ens is not True:
|
||||
security_groups = [{'name': self.security_group['name']}]
|
||||
kwargs["security_groups"] = security_groups
|
||||
network = {'uuid': network['id']}
|
||||
server = self.create_server(name=name, networks=[network],
|
||||
key_name=keypair['name'],
|
||||
config_drive=self.config_drive,
|
||||
security_groups=security_groups,
|
||||
image_id=image_id,
|
||||
wait_until='ACTIVE')
|
||||
wait_until='ACTIVE', **kwargs)
|
||||
self.servers.append(server)
|
||||
return server
|
||||
|
||||
@ -290,7 +292,7 @@ class TestRouterNoNATOps(manager.NetworkScenarioTest):
|
||||
'network_id': CONF.network.public_network_id,
|
||||
'enable_snat': (not snat)}
|
||||
self._update_router(self.router['id'], self.cmgr_adm.routers_client,
|
||||
external_gateway_info)
|
||||
external_gateway_info)
|
||||
nsx_router = self.nsx.get_logical_router(
|
||||
self.router['name'], self.router['id'])
|
||||
self.assertNotEqual(nsx_router, None)
|
||||
@ -333,7 +335,7 @@ class TestRouterNoNATOps(manager.NetworkScenarioTest):
|
||||
'network_id': CONF.network.public_network_id,
|
||||
'enable_snat': (not snat)}
|
||||
self._update_router(self.router['id'], self.cmgr_adm.routers_client,
|
||||
external_gateway_info)
|
||||
external_gateway_info)
|
||||
floating_ip = self.create_floating_ip(self.server)
|
||||
self.floating_ip_tuple = Floating_IP_tuple(floating_ip, self.server)
|
||||
nsx_router = self.nsx.get_logical_router(
|
||||
@ -381,6 +383,6 @@ class TestRouterNoNATOps(manager.NetworkScenarioTest):
|
||||
self.network = self._create_network()
|
||||
self.subnet = self._create_subnet(self.network)
|
||||
self.assertRaises(exceptions.Forbidden, self._create_router,
|
||||
router_name=data_utils.rand_name('router-smoke'),
|
||||
external_network_id=CONF.network.public_network_id,
|
||||
enable_snat=False)
|
||||
router_name=data_utils.rand_name('router-smoke'),
|
||||
external_network_id=CONF.network.public_network_id,
|
||||
enable_snat=False)
|
||||
|
@ -683,8 +683,9 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
||||
addresses = (server['addresses'][network['name']]
|
||||
if network else [])
|
||||
for address in addresses:
|
||||
if (address['version'] == CONF.validation.ip_version_for_ssh
|
||||
and address['OS-EXT-IPS:type'] == 'fixed'):
|
||||
if address['version'] == \
|
||||
CONF.validation.ip_version_for_ssh and \
|
||||
address['OS-EXT-IPS:type'] == 'fixed':
|
||||
return address['addr']
|
||||
raise exceptions.ServerUnreachable(server_id=server['id'])
|
||||
else:
|
||||
@ -713,8 +714,7 @@ class NetworkScenarioTest(ScenarioTest):
|
||||
|
||||
def _create_network(self, networks_client=None,
|
||||
tenant_id=None,
|
||||
namestart='network-smoke-',
|
||||
port_security_enabled=True):
|
||||
namestart='network-smoke-'):
|
||||
if not networks_client:
|
||||
networks_client = self.networks_client
|
||||
if not tenant_id:
|
||||
@ -724,7 +724,13 @@ class NetworkScenarioTest(ScenarioTest):
|
||||
# Neutron disables port security by default so we have to check the
|
||||
# config before trying to create the network with port_security_enabled
|
||||
if CONF.network_feature_enabled.port_security:
|
||||
network_kwargs['port_security_enabled'] = port_security_enabled
|
||||
if not CONF.nsxv3.ens:
|
||||
port_security_enabled = True
|
||||
else:
|
||||
port_security_enabled = False
|
||||
else:
|
||||
port_security_enabled = False
|
||||
network_kwargs['port_security_enabled'] = port_security_enabled
|
||||
result = networks_client.create_network(**network_kwargs)
|
||||
network = result['network']
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user