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