Extended test dvs_instances_one_group.
-extended test dvs_instances_batch -fix method create_instances -add method verify_instance_state Change-Id: I0df44223263ba6b53adee765252c7e72d4038919
This commit is contained in:
parent
7bc1e3f4de
commit
eeb49769c7
|
@ -9,4 +9,5 @@ networks:
|
|||
name: 'admin_internal_net'
|
||||
zone_image_maps:
|
||||
vcenter: 'TestVM-VMDK'
|
||||
nova: 'TestVM'
|
||||
nova: 'TestVM'
|
||||
vcenter-cinder: 'TestVM-VMDK'
|
|
@ -30,63 +30,68 @@ def get_defaults():
|
|||
logger.info(''.format(defaults))
|
||||
return defaults
|
||||
|
||||
#defaults
|
||||
# defaults
|
||||
external_net_name = get_defaults()['networks']['floating']['name']
|
||||
zone_image_maps = get_defaults()['zone_image_maps']
|
||||
instance_creds = (
|
||||
get_defaults()['os_credentials']['cirros']['user'],
|
||||
get_defaults()['os_credentials']['cirros']['password'])
|
||||
get_defaults()['os_credentials']['cirros']['user'],
|
||||
get_defaults()['os_credentials']['cirros']['password'])
|
||||
|
||||
|
||||
def create_instances(os_conn=None, vm_count=None, nics=None,
|
||||
security_group=None):
|
||||
def verify_instance_state(os_conn, instances=None, expected_state='ACTIVE',
|
||||
boot_timeout=300):
|
||||
"""Verify that current state of each instance/s is expected
|
||||
:param os_conn: type object, openstack
|
||||
:param instances: type list, list of created instances
|
||||
:param expected_state: type string, expected state of instance
|
||||
:param boot_timeout: type int, time in seconds to build instance
|
||||
"""
|
||||
boot_timeout = 300
|
||||
if not instances:
|
||||
instances = os_conn.nova.servers.list()
|
||||
for instance in instances:
|
||||
try:
|
||||
wait(
|
||||
lambda:
|
||||
os_conn.get_instance_detail(instance).status == expected_state,
|
||||
timeout=boot_timeout)
|
||||
except TimeoutError:
|
||||
current_state = os_conn.get_instance_detail(instance).status
|
||||
assert_true(
|
||||
current_state == expected_state,
|
||||
"Timeout is reached. Current state of Vm {0} is {1}".format(
|
||||
instance.name, current_state)
|
||||
)
|
||||
|
||||
|
||||
def create_instances(os_conn, nics, vm_count=1,
|
||||
security_groups=None, available_hosts=None):
|
||||
"""Create Vms on available hypervisors
|
||||
:param os_conn: type object, openstack
|
||||
:param vm_count: type interger, count of VMs to create
|
||||
:param nics: type dictionary, neutron networks
|
||||
to assign to instance
|
||||
:param security_group: type dictionary, security group to assign to
|
||||
instances
|
||||
:param security_groups: A list of security group names
|
||||
:param available_hosts: available hosts for creating instances
|
||||
"""
|
||||
boot_timeout = 300
|
||||
|
||||
# Get list of available images,flavors and hipervisors
|
||||
images_list = os_conn.nova.images.list()
|
||||
flavors_list = os_conn.nova.flavors.list()
|
||||
available_hosts = os_conn.nova.services.list(binary='nova-compute')
|
||||
instances = []
|
||||
flavors = os_conn.nova.flavors.list()
|
||||
flavor = [f for f in flavors if f.name == 'm1.micro'][0]
|
||||
if not available_hosts:
|
||||
available_hosts = os_conn.nova.services.list(binary='nova-compute')
|
||||
for host in available_hosts:
|
||||
for zone in zone_image_maps.keys():
|
||||
if host.zone == zone:
|
||||
image = [image for image
|
||||
in images_list
|
||||
if image.name == zone_image_maps[zone]][0]
|
||||
instance = os_conn.nova.servers.create(
|
||||
flavor=flavors_list[0],
|
||||
image = [image for image
|
||||
in images_list
|
||||
if image.name == zone_image_maps[host.zone]][0]
|
||||
os_conn.nova.servers.create(
|
||||
flavor=flavor,
|
||||
name='test_{0}'.format(image.name),
|
||||
image=image, min_count=vm_count,
|
||||
availability_zone='{0}:{1}'.format(host.zone, host.host),
|
||||
nics=nics
|
||||
nics=nics, security_groups=security_groups
|
||||
)
|
||||
instances.append(instance)
|
||||
|
||||
# Verify that current state of each VMs is Active
|
||||
for instance in instances:
|
||||
assert_true(os_conn.get_instance_detail(instance).status != 'ERROR',
|
||||
"Current state of Vm {0} is {1}".format(
|
||||
instance.name,
|
||||
os_conn.get_instance_detail(instance).status))
|
||||
try:
|
||||
wait(
|
||||
lambda:
|
||||
os_conn.get_instance_detail(instance).status == "ACTIVE",
|
||||
timeout=boot_timeout)
|
||||
except TimeoutError:
|
||||
logger.error(
|
||||
"Timeout is reached.Current state of Vm {0} is {1}".format(
|
||||
instance.name, os_conn.get_instance_detail(instance).status))
|
||||
# assign security group
|
||||
if security_group:
|
||||
instance.add_security_group(security_group)
|
||||
|
||||
|
||||
def check_connection_vms(os_conn, srv_list, remote, command='pingv4',
|
||||
|
@ -103,14 +108,16 @@ def check_connection_vms(os_conn, srv_list, remote, command='pingv4',
|
|||
"""
|
||||
|
||||
commands = {
|
||||
"pingv4": "ping -c 5 {}",
|
||||
"pingv6": "ping6 -c 5 {}",
|
||||
"arping": "sudo arping -I eth0 {}"}
|
||||
"pingv4": "ping -c 5 {}",
|
||||
"pingv6": "ping6 -c 5 {}",
|
||||
"arping": "sudo arping -I eth0 {}"}
|
||||
|
||||
for srv in srv_list:
|
||||
addresses = srv.addresses[srv.addresses.keys()[0]]
|
||||
fip = [add['addr'] for add in addresses
|
||||
if add['OS-EXT-IPS:type'] == 'floating'][0]
|
||||
fip = [
|
||||
add['addr']
|
||||
for add in addresses
|
||||
if add['OS-EXT-IPS:type'] == 'floating'][0]
|
||||
|
||||
if not destination_ip:
|
||||
destination_ip = [s.networks[s.networks.keys()[0]][0]
|
||||
|
@ -141,8 +148,10 @@ def check_connection_vms(os_conn, srv_list, remote, command='pingv4',
|
|||
def get_ssh_connection(ip, username, userpassword, timeout=30):
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect(ip, port=22, username=username,
|
||||
password=userpassword, timeout=timeout)
|
||||
ssh.connect(
|
||||
ip, port=22, username=username,
|
||||
password=userpassword, timeout=timeout
|
||||
)
|
||||
return ssh
|
||||
|
||||
|
||||
|
|
|
@ -296,7 +296,7 @@ class TestDVSPlugin(TestBasic):
|
|||
of Fuel DVS plugin with deployed environment.
|
||||
|
||||
Scenario:
|
||||
1. Revert snapshot to dvs_vcenter_bvt_2
|
||||
1. Revert snapshot to dvs_vcenter_destructive_setup
|
||||
2. Try to uninstall dvs plugin.
|
||||
|
||||
Duration 1.8 hours
|
||||
|
@ -326,17 +326,17 @@ class TestDVSPlugin(TestBasic):
|
|||
disable and enable this port.
|
||||
|
||||
Scenario:
|
||||
1. Revert snapshot to dvs_vcenter_bvt_2
|
||||
1. Revert snapshot to dvs_vcenter_destructive_setup
|
||||
2. Create private networks net01 with sunet.
|
||||
3. Launch instances VM_1 and VM_2 in the net01
|
||||
with image TestVM and flavor m1.micro in nova az.
|
||||
4. Launch instances VM_3 and VM_4 in the net01
|
||||
with image TestVM-VMDK and flavor m1.micro in nova az.
|
||||
4. Bind sub_net port of Vms
|
||||
5. Check VMs are not available.
|
||||
6. Enable sub_net port of all Vms.
|
||||
7. Verify that VMs should communicate between each other.
|
||||
Send icmp ping between VMs.
|
||||
4. Bind sub_net port of instances.
|
||||
5. Check instances are not available.
|
||||
6. Enable sub_net port of all instances.
|
||||
7. Verify that instances should communicate between each other.
|
||||
Send icmp ping between instances.
|
||||
|
||||
|
||||
Duration 1,5 hours
|
||||
|
@ -355,24 +355,21 @@ class TestDVSPlugin(TestBasic):
|
|||
SERVTEST_TENANT)
|
||||
|
||||
# create security group with rules for ssh and ping
|
||||
security_group = {}
|
||||
security_group[os_conn.get_tenant(SERVTEST_TENANT).id] =\
|
||||
os_conn.create_sec_group_for_ssh()
|
||||
security_group = security_group[
|
||||
os_conn.get_tenant(SERVTEST_TENANT).id].id
|
||||
security_group = os_conn.create_sec_group_for_ssh()
|
||||
|
||||
# Launch instance VM_1 and VM_2
|
||||
network = os_conn.nova.networks.find(label=self.inter_net_name)
|
||||
openstack.create_instances(
|
||||
os_conn=os_conn, vm_count=1,
|
||||
nics=[{'net-id': network.id}], security_group=security_group
|
||||
os_conn=os_conn, nics=[{'net-id': network.id}], vm_count=1,
|
||||
security_groups=[security_group.name]
|
||||
)
|
||||
openstack.verify_instance_state(os_conn)
|
||||
|
||||
openstack.create_and_assign_floating_ip(os_conn=os_conn)
|
||||
|
||||
time.sleep(30) # need time to apply updates
|
||||
|
||||
# Bind sub_net ports of Vms
|
||||
# Bind sub_net ports of instances
|
||||
ports = os_conn.neutron.list_ports()['ports']
|
||||
srv_list = os_conn.get_servers()
|
||||
for srv in srv_list:
|
||||
|
@ -386,7 +383,7 @@ class TestDVSPlugin(TestBasic):
|
|||
|
||||
srv_list = os_conn.get_servers()
|
||||
|
||||
# Verify that not connection to VMs
|
||||
# Verify that not connection to instances
|
||||
primary_controller = self.fuel_web.get_nailgun_primary_node(
|
||||
self.env.d_env.nodes().slaves[0]
|
||||
)
|
||||
|
@ -400,7 +397,7 @@ class TestDVSPlugin(TestBasic):
|
|||
except Exception as e:
|
||||
logger.info(str(e))
|
||||
|
||||
# Enable sub_net ports of VMs
|
||||
# Enable sub_net ports of instances
|
||||
for srv in srv_list:
|
||||
srv_addr = srv.networks[srv.networks.keys()[0]][0]
|
||||
for port in ports:
|
||||
|
@ -419,8 +416,8 @@ class TestDVSPlugin(TestBasic):
|
|||
timeout=300)
|
||||
time.sleep(60) # need time after reboot to get ip by instance
|
||||
|
||||
# Verify that VMs should communicate between each other.
|
||||
# Send icmp ping between VMs
|
||||
# Verify that instances should communicate between each other.
|
||||
# Send icmp ping between instances
|
||||
openstack.check_connection_vms(os_conn=os_conn, srv_list=srv_list,
|
||||
remote=ssh_controller)
|
||||
|
||||
|
@ -438,11 +435,11 @@ class TestDVSPlugin(TestBasic):
|
|||
5. Add 2 node with compute role.
|
||||
6. Deploy the cluster.
|
||||
7. Launch instances.
|
||||
8. Verify connection between VMs. Send ping
|
||||
Check that ping get reply
|
||||
8. Verify connection between instances. Send ping,
|
||||
check that ping get reply
|
||||
9. Reset controller.
|
||||
10. Check that vmclusters should be migrate to another controller.
|
||||
11. Verify connection between VMs.
|
||||
11. Verify connection between instances.
|
||||
Send ping, check that ping get reply
|
||||
|
||||
Duration 1.8 hours
|
||||
|
@ -487,18 +484,17 @@ class TestDVSPlugin(TestBasic):
|
|||
SERVTEST_TENANT)
|
||||
|
||||
# create security group with rules for ssh and ping
|
||||
security_group = {}
|
||||
security_group[os_conn.get_tenant(SERVTEST_TENANT).id] =\
|
||||
os_conn.create_sec_group_for_ssh()
|
||||
security_group = security_group[
|
||||
os_conn.get_tenant(SERVTEST_TENANT).id].id
|
||||
security_group = os_conn.create_sec_group_for_ssh()
|
||||
|
||||
network = os_conn.nova.networks.find(label=self.inter_net_name)
|
||||
openstack.create_instances(
|
||||
os_conn=os_conn, vm_count=1,
|
||||
nics=[{'net-id': network.id}], security_group=security_group)
|
||||
os_conn=os_conn, nics=[{'net-id': network.id}], vm_count=1,
|
||||
security_groups=[security_group.name]
|
||||
)
|
||||
openstack.verify_instance_state(os_conn)
|
||||
|
||||
# Verify connection between VMs. Send ping Check that ping get reply
|
||||
# Verify connection between instances.
|
||||
# Send ping Check that ping get reply.
|
||||
openstack.create_and_assign_floating_ip(os_conn=os_conn)
|
||||
srv_list = os_conn.get_servers()
|
||||
primary_controller = self.fuel_web.get_nailgun_primary_node(
|
||||
|
@ -527,7 +523,8 @@ class TestDVSPlugin(TestBasic):
|
|||
)
|
||||
openstack.check_service(ssh=ssh_controller, commands=cmds)
|
||||
|
||||
# Verify connection between VMs. Send ping Check that ping get reply
|
||||
# Verify connection between instances.
|
||||
# Send ping Check that ping get reply.
|
||||
srv_list = os_conn.get_servers()
|
||||
openstack.check_connection_vms(os_conn=os_conn, srv_list=srv_list,
|
||||
remote=ssh_controller)
|
||||
|
@ -546,11 +543,11 @@ class TestDVSPlugin(TestBasic):
|
|||
5. Add 2 node with compute role.
|
||||
6. Deploy the cluster.
|
||||
7. Launch instances.
|
||||
8. Verify connection between VMs. Send ping
|
||||
Check that ping get reply
|
||||
8. Verify connection between instances. Send ping,
|
||||
check that ping get reply.
|
||||
9. Shutdown controller.
|
||||
10. Check that vmclusters should be migrate to another controller.
|
||||
11. Verify connection between VMs.
|
||||
11. Verify connection between instances.
|
||||
Send ping, check that ping get reply
|
||||
|
||||
Duration 1.8 hours
|
||||
|
@ -597,18 +594,16 @@ class TestDVSPlugin(TestBasic):
|
|||
SERVTEST_TENANT)
|
||||
|
||||
# create security group with rules for ssh and ping
|
||||
security_group = {}
|
||||
security_group[os_conn.get_tenant(SERVTEST_TENANT).id] =\
|
||||
os_conn.create_sec_group_for_ssh()
|
||||
security_group = security_group[
|
||||
os_conn.get_tenant(SERVTEST_TENANT).id].id
|
||||
security_group = os_conn.create_sec_group_for_ssh()
|
||||
|
||||
network = os_conn.nova.networks.find(label=self.inter_net_name)
|
||||
openstack.create_instances(
|
||||
os_conn=os_conn, vm_count=1,
|
||||
nics=[{'net-id': network.id}], security_group=security_group)
|
||||
os_conn=os_conn, nics=[{'net-id': network.id}], vm_count=1,
|
||||
security_groups=[security_group.name])
|
||||
openstack.verify_instance_state(os_conn)
|
||||
|
||||
# Verify connection between VMs. Send ping, check that ping get reply
|
||||
# Verify connection between instances.
|
||||
# Send ping, check that ping get reply.
|
||||
openstack.create_and_assign_floating_ip(os_conn=os_conn)
|
||||
srv_list = os_conn.get_servers()
|
||||
|
||||
|
@ -637,7 +632,8 @@ class TestDVSPlugin(TestBasic):
|
|||
controlers[1].name)
|
||||
|
||||
openstack.check_service(ssh=ssh_controller, commands=cmds)
|
||||
# Verify connection between VMs. Send ping Check that ping get reply
|
||||
# Verify connection between instances.
|
||||
# Send ping Check that ping get reply.
|
||||
srv_list = os_conn.get_servers()
|
||||
openstack.check_connection_vms(
|
||||
os_conn=os_conn, srv_list=srv_list,
|
||||
|
|
|
@ -172,7 +172,6 @@ class TestDVSPlugin(TestBasic):
|
|||
logger.info('Delete network net_1')
|
||||
os_conn.neutron.delete_subnet(subnets[0]['id'])
|
||||
os_conn.neutron.delete_network(networks[0]['id'])
|
||||
|
||||
# Check that net_1 is deleted.
|
||||
assert_true(
|
||||
os_conn.get_network(networks[0]) is None
|
||||
|
@ -197,7 +196,7 @@ class TestDVSPlugin(TestBasic):
|
|||
groups=["dvs_vcenter_ping_public", 'dvs_vcenter_system'])
|
||||
@log_snapshot_after_test
|
||||
def dvs_vcenter_ping_public(self):
|
||||
"""Check connectivity Vms to public network with floating ip.
|
||||
"""Check connectivity instances to public network with floating ip.
|
||||
|
||||
Scenario:
|
||||
1. Revert snapshot to dvs_vcenter_systest_setup.
|
||||
|
@ -248,20 +247,17 @@ class TestDVSPlugin(TestBasic):
|
|||
)
|
||||
|
||||
# create security group with rules for ssh and ping
|
||||
security_group = {}
|
||||
security_group[os_conn.get_tenant(SERVTEST_TENANT).id] =\
|
||||
os_conn.create_sec_group_for_ssh()
|
||||
security_group = security_group[
|
||||
os_conn.get_tenant(SERVTEST_TENANT).id].id
|
||||
security_group = os_conn.create_sec_group_for_ssh()
|
||||
|
||||
# Launch instance VM_1, VM_2 in the tenant network net_01
|
||||
# with image TestVMDK and flavor m1.micro in the nova az.
|
||||
# Launch instances VM_3 and VM_4 in the net01
|
||||
# with image TestVM-VMDK and flavor m1.micro in vcenter az.
|
||||
openstack.create_instances(
|
||||
os_conn=os_conn, vm_count=1,
|
||||
nics=[{'net-id': network['id']}], security_group=security_group
|
||||
os_conn=os_conn, nics=[{'net-id': network['id']}], vm_count=1,
|
||||
security_groups=[security_group.name]
|
||||
)
|
||||
openstack.verify_instance_state(os_conn)
|
||||
|
||||
# Add net_1 to default router
|
||||
router = os_conn.get_router(os_conn.get_network(self.ext_net_name))
|
||||
|
@ -283,17 +279,24 @@ class TestDVSPlugin(TestBasic):
|
|||
os_conn=os_conn, srv_list=srv_list, command='pingv4',
|
||||
remote=ssh_controller,
|
||||
destination_ip=['8.8.8.8']
|
||||
)
|
||||
)
|
||||
|
||||
@test(depends_on=[dvs_vcenter_systest_setup],
|
||||
groups=["dvs_vcenter_5_instances", 'dvs_vcenter_system'])
|
||||
groups=["dvs_instances_one_group", 'dvs_vcenter_system'])
|
||||
@log_snapshot_after_test
|
||||
def dvs_vcenter_5_instances(self):
|
||||
def dvs_instances_one_group(self):
|
||||
"""Check creation instance in the one group simultaneously
|
||||
|
||||
Scenario:
|
||||
1. Revert snapshot to dvs_vcenter_systest_setup.
|
||||
2. Create 5 instances of vcenter and 5 of nova simultaneously.
|
||||
2. Launch few instances simultaneously with image TestVM
|
||||
and flavor m1.micro in nova availability zone
|
||||
in default internal network.
|
||||
3. Launch few instances simultaneously with image TestVM-VMDK
|
||||
and flavor m1.micro in vcenter availability zone in default
|
||||
internal network.
|
||||
4. Check connection between instances (ping, ssh).
|
||||
5. Delete all instances from horizon simultaneously.
|
||||
|
||||
Duration 15 min
|
||||
|
||||
|
@ -302,7 +305,9 @@ class TestDVSPlugin(TestBasic):
|
|||
|
||||
cluster_id = self.fuel_web.get_last_created_cluster()
|
||||
|
||||
# Create 5 instances of vcenter and 5 of nova simultaneously.
|
||||
logger.info(
|
||||
"Launch few instances in nova and vcenter availability zone"
|
||||
)
|
||||
os_ip = self.fuel_web.get_public_vip(cluster_id)
|
||||
os_conn = os_actions.OpenStackActions(
|
||||
os_ip, SERVTEST_USERNAME,
|
||||
|
@ -310,9 +315,63 @@ class TestDVSPlugin(TestBasic):
|
|||
SERVTEST_TENANT)
|
||||
|
||||
network = os_conn.nova.networks.find(label=self.inter_net_name)
|
||||
|
||||
# create security group with rules for ssh and ping
|
||||
security_group = os_conn.create_sec_group_for_ssh()
|
||||
|
||||
# Get max count of instance which we can create according to resource
|
||||
# limitdos.py revert-resume dvs_570 error_dvs_instances_batch
|
||||
vm_count = min(
|
||||
[os_conn.nova.hypervisors.resource_class.to_dict(h)['vcpus']
|
||||
for h in os_conn.nova.hypervisors.list()]
|
||||
)
|
||||
|
||||
logger.info(security_group)
|
||||
|
||||
openstack.create_instances(
|
||||
os_conn=os_conn, vm_count=5,
|
||||
nics=[{'net-id': network.id}])
|
||||
os_conn=os_conn, nics=[{'net-id': network.id}],
|
||||
vm_count=vm_count, security_groups=[security_group.name]
|
||||
)
|
||||
openstack.verify_instance_state(os_conn)
|
||||
|
||||
logger.info("Check ping is available between instances.")
|
||||
openstack.create_and_assign_floating_ip(os_conn=os_conn)
|
||||
|
||||
srv_list = os_conn.nova.servers.list()
|
||||
|
||||
primary_controller = self.fuel_web.get_nailgun_primary_node(
|
||||
self.env.d_env.nodes().slaves[0])
|
||||
|
||||
ssh_controller = self.fuel_web.get_ssh_for_node(
|
||||
primary_controller.name)
|
||||
|
||||
openstack.check_connection_vms(os_conn=os_conn, srv_list=srv_list,
|
||||
command='pingv4', remote=ssh_controller)
|
||||
|
||||
logger.info("Check ssh connection is available between instances.")
|
||||
floating_ip = []
|
||||
for srv in srv_list:
|
||||
floating_ip.append(
|
||||
[add['addr']
|
||||
for add in srv.addresses[srv.addresses.keys()[0]]
|
||||
if add['OS-EXT-IPS:type'] == 'floating'][0])
|
||||
ip_pair = [
|
||||
(ip_1, ip_2)
|
||||
for ip_1 in floating_ip
|
||||
for ip_2 in floating_ip
|
||||
if ip_1 != ip_2]
|
||||
|
||||
for ips in ip_pair:
|
||||
openstack.check_ssh_between_instances(ips[0], ips[1])
|
||||
|
||||
logger.info("Delete all instances from horizon simultaneously.")
|
||||
for srv in srv_list:
|
||||
os_conn.nova.servers.delete(srv)
|
||||
|
||||
logger.info("Check that all instances were deleted.")
|
||||
for srv in srv_list:
|
||||
assert_true(os_conn.verify_srv_deleted(srv),
|
||||
"Verify server was deleted")
|
||||
|
||||
@test(depends_on=[dvs_vcenter_systest_setup],
|
||||
groups=["dvs_vcenter_security", 'dvs_vcenter_system'])
|
||||
|
@ -356,18 +415,20 @@ class TestDVSPlugin(TestBasic):
|
|||
"""
|
||||
|
||||
# security group rules
|
||||
tcp = {"security_group_rule":
|
||||
{"direction": "ingress",
|
||||
"port_range_min": "22",
|
||||
"ethertype": "IPv4",
|
||||
"port_range_max": "22",
|
||||
"protocol": "TCP",
|
||||
"security_group_id": ""}}
|
||||
icmp = {"security_group_rule":
|
||||
{"direction": "ingress",
|
||||
"ethertype": "IPv4",
|
||||
"protocol": "icmp",
|
||||
"security_group_id": ""}}
|
||||
tcp = {
|
||||
"security_group_rule":
|
||||
{"direction": "ingress",
|
||||
"port_range_min": "22",
|
||||
"ethertype": "IPv4",
|
||||
"port_range_max": "22",
|
||||
"protocol": "TCP",
|
||||
"security_group_id": ""}}
|
||||
icmp = {
|
||||
"security_group_rule":
|
||||
{"direction": "ingress",
|
||||
"ethertype": "IPv4",
|
||||
"protocol": "icmp",
|
||||
"security_group_id": ""}}
|
||||
|
||||
self.env.revert_snapshot("dvs_vcenter_systest_setup")
|
||||
|
||||
|
@ -409,17 +470,22 @@ class TestDVSPlugin(TestBasic):
|
|||
logger.info("""Launch 2 instances of vcenter and 2 instances of nova
|
||||
in the tenant network net_01.""")
|
||||
openstack.create_instances(
|
||||
os_conn=os_conn, vm_count=1,
|
||||
nics=[{'net-id': network['id']}]
|
||||
os_conn=os_conn,
|
||||
nics=[{'net-id': network['id']}],
|
||||
vm_count=1
|
||||
)
|
||||
openstack.verify_instance_state(os_conn)
|
||||
|
||||
logger.info("""Launch 2 instances of vcenter and
|
||||
2 instances of nova
|
||||
in the default tenant network.""")
|
||||
network = os_conn.nova.networks.find(label=self.inter_net_name)
|
||||
openstack.create_instances(
|
||||
os_conn=os_conn, vm_count=1,
|
||||
nics=[{'net-id': network.id}])
|
||||
os_conn=os_conn,
|
||||
nics=[{'net-id': network.id}],
|
||||
vm_count=1
|
||||
)
|
||||
openstack.verify_instance_state(os_conn)
|
||||
|
||||
openstack.create_and_assign_floating_ip(os_conn=os_conn)
|
||||
|
||||
|
@ -463,9 +529,10 @@ class TestDVSPlugin(TestBasic):
|
|||
logger.info("Check ssh connection is available between instances.")
|
||||
floating_ip = []
|
||||
for srv in srv_list:
|
||||
floating_ip.append([add['addr']
|
||||
for add in srv.addresses[srv.addresses.keys()[0]]
|
||||
if add['OS-EXT-IPS:type'] == 'floating'][0])
|
||||
floating_ip.append(
|
||||
[add['addr']
|
||||
for add in srv.addresses[srv.addresses.keys()[0]]
|
||||
if add['OS-EXT-IPS:type'] == 'floating'][0])
|
||||
|
||||
ip_pair = [(ip_1, ip_2)
|
||||
for ip_1 in floating_ip
|
||||
|
@ -481,7 +548,7 @@ class TestDVSPlugin(TestBasic):
|
|||
sg_rules = [
|
||||
sg_rule for sg_rule
|
||||
in os_conn.neutron.list_security_group_rules()[
|
||||
'security_group_rules']
|
||||
'security_group_rules']
|
||||
if sg_rule['security_group_id'] in [sg1.id, sg2.id]]
|
||||
for rule in sg_rules:
|
||||
os_conn.neutron.delete_security_group_rule(rule['id'])
|
||||
|
@ -491,8 +558,9 @@ class TestDVSPlugin(TestBasic):
|
|||
logger.info("Check ssh are not available to instances")
|
||||
for ip in floating_ip:
|
||||
try:
|
||||
openstack.get_ssh_connection(ip, self.instance_creds[0],
|
||||
self.instance_creds[1])
|
||||
openstack.get_ssh_connection(
|
||||
ip, self.instance_creds[0],
|
||||
self.instance_creds[1])
|
||||
except Exception as e:
|
||||
logger.info('{}'.format(e))
|
||||
|
||||
|
@ -534,10 +602,12 @@ class TestDVSPlugin(TestBasic):
|
|||
srv.add_security_group('default')
|
||||
# need add tcp rule for ssh to instances
|
||||
tcp["security_group_rule"]["security_group_id"] = \
|
||||
[sg['id']
|
||||
for sg in os_conn.neutron.list_security_groups()['security_groups']
|
||||
if sg['tenant_id'] == os_conn.get_tenant(SERVTEST_TENANT).id
|
||||
if sg['name'] == 'default'][0]
|
||||
[
|
||||
sg['id']
|
||||
for sg in os_conn.neutron.list_security_groups()[
|
||||
'security_groups']
|
||||
if sg['tenant_id'] == os_conn.get_tenant(SERVTEST_TENANT).id
|
||||
if sg['name'] == 'default'][0]
|
||||
tcp["security_group_rule"]["direction"] = "ingress"
|
||||
os_conn.neutron.create_security_group_rule(tcp)
|
||||
time.sleep(20) # need wait to update rules on dvs ports
|
||||
|
@ -554,9 +624,9 @@ class TestDVSPlugin(TestBasic):
|
|||
groups=["dvs_vcenter_tenants_isolation", 'dvs_vcenter_system'])
|
||||
@log_snapshot_after_test
|
||||
def dvs_vcenter_tenants_isolation(self):
|
||||
"""Verify that VMs on different tenants should not communicate
|
||||
between each other. Send icmp ping from VMs
|
||||
of admin tenant to VMs of test_tenant and vice versa.
|
||||
"""Verify that instances on different tenants should not communicate
|
||||
between each other. Send icmp ping from instances
|
||||
of admin tenant to instances of test_tenant and vice versa.
|
||||
|
||||
Scenario:
|
||||
1. Revert snapshot to dvs_vcenter_systest_setup.
|
||||
|
@ -568,8 +638,9 @@ class TestDVSPlugin(TestBasic):
|
|||
in nova and vcenter az.
|
||||
6. Launch 2 instances in the default internal
|
||||
admin network in nova and vcenter az.
|
||||
7. Verify that VMs on different tenants should not communicate
|
||||
between each other via no floating ip. Send icmp ping from VM_3,
|
||||
7. Verify that instances on different tenants should not
|
||||
communicate between each other via no floating ip.
|
||||
Send icmp ping from VM_3,
|
||||
VM_4 of admin tenant to VM_3 VM_4 of test_tenant and vice versa.
|
||||
|
||||
Duration 30 min
|
||||
|
@ -610,17 +681,15 @@ class TestDVSPlugin(TestBasic):
|
|||
)
|
||||
|
||||
# create security group with rules for ssh and ping
|
||||
security_group = {}
|
||||
security_group[test.get_tenant('test').id] =\
|
||||
test.create_sec_group_for_ssh()
|
||||
security_group = security_group[
|
||||
test.get_tenant('test').id].id
|
||||
security_group = test.create_sec_group_for_ssh()
|
||||
|
||||
# Launch 2 instances in the est tenant network net_01
|
||||
openstack.create_instances(
|
||||
os_conn=test, vm_count=1,
|
||||
nics=[{'net-id': network['id']}], security_group=security_group
|
||||
nics=[{'net-id': network['id']}],
|
||||
security_groups=[security_group.name]
|
||||
)
|
||||
openstack.verify_instance_state(test)
|
||||
|
||||
# Create Router_01, set gateway and add interface
|
||||
# to external network.
|
||||
|
@ -635,17 +704,14 @@ class TestDVSPlugin(TestBasic):
|
|||
router_1['id'], subnet['id'])
|
||||
|
||||
# create security group with rules for ssh and ping
|
||||
security_group = {}
|
||||
security_group[admin.get_tenant(SERVTEST_TENANT).id] =\
|
||||
admin.create_sec_group_for_ssh()
|
||||
security_group = security_group[
|
||||
admin.get_tenant(SERVTEST_TENANT).id].id
|
||||
security_group = admin.create_sec_group_for_ssh()
|
||||
|
||||
# Launch 2 instances in the admin tenant net04
|
||||
network = admin.nova.networks.find(label=self.inter_net_name)
|
||||
openstack.create_instances(
|
||||
os_conn=admin, vm_count=1,
|
||||
nics=[{'net-id': network.id}], security_group=security_group)
|
||||
os_conn=admin, nics=[{'net-id': network.id}], vm_count=1,
|
||||
security_groups=[security_group.name])
|
||||
openstack.verify_instance_state(admin)
|
||||
|
||||
# Send ping from instances VM_1 and VM_2 to VM_3 and VM_4
|
||||
# via no floating ip
|
||||
|
@ -683,7 +749,8 @@ class TestDVSPlugin(TestBasic):
|
|||
groups=["dvs_vcenter_same_ip", 'dvs_vcenter_system'])
|
||||
@log_snapshot_after_test
|
||||
def dvs_vcenter_same_ip(self):
|
||||
"""Check connectivity between VMs with same ip in different tenants.
|
||||
"""Check connectivity between instances with same ip
|
||||
in different tenants.
|
||||
|
||||
Scenario:
|
||||
1. Revert snapshot to dvs_vcenter_systest_setup.
|
||||
|
@ -694,7 +761,8 @@ class TestDVSPlugin(TestBasic):
|
|||
5. Create private network net01 with sunet in default admin tenant
|
||||
6. Create Router_01, set gateway and add interface
|
||||
to external network.
|
||||
7. Launch instances VM_1 and VM_2 in the net01(non-admin tenant)
|
||||
7. Launch instances VM_1 and VM_2
|
||||
in the net01(non-admin tenant)
|
||||
with image TestVM and flavor m1.micro in nova az.
|
||||
8. Launch instances VM_3 and VM_4 in the net01(non-admin tenant)
|
||||
with image TestVM-VMDK and flavor m1.micro in vcenter az.
|
||||
|
@ -746,20 +814,17 @@ class TestDVSPlugin(TestBasic):
|
|||
)
|
||||
|
||||
# create security group with rules for ssh and ping
|
||||
security_group = {}
|
||||
security_group[test.get_tenant('test').id] =\
|
||||
test.create_sec_group_for_ssh()
|
||||
security_group = security_group[
|
||||
test.get_tenant('test').id].id
|
||||
security_group = test.create_sec_group_for_ssh()
|
||||
|
||||
# Launch instances VM_1 and VM_2 in the net01(non-admin tenant)
|
||||
# Launch instances VM_1 and VM_2 in the net01(non-admin tenant)
|
||||
# with image TestVM and flavor m1.micro in nova az.
|
||||
# Launch instances VM_3 and VM_4 in the net01(non-admin tenant)
|
||||
# with image TestVM-VMDK and flavor m1.micro in vcenter az.
|
||||
openstack.create_instances(
|
||||
os_conn=test, vm_count=1,
|
||||
nics=[{'net-id': network['id']}], security_group=security_group
|
||||
os_conn=test, nics=[{'net-id': network['id']}], vm_count=1,
|
||||
security_groups=[security_group.name]
|
||||
)
|
||||
openstack.verify_instance_state(test)
|
||||
|
||||
# Create Router_01, set gateway and add interface
|
||||
# to external network.
|
||||
|
@ -782,11 +847,7 @@ class TestDVSPlugin(TestBasic):
|
|||
tenant_id=test.get_tenant('test').id)
|
||||
srv_1 = test.get_servers()
|
||||
# create security group with rules for ssh and ping
|
||||
security_group = {}
|
||||
security_group[admin.get_tenant(SERVTEST_TENANT).id] =\
|
||||
admin.create_sec_group_for_ssh()
|
||||
security_group = security_group[
|
||||
admin.get_tenant(SERVTEST_TENANT).id].id
|
||||
security_group = admin.create_sec_group_for_ssh()
|
||||
# Create non default network with subnet in admin tenant.
|
||||
logger.info('Create network {}'.format(self.net_data[0].keys()[0]))
|
||||
network = openstack.create_network(
|
||||
|
@ -806,8 +867,9 @@ class TestDVSPlugin(TestBasic):
|
|||
# in the net01(default admin tenant)
|
||||
# with image TestVM-VMDK and flavor m1.micro in vcenter az.
|
||||
openstack.create_instances(
|
||||
os_conn=admin, vm_count=1,
|
||||
nics=[{'net-id': network['id']}], security_group=security_group)
|
||||
os_conn=admin, nics=[{'net-id': network['id']}], vm_count=1,
|
||||
security_groups=[security_group.name])
|
||||
openstack.verify_instance_state(admin)
|
||||
|
||||
# Create Router_01, set gateway and add interface
|
||||
# to external network.
|
||||
|
|
Loading…
Reference in New Issue