Refactoring of destructive DVS scenarios
* Create new function to check ping vms * Fix documentation strings Change-Id: I8461728188420f4f6e0db0467a8f48e241298e0f
This commit is contained in:
parent
0b1cb8b6c3
commit
7209f296c6
|
@ -278,7 +278,7 @@ epub_copyright = u'2016, Mirantis Inc.'
|
||||||
# The basename for the epub file. It defaults to the project name.
|
# The basename for the epub file. It defaults to the project name.
|
||||||
# epub_basename = u'fuel-plugin-openbook'
|
# epub_basename = u'fuel-plugin-openbook'
|
||||||
|
|
||||||
# The HTML theme for the epub output. Since the default themes are not optimized
|
# The HTML theme for the epub output. Since the default themes are'nt optimized
|
||||||
# for small screen space, using the same theme for HTML and epub output is
|
# for small screen space, using the same theme for HTML and epub output is
|
||||||
# usually not wise. This defaults to 'epub', a theme designed to save visual
|
# usually not wise. This defaults to 'epub', a theme designed to save visual
|
||||||
# space.
|
# space.
|
||||||
|
|
|
@ -16,13 +16,12 @@ import time
|
||||||
|
|
||||||
import paramiko
|
import paramiko
|
||||||
import yaml
|
import yaml
|
||||||
from devops.error import TimeoutError
|
|
||||||
from devops.helpers.helpers import icmp_ping
|
from devops.helpers.helpers import icmp_ping
|
||||||
from devops.helpers.helpers import tcp_ping
|
from devops.helpers.helpers import tcp_ping
|
||||||
from devops.helpers.helpers import wait
|
from devops.helpers.helpers import wait
|
||||||
from proboscis.asserts import assert_true
|
|
||||||
|
|
||||||
from fuelweb_test import logger
|
from fuelweb_test import logger
|
||||||
|
from fuelweb_test.helpers.ssh_manager import SSHManager
|
||||||
from fuelweb_test.helpers.utils import pretty_log
|
from fuelweb_test.helpers.utils import pretty_log
|
||||||
|
|
||||||
# timeouts
|
# timeouts
|
||||||
|
@ -56,18 +55,17 @@ def verify_instance_state(os_conn, instances=None, expected_state='ACTIVE',
|
||||||
if not instances:
|
if not instances:
|
||||||
instances = os_conn.nova.servers.list()
|
instances = os_conn.nova.servers.list()
|
||||||
for instance in instances:
|
for instance in instances:
|
||||||
try:
|
wait(
|
||||||
wait(
|
lambda:
|
||||||
lambda:
|
os_conn.get_instance_detail(instance).status == expected_state,
|
||||||
os_conn.get_instance_detail(instance).status == expected_state,
|
timeout=BOOT_TIMEOUT,
|
||||||
timeout=BOOT_TIMEOUT)
|
timeout_msg="Timeout is reached. "
|
||||||
except TimeoutError:
|
"Current state of Vm {0} is {1}."
|
||||||
current_state = os_conn.get_instance_detail(instance).status
|
"Expected state is {2}".format(
|
||||||
assert_true(
|
instance.name,
|
||||||
current_state == expected_state,
|
os_conn.get_instance_detail(instance).status,
|
||||||
"Timeout is reached. Current state of Vm {0} is {1}".format(
|
expected_state)
|
||||||
instance.name, current_state)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def create_instances(os_conn, nics, vm_count=1,
|
def create_instances(os_conn, nics, vm_count=1,
|
||||||
|
@ -102,33 +100,14 @@ def create_instances(os_conn, nics, vm_count=1,
|
||||||
return instances
|
return instances
|
||||||
|
|
||||||
|
|
||||||
def generate_message(command, result_of_command, ip_from, ip_to):
|
def check_connection_vms(ip_pair, command='pingv4', result_of_command=0,
|
||||||
"""Generate error message for check connection methods.
|
|
||||||
|
|
||||||
:param command: type string, name of command
|
|
||||||
:param result_of_command: type interger, exite code of command execution
|
|
||||||
:param ip_from: type string, check connection from 'ip_from'
|
|
||||||
:param ip_to: type string, check connection from 'ip_to'
|
|
||||||
"""
|
|
||||||
if result_of_command == 0:
|
|
||||||
param = "isn't"
|
|
||||||
else:
|
|
||||||
param = "is"
|
|
||||||
message = "{0} {1} available from {2} to {3}".format(
|
|
||||||
command, param, ip_from, ip_to)
|
|
||||||
return message
|
|
||||||
|
|
||||||
|
|
||||||
def check_connection_vms(ip_pair, command='pingv4',
|
|
||||||
result_of_command=0,
|
|
||||||
timeout=30, interval=5):
|
timeout=30, interval=5):
|
||||||
"""Check network connectivity between instances.
|
"""Check network connectivity between instances.
|
||||||
|
|
||||||
:param os_conn: type object, openstack
|
|
||||||
:param ip_pair: type dict, {ip_from: [ip_to1, ip_to2, etc.]}
|
:param ip_pair: type dict, {ip_from: [ip_to1, ip_to2, etc.]}
|
||||||
:param command: type string, key from dictionary 'commands'
|
:param command: type string, key from dictionary 'commands'
|
||||||
by default is 'pingv4'
|
by default is 'pingv4'
|
||||||
:param result_of_command: type interger, exite code of command execution
|
:param result_of_command: type integer, exit code of command execution
|
||||||
by default is 0
|
by default is 0
|
||||||
:param timeout: wait to get expected result
|
:param timeout: wait to get expected result
|
||||||
:param interval: interval of executing command
|
:param interval: interval of executing command
|
||||||
|
@ -139,21 +118,20 @@ def check_connection_vms(ip_pair, command='pingv4',
|
||||||
"arping": "sudo arping -I eth0 {}",
|
"arping": "sudo arping -I eth0 {}",
|
||||||
"ssh": " "}
|
"ssh": " "}
|
||||||
|
|
||||||
|
msg = 'Command "{0}", Actual exit code is NOT {1}'
|
||||||
for ip_from in ip_pair:
|
for ip_from in ip_pair:
|
||||||
with get_ssh_connection(
|
with get_ssh_connection(ip_from, instance_creds[0],
|
||||||
ip_from, instance_creds[0], instance_creds[1]
|
instance_creds[1]) as ssh:
|
||||||
) as ssh:
|
|
||||||
for ip_to in ip_pair[ip_from]:
|
for ip_to in ip_pair[ip_from]:
|
||||||
message = generate_message(
|
|
||||||
commands[command], result_of_command, ip_from, ip_to)
|
|
||||||
logger.info("Check connection from {0} to {1}.".format(
|
logger.info("Check connection from {0} to {1}.".format(
|
||||||
ip_from, ip_to))
|
ip_from, ip_to))
|
||||||
cmd = commands[command].format(ip_to)
|
cmd = commands[command].format(ip_to)
|
||||||
wait(lambda: execute(
|
|
||||||
ssh, cmd)['exit_code'] == result_of_command,
|
wait(lambda:
|
||||||
|
execute(ssh, cmd)['exit_code'] == result_of_command,
|
||||||
interval=interval,
|
interval=interval,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
timeout_msg=message.format(ip_from, ip_to)
|
timeout_msg=msg.format(cmd, result_of_command)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -163,10 +141,10 @@ def check_connection_through_host(remote, ip_pair, command='pingv4',
|
||||||
"""Check network connectivity between instances.
|
"""Check network connectivity between instances.
|
||||||
|
|
||||||
:param ip_pair: type list, ips of instances
|
:param ip_pair: type list, ips of instances
|
||||||
:param remote: SSHClient to instance
|
:param remote: Access point IP
|
||||||
:param command: type string, key from dictionary 'commands'
|
:param command: type string, key from dictionary 'commands'
|
||||||
by default is 'pingv4'
|
by default is 'pingv4'
|
||||||
:param result_of_command: type interger, exite code of command execution
|
:param result_of_command: type integer, exit code of command execution
|
||||||
by default is 0
|
by default is 0
|
||||||
:param timeout: wait to get expected result
|
:param timeout: wait to get expected result
|
||||||
:param interval: interval of executing command
|
:param interval: interval of executing command
|
||||||
|
@ -176,35 +154,63 @@ def check_connection_through_host(remote, ip_pair, command='pingv4',
|
||||||
"pingv6": "ping6 -c 5 {}",
|
"pingv6": "ping6 -c 5 {}",
|
||||||
"arping": "sudo arping -I eth0 {}"}
|
"arping": "sudo arping -I eth0 {}"}
|
||||||
|
|
||||||
|
msg = 'Command "{0}", Actual exit code is NOT {1}'
|
||||||
|
|
||||||
for ip_from in ip_pair:
|
for ip_from in ip_pair:
|
||||||
for ip_to in ip_pair[ip_from]:
|
for ip_to in ip_pair[ip_from]:
|
||||||
logger.info('Check ping from {0} to {1}'.format(ip_from, ip_to))
|
logger.info('Check ping from {0} to {1}'.format(ip_from, ip_to))
|
||||||
message = generate_message(
|
cmd = commands[command].format(ip_to)
|
||||||
commands[command], result_of_command, ip_from, ip_to)
|
|
||||||
wait(
|
wait(
|
||||||
lambda:
|
lambda:
|
||||||
remote_execute_command(
|
remote_execute_command(
|
||||||
remote,
|
remote,
|
||||||
ip_from,
|
ip_from,
|
||||||
commands[command].format(ip_to),
|
cmd,
|
||||||
wait=timeout)['exit_code'] == result_of_command,
|
wait=timeout)['exit_code'] == result_of_command,
|
||||||
interval=interval,
|
interval=interval,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
timeout_msg=message.format(
|
timeout_msg=msg.format(cmd, result_of_command)
|
||||||
ip_from, ip_to)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def ping_each_other(ips, command='pingv4', expected_ec=0,
|
||||||
|
timeout=30, interval=5, access_point_ip=None):
|
||||||
|
"""Check network connectivity between instances.
|
||||||
|
|
||||||
|
:param ips: list, list of ips
|
||||||
|
:param command: type string, key from dictionary 'commands'
|
||||||
|
by default is 'pingv4'
|
||||||
|
:param expected_ec: type integer, exit code of command execution
|
||||||
|
by default is 0
|
||||||
|
:param timeout: wait to get expected result
|
||||||
|
:param interval: interval of executing command
|
||||||
|
:param access_point_ip: It is used if check via host
|
||||||
|
"""
|
||||||
|
ip_pair = {key: [ip for ip in ips if ip != key] for key in ips}
|
||||||
|
if access_point_ip:
|
||||||
|
check_connection_through_host(remote=access_point_ip,
|
||||||
|
ip_pair=ip_pair,
|
||||||
|
command=command,
|
||||||
|
result_of_command=expected_ec,
|
||||||
|
timeout=timeout,
|
||||||
|
interval=interval)
|
||||||
|
else:
|
||||||
|
check_connection_vms(ip_pair=ip_pair,
|
||||||
|
command=command,
|
||||||
|
result_of_command=expected_ec,
|
||||||
|
timeout=timeout,
|
||||||
|
interval=interval)
|
||||||
|
|
||||||
|
|
||||||
def create_and_assign_floating_ips(os_conn, instances_list):
|
def create_and_assign_floating_ips(os_conn, instances_list):
|
||||||
"""Create Vms on available hypervisors.
|
"""Associate floating ips with specified instances.
|
||||||
|
|
||||||
:param os_conn: type object, openstack
|
:param os_conn: type object, openstack
|
||||||
:param instances_list: type list, instances
|
:param instances_list: type list, instances
|
||||||
"""
|
"""
|
||||||
fips = []
|
fips = []
|
||||||
for instance in instances_list:
|
for instance in instances_list:
|
||||||
ip = os_conn.assign_floating_ip(
|
ip = os_conn.assign_floating_ip(instance).ip
|
||||||
instance).ip
|
|
||||||
fips.append(ip)
|
fips.append(ip)
|
||||||
wait(lambda: icmp_ping(ip), timeout=60 * 5, interval=5)
|
wait(lambda: icmp_ping(ip), timeout=60 * 5, interval=5)
|
||||||
return fips
|
return fips
|
||||||
|
@ -323,19 +329,21 @@ def add_role_to_user(os_conn, user_name, role_name, tenant_name):
|
||||||
os_conn.keystone.roles.add_user_role(user_id, role_id, tenant_id)
|
os_conn.keystone.roles.add_user_role(user_id, role_id, tenant_id)
|
||||||
|
|
||||||
|
|
||||||
def check_service(ssh, commands):
|
def check_service(ip, commands):
|
||||||
"""Check that required nova services are running on controller.
|
"""Check that required nova services are running on controller.
|
||||||
|
|
||||||
:param ssh: SSHClient
|
:param ip: ip address of node
|
||||||
:param commands: type list, nova commands to execute on controller,
|
:param commands: type list, nova commands to execute on controller,
|
||||||
example of commands:
|
example of commands:
|
||||||
['nova-manage service list | grep vcenter-vmcluster1'
|
['nova-manage service list | grep vcenter-vmcluster1'
|
||||||
"""
|
"""
|
||||||
ssh.execute('source openrc')
|
SSHManager.execute_on_remote(ip=ip, cmd='source openrc')
|
||||||
|
|
||||||
for cmd in commands:
|
for cmd in commands:
|
||||||
wait(
|
wait(
|
||||||
lambda:
|
lambda:
|
||||||
':-)' in list(ssh.execute(cmd)['stdout'])[-1].split(' '),
|
':-)' in SSHManager.execute_on_remote(ip=ip,
|
||||||
|
cmd=cmd)['stdout'][-1],
|
||||||
timeout=200)
|
timeout=200)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ from devops.helpers.helpers import icmp_ping
|
||||||
from devops.helpers.helpers import wait
|
from devops.helpers.helpers import wait
|
||||||
from proboscis import test
|
from proboscis import test
|
||||||
from proboscis.asserts import assert_true
|
from proboscis.asserts import assert_true
|
||||||
|
from proboscis.asserts import fail
|
||||||
|
|
||||||
import fuelweb_test.tests.base_test_case
|
import fuelweb_test.tests.base_test_case
|
||||||
from fuelweb_test import logger
|
from fuelweb_test import logger
|
||||||
|
@ -58,8 +59,21 @@ class TestDVSDestructive(TestBasic):
|
||||||
cmds = ['nova-manage service list | grep vcenter-vmcluster1',
|
cmds = ['nova-manage service list | grep vcenter-vmcluster1',
|
||||||
'nova-manage service list | grep vcenter-vmcluster2']
|
'nova-manage service list | grep vcenter-vmcluster2']
|
||||||
|
|
||||||
net_data = [{'net_1': '192.168.112.0/24'},
|
networks = [
|
||||||
{'net_2': '192.168.113.0/24'}]
|
{'name': 'net_1',
|
||||||
|
'subnets': [
|
||||||
|
{'name': 'subnet_1',
|
||||||
|
'cidr': '192.168.112.0/24'}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{'name': 'net_2',
|
||||||
|
'subnets': [
|
||||||
|
{'name': 'subnet_1',
|
||||||
|
'cidr': '192.168.113.0/24'}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
# defaults
|
# defaults
|
||||||
inter_net_name = openstack.get_defaults()['networks']['internal']['name']
|
inter_net_name = openstack.get_defaults()['networks']['internal']['name']
|
||||||
ext_net_name = openstack.get_defaults()['networks']['floating']['name']
|
ext_net_name = openstack.get_defaults()['networks']['floating']['name']
|
||||||
|
@ -112,17 +126,7 @@ class TestDVSDestructive(TestBasic):
|
||||||
instance, net_name=self.inter_net_name))
|
instance, net_name=self.inter_net_name))
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
self.show_step(13)
|
self.show_step(13)
|
||||||
ip_pair = {
|
openstack.ping_each_other(ips=ips, access_point_ip=access_point_ip)
|
||||||
key: [value for value in ips if key != value] for key in ips}
|
|
||||||
for ip_from in ip_pair:
|
|
||||||
for ip_to in ip_pair[ip_from]:
|
|
||||||
ping_result = openstack.remote_execute_command(
|
|
||||||
access_point_ip, ip_from, "ping -c 5 {0}".format(ip_to))
|
|
||||||
assert_true(
|
|
||||||
ping_result['exit_code'] == 0,
|
|
||||||
"Ping isn't available from {0} to {1}".format(ip_from,
|
|
||||||
ip_to)
|
|
||||||
)
|
|
||||||
|
|
||||||
self.show_step(14)
|
self.show_step(14)
|
||||||
vcenter_name = [
|
vcenter_name = [
|
||||||
|
@ -136,25 +140,19 @@ class TestDVSDestructive(TestBasic):
|
||||||
node.reset()
|
node.reset()
|
||||||
|
|
||||||
self.show_step(15)
|
self.show_step(15)
|
||||||
wait(lambda: not icmp_ping(
|
wait(lambda: not icmp_ping(self.VCENTER_IP),
|
||||||
self.VCENTER_IP), interval=1, timeout=10,
|
interval=1,
|
||||||
timeout_msg='Vcenter is still available.')
|
timeout=10,
|
||||||
|
timeout_msg='Vcenter is still available.')
|
||||||
|
|
||||||
self.show_step(16)
|
self.show_step(16)
|
||||||
wait(lambda: icmp_ping(
|
wait(lambda: icmp_ping(self.VCENTER_IP),
|
||||||
self.VCENTER_IP), interval=5, timeout=120,
|
interval=5,
|
||||||
timeout_msg='Vcenter is not available.')
|
timeout=120,
|
||||||
|
timeout_msg='Vcenter is not available.')
|
||||||
|
|
||||||
self.show_step(17)
|
self.show_step(17)
|
||||||
for ip_from in ip_pair:
|
openstack.ping_each_other(ips=ips, access_point_ip=access_point_ip)
|
||||||
for ip_to in ip_pair[ip_from]:
|
|
||||||
ping_result = openstack.remote_execute_command(
|
|
||||||
access_point_ip, ip_from, "ping -c 5 {0}".format(ip_to))
|
|
||||||
assert_true(
|
|
||||||
ping_result['exit_code'] == 0,
|
|
||||||
"Ping isn't available from {0} to {1}".format(ip_from,
|
|
||||||
ip_to)
|
|
||||||
)
|
|
||||||
|
|
||||||
@test(depends_on=[TestDVSSystem.dvs_vcenter_systest_setup],
|
@test(depends_on=[TestDVSSystem.dvs_vcenter_systest_setup],
|
||||||
groups=["dvs_vcenter_uninstall"])
|
groups=["dvs_vcenter_uninstall"])
|
||||||
|
@ -186,10 +184,8 @@ class TestDVSDestructive(TestBasic):
|
||||||
self.show_step(3)
|
self.show_step(3)
|
||||||
output = self.ssh_manager.execute_on_remote(
|
output = self.ssh_manager.execute_on_remote(
|
||||||
ip=self.ssh_manager.admin_ip, cmd='fuel plugins list')['stdout']
|
ip=self.ssh_manager.admin_ip, cmd='fuel plugins list')['stdout']
|
||||||
assert_true(
|
assert_true(plugin.plugin_name in output[-1].split(' '),
|
||||||
plugin.plugin_name in output[-1].split(' '),
|
"Plugin '{0}' was removed".format(plugin.plugin_name))
|
||||||
"Plugin '{0}' was removed".format(plugin.plugin_name)
|
|
||||||
)
|
|
||||||
|
|
||||||
@test(depends_on=[TestDVSSystem.dvs_vcenter_systest_setup],
|
@test(depends_on=[TestDVSSystem.dvs_vcenter_systest_setup],
|
||||||
groups=["dvs_vcenter_bind_port"])
|
groups=["dvs_vcenter_bind_port"])
|
||||||
|
@ -199,26 +195,26 @@ class TestDVSDestructive(TestBasic):
|
||||||
|
|
||||||
Scenario:
|
Scenario:
|
||||||
1. Revert snapshot to dvs_vcenter_systest_setup
|
1. Revert snapshot to dvs_vcenter_systest_setup
|
||||||
2. Create private networks net01 with sunet.
|
2. Create private networks net01 with subnet.
|
||||||
3. Launch instances VM_1 and VM_2 in the net01
|
3. Launch instance VM_1 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 instance VM_2 in the net01
|
||||||
with image TestVM-VMDK and flavor m1.micro in nova az.
|
with image TestVM-VMDK and flavor m1.micro in vcenter az.
|
||||||
4. Bind sub_net port of instances.
|
5. Disable sub_net port of instances.
|
||||||
5. Check instances are not available.
|
6. Check instances are not available.
|
||||||
6. Enable sub_net port of all instances.
|
7. Enable sub_net port of all instances.
|
||||||
7. Verify that instances communicate between each other.
|
8. Verify that instances communicate between each other.
|
||||||
Send icmp ping between instances.
|
Send icmp ping between instances.
|
||||||
|
|
||||||
|
|
||||||
Duration: 1,5 hours
|
Duration: 1,5 hours
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
self.show_step(1)
|
||||||
self.env.revert_snapshot("dvs_vcenter_systest_setup")
|
self.env.revert_snapshot("dvs_vcenter_systest_setup")
|
||||||
|
|
||||||
cluster_id = self.fuel_web.get_last_created_cluster()
|
cluster_id = self.fuel_web.get_last_created_cluster()
|
||||||
|
|
||||||
# Create new network
|
|
||||||
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,
|
||||||
|
@ -228,28 +224,27 @@ class TestDVSDestructive(TestBasic):
|
||||||
# create security group with rules for ssh and ping
|
# create security group with rules for ssh and ping
|
||||||
security_group = os_conn.create_sec_group_for_ssh()
|
security_group = os_conn.create_sec_group_for_ssh()
|
||||||
|
|
||||||
logger.info("Create non default network with subnet.")
|
self.show_step(2)
|
||||||
logger.info('Create network {}'.format(self.net_data[0].keys()[0]))
|
net = self.networks[0]
|
||||||
network = os_conn.create_network(
|
network = os_conn.create_network(network_name=net['name'])['network']
|
||||||
network_name=self.net_data[0].keys()[0])['network']
|
|
||||||
|
|
||||||
subnet = os_conn.create_subnet(
|
subnet = os_conn.create_subnet(
|
||||||
subnet_name=network['name'],
|
subnet_name=net['subnets'][0]['name'],
|
||||||
network_id=network['id'],
|
network_id=network['id'],
|
||||||
cidr=self.net_data[0][self.net_data[0].keys()[0]])
|
cidr=net['subnets'][0]['cidr'])
|
||||||
|
|
||||||
logger.info("Check that network are created.")
|
logger.info("Check network was created.")
|
||||||
assert_true(
|
assert_true(
|
||||||
os_conn.get_network(network['name'])['id'] == network['id']
|
os_conn.get_network(network['name'])['id'] == network['id']
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info("Add net_1 to default router")
|
logger.info("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))
|
||||||
os_conn.add_router_interface(
|
os_conn.add_router_interface(router_id=router["id"],
|
||||||
router_id=router["id"],
|
subnet_id=subnet["id"])
|
||||||
subnet_id=subnet["id"])
|
|
||||||
|
|
||||||
# Launch instance VM_1 and VM_2
|
self.show_step(3)
|
||||||
|
self.show_step(4)
|
||||||
instances = openstack.create_instances(
|
instances = openstack.create_instances(
|
||||||
os_conn=os_conn, nics=[{'net-id': network['id']}], vm_count=1,
|
os_conn=os_conn, nics=[{'net-id': network['id']}], vm_count=1,
|
||||||
security_groups=[security_group.name]
|
security_groups=[security_group.name]
|
||||||
|
@ -257,39 +252,39 @@ class TestDVSDestructive(TestBasic):
|
||||||
openstack.verify_instance_state(os_conn)
|
openstack.verify_instance_state(os_conn)
|
||||||
|
|
||||||
ports = os_conn.neutron.list_ports()['ports']
|
ports = os_conn.neutron.list_ports()['ports']
|
||||||
floating_ip = openstack.create_and_assign_floating_ips(
|
fips = openstack.create_and_assign_floating_ips(os_conn, instances)
|
||||||
os_conn, instances)
|
|
||||||
instance_ports = []
|
inst_ips = [os_conn.get_nova_instance_ip(
|
||||||
for instance in instances:
|
instance, net_name=network['name']) for instance in instances]
|
||||||
instance_addr = os_conn.get_nova_instance_ip(
|
inst_ports = [p for p in ports
|
||||||
instance, net_name=network['name'])
|
if p['fixed_ips'][0]['ip_address'] in inst_ips]
|
||||||
for port in ports:
|
|
||||||
port_addr = port['fixed_ips'][0]['ip_address']
|
self.show_step(5)
|
||||||
if instance_addr == port_addr:
|
for port in inst_ports:
|
||||||
instance_ports.append(port)
|
|
||||||
for port in instance_ports:
|
|
||||||
os_conn.neutron.update_port(
|
os_conn.neutron.update_port(
|
||||||
port['id'], {'port': {'admin_state_up': False}}
|
port['id'], {'port': {'admin_state_up': False}}
|
||||||
)
|
)
|
||||||
|
|
||||||
ip_pair = dict.fromkeys(floating_ip)
|
self.show_step(6)
|
||||||
for key in ip_pair:
|
# TODO(vgorin) create better solution for this step
|
||||||
ip_pair[key] = [value for value in floating_ip if key != value]
|
|
||||||
# Verify that not connection to instances
|
|
||||||
try:
|
try:
|
||||||
openstack.check_connection_vms(ip_pair)
|
openstack.ping_each_other(fips)
|
||||||
|
checker = 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info(str(e))
|
logger.info(e)
|
||||||
|
checker = 0
|
||||||
|
|
||||||
# Enable sub_net ports of instances
|
if checker:
|
||||||
for port in instance_ports:
|
fail('Ping is available between instances')
|
||||||
|
|
||||||
|
self.show_step(7)
|
||||||
|
for port in inst_ports:
|
||||||
os_conn.neutron.update_port(
|
os_conn.neutron.update_port(
|
||||||
port['id'], {'port': {'admin_state_up': True}}
|
port['id'], {'port': {'admin_state_up': True}}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Verify that instances communicate between each other.
|
self.show_step(8)
|
||||||
# Send icmp ping between instances
|
openstack.ping_each_other(fips, timeout=90)
|
||||||
openstack.check_connection_vms(ip_pair, timeout=90)
|
|
||||||
|
|
||||||
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
|
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
|
||||||
groups=["dvs_destructive_setup_2"])
|
groups=["dvs_destructive_setup_2"])
|
||||||
|
@ -300,20 +295,24 @@ class TestDVSDestructive(TestBasic):
|
||||||
Scenario:
|
Scenario:
|
||||||
1. Upload plugins to the master node
|
1. Upload plugins to the master node
|
||||||
2. Install plugin.
|
2. Install plugin.
|
||||||
3. Create cluster with vcenter.
|
3. Configure cluster with 2 vcenter clusters.
|
||||||
4. Add 3 node with controller role.
|
4. Add 3 node with controller role.
|
||||||
5. Add 2 node with compute role.
|
5. Add 2 node with compute role.
|
||||||
6. Deploy the cluster.
|
6. Configure vcenter
|
||||||
7. Launch instances.
|
7. Deploy the cluster.
|
||||||
|
8. Run smoke OSTF tests
|
||||||
|
9. Launch instances. 1 per az. Assign floating ips.
|
||||||
|
10. Make snapshot
|
||||||
|
|
||||||
Duration: 1.8 hours
|
Duration: 1.8 hours
|
||||||
|
Snapshot: dvs_destructive_setup_2
|
||||||
"""
|
"""
|
||||||
|
self.show_step(1)
|
||||||
self.env.revert_snapshot("ready_with_5_slaves")
|
self.env.revert_snapshot("ready_with_5_slaves")
|
||||||
|
|
||||||
plugin.install_dvs_plugin(self.ssh_manager.admin_ip)
|
plugin.install_dvs_plugin(self.ssh_manager.admin_ip)
|
||||||
|
|
||||||
# Configure cluster with 2 vcenter clusters
|
self.show_step(2)
|
||||||
cluster_id = self.fuel_web.create_cluster(
|
cluster_id = self.fuel_web.create_cluster(
|
||||||
name=self.__class__.__name__,
|
name=self.__class__.__name__,
|
||||||
mode=DEPLOYMENT_MODE,
|
mode=DEPLOYMENT_MODE,
|
||||||
|
@ -324,7 +323,8 @@ class TestDVSDestructive(TestBasic):
|
||||||
)
|
)
|
||||||
plugin.enable_plugin(cluster_id, self.fuel_web)
|
plugin.enable_plugin(cluster_id, self.fuel_web)
|
||||||
|
|
||||||
# Assign role to node
|
self.show_step(3)
|
||||||
|
self.show_step(4)
|
||||||
self.fuel_web.update_nodes(
|
self.fuel_web.update_nodes(
|
||||||
cluster_id,
|
cluster_id,
|
||||||
{'slave-01': ['controller'],
|
{'slave-01': ['controller'],
|
||||||
|
@ -333,21 +333,23 @@ class TestDVSDestructive(TestBasic):
|
||||||
'slave-04': ['compute'],
|
'slave-04': ['compute'],
|
||||||
'slave-05': ['compute']}
|
'slave-05': ['compute']}
|
||||||
)
|
)
|
||||||
# Configure VMWare vCenter settings
|
self.show_step(6)
|
||||||
self.fuel_web.vcenter_configure(cluster_id, multiclusters=True)
|
self.fuel_web.vcenter_configure(cluster_id, multiclusters=True)
|
||||||
|
|
||||||
|
self.show_step(7)
|
||||||
self.fuel_web.deploy_cluster_wait(cluster_id)
|
self.fuel_web.deploy_cluster_wait(cluster_id)
|
||||||
|
|
||||||
|
self.show_step(8)
|
||||||
self.fuel_web.run_ostf(
|
self.fuel_web.run_ostf(
|
||||||
cluster_id=cluster_id, test_sets=['smoke'])
|
cluster_id=cluster_id, test_sets=['smoke'])
|
||||||
|
|
||||||
|
self.show_step(9)
|
||||||
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,
|
||||||
SERVTEST_PASSWORD,
|
SERVTEST_PASSWORD,
|
||||||
SERVTEST_TENANT)
|
SERVTEST_TENANT)
|
||||||
|
|
||||||
# create security group with rules for ssh and ping
|
|
||||||
security_group = os_conn.create_sec_group_for_ssh()
|
security_group = os_conn.create_sec_group_for_ssh()
|
||||||
|
|
||||||
network = os_conn.nova.networks.find(label=self.inter_net_name)
|
network = os_conn.nova.networks.find(label=self.inter_net_name)
|
||||||
|
@ -356,10 +358,9 @@ class TestDVSDestructive(TestBasic):
|
||||||
security_groups=[security_group.name]
|
security_groups=[security_group.name]
|
||||||
)
|
)
|
||||||
openstack.verify_instance_state(os_conn)
|
openstack.verify_instance_state(os_conn)
|
||||||
|
openstack.create_and_assign_floating_ips(os_conn, instances)
|
||||||
|
|
||||||
for instance in instances:
|
self.show_step(10)
|
||||||
os_conn.assign_floating_ip(instance)
|
|
||||||
|
|
||||||
self.env.make_snapshot("dvs_destructive_setup_2", is_make=True)
|
self.env.make_snapshot("dvs_destructive_setup_2", is_make=True)
|
||||||
|
|
||||||
@test(depends_on=[dvs_destructive_setup_2],
|
@test(depends_on=[dvs_destructive_setup_2],
|
||||||
|
@ -373,13 +374,14 @@ class TestDVSDestructive(TestBasic):
|
||||||
2. Verify connection between instances. Send ping,
|
2. Verify connection between instances. Send ping,
|
||||||
check that ping get reply
|
check that ping get reply
|
||||||
3. Reset controller.
|
3. Reset controller.
|
||||||
4. Check that vmclusters should be migrate to another controller.
|
4. Check that vmclusters migrate to another controller.
|
||||||
5. Verify connection between instances.
|
5. 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
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
self.show_step(1)
|
||||||
self.env.revert_snapshot("dvs_destructive_setup_2")
|
self.env.revert_snapshot("dvs_destructive_setup_2")
|
||||||
|
|
||||||
cluster_id = self.fuel_web.get_last_created_cluster()
|
cluster_id = self.fuel_web.get_last_created_cluster()
|
||||||
|
@ -389,36 +391,27 @@ class TestDVSDestructive(TestBasic):
|
||||||
SERVTEST_PASSWORD,
|
SERVTEST_PASSWORD,
|
||||||
SERVTEST_TENANT)
|
SERVTEST_TENANT)
|
||||||
|
|
||||||
# Verify connection between instances.
|
self.show_step(2)
|
||||||
# Send ping Check that ping get reply.
|
|
||||||
srv_list = os_conn.get_servers()
|
srv_list = os_conn.get_servers()
|
||||||
floating_ip = []
|
fips = []
|
||||||
for srv in srv_list:
|
for srv in srv_list:
|
||||||
floating_ip.append(os_conn.get_nova_instance_ip(
|
fips.append(os_conn.get_nova_instance_ip(
|
||||||
srv, net_name=self.inter_net_name, addrtype='floating'))
|
srv, net_name=self.inter_net_name, addrtype='floating'))
|
||||||
ip_pair = dict.fromkeys(floating_ip)
|
|
||||||
for key in ip_pair:
|
|
||||||
ip_pair[key] = [value for value in floating_ip if key != value]
|
|
||||||
openstack.check_connection_vms(ip_pair)
|
|
||||||
|
|
||||||
controller = self.fuel_web.get_nailgun_primary_node(
|
openstack.ping_each_other(fips)
|
||||||
self.env.d_env.nodes().slaves[0]
|
|
||||||
)
|
|
||||||
|
|
||||||
self.fuel_web.cold_restart_nodes(
|
d_ctrl = self.fuel_web.get_nailgun_primary_node(
|
||||||
[self.fuel_web.environment.d_env.get_node(name=controller.name)],
|
self.env.d_env.nodes().slaves[0])
|
||||||
wait_offline=True, wait_online=True,
|
n_ctrl = self.fuel_web.get_nailgun_node_by_devops_node(d_ctrl)
|
||||||
wait_after_destroy=300)
|
|
||||||
|
|
||||||
controller = self.fuel_web.get_nailgun_primary_node(
|
self.show_step(3)
|
||||||
self.env.d_env.nodes().slaves[1]
|
self.fuel_web.cold_restart_nodes([d_ctrl], wait_after_destroy=300)
|
||||||
)
|
|
||||||
|
|
||||||
# Verify connection between instances.
|
self.show_step(4)
|
||||||
# Send ping Check that ping get reply.
|
openstack.check_service(ip=n_ctrl['ip'], commands=self.cmds)
|
||||||
with self.fuel_web.get_ssh_for_node(controller.name) as ssh_control:
|
|
||||||
openstack.check_service(ssh=ssh_control, commands=self.cmds)
|
self.show_step(5)
|
||||||
openstack.check_connection_vms(ip_pair)
|
openstack.ping_each_other(fips)
|
||||||
|
|
||||||
@test(depends_on=[dvs_destructive_setup_2],
|
@test(depends_on=[dvs_destructive_setup_2],
|
||||||
groups=["dvs_vcenter_shutdown_controller"])
|
groups=["dvs_vcenter_shutdown_controller"])
|
||||||
|
@ -438,6 +431,7 @@ class TestDVSDestructive(TestBasic):
|
||||||
Duration: 1.8 hours
|
Duration: 1.8 hours
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
self.show_step(1)
|
||||||
self.env.revert_snapshot("dvs_destructive_setup_2")
|
self.env.revert_snapshot("dvs_destructive_setup_2")
|
||||||
|
|
||||||
cluster_id = self.fuel_web.get_last_created_cluster()
|
cluster_id = self.fuel_web.get_last_created_cluster()
|
||||||
|
@ -447,37 +441,29 @@ class TestDVSDestructive(TestBasic):
|
||||||
SERVTEST_PASSWORD,
|
SERVTEST_PASSWORD,
|
||||||
SERVTEST_TENANT)
|
SERVTEST_TENANT)
|
||||||
|
|
||||||
# Verify connection between instances.
|
self.show_step(2)
|
||||||
# Send ping, check that ping get reply.
|
|
||||||
srv_list = os_conn.get_servers()
|
srv_list = os_conn.get_servers()
|
||||||
floating_ip = []
|
fips = []
|
||||||
for srv in srv_list:
|
for srv in srv_list:
|
||||||
floating_ip.append(os_conn.get_nova_instance_ip(
|
fips.append(os_conn.get_nova_instance_ip(
|
||||||
srv, net_name=self.inter_net_name, addrtype='floating'))
|
srv, net_name=self.inter_net_name, addrtype='floating'))
|
||||||
ip_pair = dict.fromkeys(floating_ip)
|
openstack.ping_each_other(fips)
|
||||||
for key in ip_pair:
|
|
||||||
ip_pair[key] = [value for value in floating_ip if key != value]
|
|
||||||
openstack.check_connection_vms(ip_pair)
|
|
||||||
|
|
||||||
controllers = self.fuel_web.get_devops_nodes_by_nailgun_nodes(
|
n_ctrls = self.fuel_web.get_nailgun_cluster_nodes_by_roles(
|
||||||
self.fuel_web.get_nailgun_cluster_nodes_by_roles(
|
cluster_id=cluster_id, roles=['controller'])
|
||||||
cluster_id=cluster_id,
|
|
||||||
roles=['controller']))
|
|
||||||
|
|
||||||
with self.fuel_web.get_ssh_for_node(controllers[0].name) as ssh_contr:
|
openstack.check_service(ip=n_ctrls[0]['ip'], commands=self.cmds)
|
||||||
openstack.check_service(ssh=ssh_contr, commands=self.cmds)
|
openstack.ping_each_other(fips)
|
||||||
|
|
||||||
openstack.check_connection_vms(ip_pair)
|
|
||||||
|
|
||||||
|
self.show_step(3)
|
||||||
self.fuel_web.warm_shutdown_nodes(
|
self.fuel_web.warm_shutdown_nodes(
|
||||||
[self.fuel_web.environment.d_env.get_node(
|
[self.fuel_web.get_devops_node_by_nailgun_node(n_ctrls[0])])
|
||||||
name=controllers[0].name)])
|
|
||||||
|
|
||||||
# Verify connection between instances.
|
self.show_step(4)
|
||||||
# Send ping Check that ping get reply.
|
openstack.check_service(ip=n_ctrls[1]['ip'], commands=self.cmds)
|
||||||
with self.fuel_web.get_ssh_for_node(controllers[1].name) as ssh_contr:
|
|
||||||
openstack.check_service(ssh=ssh_contr, commands=self.cmds)
|
self.show_step(5)
|
||||||
openstack.check_connection_vms(ip_pair, timeout=90)
|
openstack.ping_each_other(fips, timeout=90)
|
||||||
|
|
||||||
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
|
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
|
||||||
groups=["dvs_reboot_vcenter_1"])
|
groups=["dvs_reboot_vcenter_1"])
|
||||||
|
@ -551,10 +537,7 @@ class TestDVSDestructive(TestBasic):
|
||||||
plugin.enable_plugin(cluster_id, self.fuel_web)
|
plugin.enable_plugin(cluster_id, self.fuel_web)
|
||||||
|
|
||||||
self.show_step(7)
|
self.show_step(7)
|
||||||
self.fuel_web.vcenter_configure(
|
self.fuel_web.vcenter_configure(cluster_id, multiclusters=True)
|
||||||
cluster_id,
|
|
||||||
multiclusters=True
|
|
||||||
)
|
|
||||||
|
|
||||||
self.show_step(8)
|
self.show_step(8)
|
||||||
self.fuel_web.verify_network(cluster_id)
|
self.fuel_web.verify_network(cluster_id)
|
||||||
|
@ -563,15 +546,13 @@ class TestDVSDestructive(TestBasic):
|
||||||
self.fuel_web.deploy_cluster_wait(cluster_id)
|
self.fuel_web.deploy_cluster_wait(cluster_id)
|
||||||
|
|
||||||
self.show_step(10)
|
self.show_step(10)
|
||||||
self.fuel_web.run_ostf(
|
self.fuel_web.run_ostf(cluster_id=cluster_id, test_sets=['smoke'])
|
||||||
cluster_id=cluster_id, test_sets=['smoke'])
|
|
||||||
|
|
||||||
os_ip = self.fuel_web.get_public_vip(cluster_id)
|
os_ip = self.fuel_web.get_public_vip(cluster_id)
|
||||||
self.extended_tests_reset_vcenter(os_ip)
|
self.extended_tests_reset_vcenter(os_ip)
|
||||||
|
|
||||||
self.show_step(18)
|
self.show_step(18)
|
||||||
self.fuel_web.run_ostf(
|
self.fuel_web.run_ostf(cluster_id=cluster_id, test_sets=['smoke'])
|
||||||
cluster_id=cluster_id, test_sets=['smoke'])
|
|
||||||
|
|
||||||
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
|
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
|
||||||
groups=["dvs_reboot_vcenter_2"])
|
groups=["dvs_reboot_vcenter_2"])
|
||||||
|
@ -599,7 +580,7 @@ class TestDVSDestructive(TestBasic):
|
||||||
configure Nova Compute instances on compute-vmware.
|
configure Nova Compute instances on compute-vmware.
|
||||||
8. Verify networks.
|
8. Verify networks.
|
||||||
9. Deploy cluster.
|
9. Deploy cluster.
|
||||||
10. Run OSTF.
|
10. Run Smoke OSTF.
|
||||||
11. Launch instance VM_1 with image TestVM, availability zone nova
|
11. Launch instance VM_1 with image TestVM, availability zone nova
|
||||||
and flavor m1.micro.
|
and flavor m1.micro.
|
||||||
12. Launch instance VM_2 with image TestVM-VMDK, availability zone
|
12. Launch instance VM_2 with image TestVM-VMDK, availability zone
|
||||||
|
@ -610,7 +591,7 @@ class TestDVSDestructive(TestBasic):
|
||||||
15. Check that controller lost connection with vCenter.
|
15. Check that controller lost connection with vCenter.
|
||||||
16. Wait for vCenter.
|
16. Wait for vCenter.
|
||||||
17. Ensure that all instances from vCenter displayed in dashboard.
|
17. Ensure that all instances from vCenter displayed in dashboard.
|
||||||
18. Run OSTF.
|
18. Run Smoke OSTF.
|
||||||
|
|
||||||
|
|
||||||
Duration: 2.5 hours
|
Duration: 2.5 hours
|
||||||
|
@ -661,12 +642,10 @@ class TestDVSDestructive(TestBasic):
|
||||||
self.fuel_web.deploy_cluster_wait(cluster_id)
|
self.fuel_web.deploy_cluster_wait(cluster_id)
|
||||||
|
|
||||||
self.show_step(10)
|
self.show_step(10)
|
||||||
self.fuel_web.run_ostf(
|
self.fuel_web.run_ostf(cluster_id=cluster_id, test_sets=['smoke'])
|
||||||
cluster_id=cluster_id, test_sets=['smoke'])
|
|
||||||
|
|
||||||
os_ip = self.fuel_web.get_public_vip(cluster_id)
|
os_ip = self.fuel_web.get_public_vip(cluster_id)
|
||||||
self.extended_tests_reset_vcenter(os_ip)
|
self.extended_tests_reset_vcenter(os_ip)
|
||||||
|
|
||||||
self.show_step(18)
|
self.show_step(18)
|
||||||
self.fuel_web.run_ostf(
|
self.fuel_web.run_ostf(cluster_id=cluster_id, test_sets=['smoke'])
|
||||||
cluster_id=cluster_id, test_sets=['smoke'])
|
|
||||||
|
|
Loading…
Reference in New Issue