diff --git a/plugin_test/helpers/openstack.py b/plugin_test/helpers/openstack.py index da1c580..546c4ec 100644 --- a/plugin_test/helpers/openstack.py +++ b/plugin_test/helpers/openstack.py @@ -78,7 +78,7 @@ def create_instances(os_conn, nics, vm_count=1, """Create Vms on available hypervisors. :param os_conn: type object, openstack - :param vm_count: type interger, count of VMs to create + :param vm_count: type integer, count of VMs to create :param nics: type dictionary, neutron networks to assign to instance :param security_groups: A list of security group names @@ -92,8 +92,7 @@ def create_instances(os_conn, nics, vm_count=1, if not available_hosts: available_hosts = os_conn.nova.services.list(binary='nova-compute') for host in available_hosts: - image = [image for image - in images_list + image = [image for image in images_list if image.name == zone_image_maps[host.zone]][0] instance = os_conn.nova.servers.create( flavor=flavor, @@ -129,7 +128,7 @@ def check_connection_vms(ip_pair, command='pingv4', """Check network connectivity between instances. :param os_conn: type object, openstack - :param ip_pair: type list, pair floating ips of instances + :param ip_pair: type dict, {ip_from: [ip_to1, ip_to2, etc.]} :param command: type string, key from dictionary 'commands' by default is 'pingv4' :param result_of_command: type interger, exite code of command execution @@ -150,15 +149,15 @@ def check_connection_vms(ip_pair, command='pingv4', for ip_to in ip_pair[ip_from]: message = generate_message( commands[command], result_of_command, ip_from, ip_to) - logger.info("Check connectin from {0} to {1}.".format( + logger.info("Check connection from {0} to {1}.".format( ip_from, ip_to)) cmd = commands[command].format(ip_to) wait(lambda: execute( ssh, cmd)['exit_code'] == result_of_command, interval=interval, timeout=timeout, - timeout_msg=message.format( - ip_from, ip_to)) + timeout_msg=message.format(ip_from, ip_to) + ) def check_connection_through_host(remote, ip_pair, command='pingv4', diff --git a/plugin_test/tests/test_plugin_vmware_dvs_destructive.py b/plugin_test/tests/test_plugin_vmware_dvs_destructive.py index dc7c0f7..3c7a0b0 100644 --- a/plugin_test/tests/test_plugin_vmware_dvs_destructive.py +++ b/plugin_test/tests/test_plugin_vmware_dvs_destructive.py @@ -21,7 +21,6 @@ from devops.helpers.helpers import wait from proboscis import test from proboscis.asserts import assert_true -import fuelweb_test.tests.base_test_case import fuelweb_test.tests.base_test_case from fuelweb_test import logger from fuelweb_test.helpers import os_actions @@ -40,7 +39,8 @@ TestBasic = fuelweb_test.tests.base_test_case.TestBasic SetupEnvironment = fuelweb_test.tests.base_test_case.SetupEnvironment -@test(groups=["plugins", 'dvs_vcenter_plugin', 'dvs_vcenter_system']) +@test(groups=["plugins", 'dvs_vcenter_plugin', 'dvs_vcenter_system', + 'dvs_vcenter_destructive']) class TestDVSDestructive(TestBasic): """Failover test suite. @@ -112,13 +112,17 @@ class TestDVSDestructive(TestBasic): instance, net_name=self.inter_net_name)) time.sleep(30) self.show_step(13) - for ip in ips: - ping_result = openstack.remote_execute_command( - access_point_ip, ip, "ping -c 5 {}".format(ip)) - assert_true( - ping_result['exit_code'] == 0, - "Ping isn't available from {0} to {1}".format(ip, ip) - ) + ip_pair = { + 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) vcenter_name = [ @@ -134,24 +138,26 @@ class TestDVSDestructive(TestBasic): self.show_step(15) wait(lambda: not icmp_ping( self.VCENTER_IP), interval=1, timeout=10, - timeout_msg='Vcenter is still availabled.') + timeout_msg='Vcenter is still available.') self.show_step(16) wait(lambda: icmp_ping( self.VCENTER_IP), interval=5, timeout=120, - timeout_msg='Vcenter is not availabled.') + timeout_msg='Vcenter is not available.') self.show_step(17) - for ip in ips: - ping_result = openstack.remote_execute_command( - access_point_ip, ip, "ping -c 5 {}".format(ip)) - assert_true( - ping_result['exit_code'] == 0, - "Ping isn't available from {0} to {1}".format(ip, ip) - ) + 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) + ) @test(depends_on=[TestDVSSystem.dvs_vcenter_systest_setup], - groups=["dvs_vcenter_uninstall", 'dvs_vcenter_system']) + groups=["dvs_vcenter_uninstall"]) @log_snapshot_after_test def dvs_vcenter_uninstall(self): """Negative uninstall of Fuel DVS plugin with deployed environment. @@ -163,21 +169,25 @@ class TestDVSDestructive(TestBasic): Duration: 1.8 hours """ - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") # Try to uninstall dvs plugin cmd = 'fuel plugins --remove {0}=={1}'.format( plugin.plugin_name, plugin.DVS_PLUGIN_VERSION) - self.env.d_env.get_admin_remote().execute(cmd)['exit_code'] == 1 + self.ssh_manager.execute_on_remote( + ip=self.ssh_manager.admin_ip, + cmd=cmd, + assert_ec_equal=[1] + ) # Check that plugin is not removed - output = list(self.env.d_env.get_admin_remote().execute( - 'fuel plugins list')['stdout']) - + output = self.ssh_manager.execute_on_remote( + ip=self.ssh_manager.admin_ip, cmd='fuel plugins list')['stdout'] assert_true( plugin.plugin_name in output[-1].split(' '), - "Plugin is removed {}".format(plugin.plugin_name) + "Plugin '{0}' was removed".format(plugin.plugin_name) ) @test(depends_on=[TestDVSSystem.dvs_vcenter_systest_setup], @@ -203,7 +213,8 @@ class TestDVSDestructive(TestBasic): Duration: 1,5 hours """ - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() @@ -276,20 +287,12 @@ class TestDVSDestructive(TestBasic): port['id'], {'port': {'admin_state_up': True}} ) - instance.reboot() - wait( - lambda: - os_conn.get_instance_detail(instance).status == "ACTIVE", - timeout=300) - - time.sleep(60) # need time after reboot to get ip by instance - - # Verify that instances should communicate between each other. + # Verify that instances communicate between each other. # Send icmp ping between instances - openstack.check_connection_vms(ip_pair) + openstack.check_connection_vms(ip_pair, timeout=90) @test(depends_on=[SetupEnvironment.prepare_slaves_5], - groups=["dvs_destructive_setup_2", 'dvs_vcenter_system']) + groups=["dvs_destructive_setup_2"]) @log_snapshot_after_test def dvs_destructive_setup_2(self): """Verify that vmclusters should be migrate after reset controller. @@ -360,7 +363,7 @@ class TestDVSDestructive(TestBasic): self.env.make_snapshot("dvs_destructive_setup_2", is_make=True) @test(depends_on=[dvs_destructive_setup_2], - groups=["dvs_vcenter_reset_controller", 'dvs_vcenter_system']) + groups=["dvs_vcenter_reset_controller"]) @log_snapshot_after_test def dvs_vcenter_reset_controller(self): """Verify that vmclusters should be migrate after reset controller. @@ -377,7 +380,8 @@ class TestDVSDestructive(TestBasic): Duration: 1.8 hours """ - self.env.revert_snapshot("dvs_destructive_setup_2") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_destructive_setup_2") cluster_id = self.fuel_web.get_last_created_cluster() os_ip = self.fuel_web.get_public_vip(cluster_id) @@ -418,7 +422,7 @@ class TestDVSDestructive(TestBasic): openstack.check_connection_vms(ip_pair) @test(depends_on=[dvs_destructive_setup_2], - groups=["dvs_vcenter_shutdown_controller", 'dvs_vcenter_system']) + groups=["dvs_vcenter_shutdown_controller"]) @log_snapshot_after_test def dvs_vcenter_shutdown_controller(self): """Verify that vmclusters should be migrate after shutdown controller. @@ -435,7 +439,8 @@ class TestDVSDestructive(TestBasic): Duration: 1.8 hours """ - self.env.revert_snapshot("dvs_destructive_setup_2") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_destructive_setup_2") cluster_id = self.fuel_web.get_last_created_cluster() os_ip = self.fuel_web.get_public_vip(cluster_id) @@ -469,16 +474,15 @@ class TestDVSDestructive(TestBasic): self.fuel_web.warm_shutdown_nodes( [self.fuel_web.environment.d_env.get_node( name=controllers[0].name)]) - time.sleep(30) # Verify connection between instances. # Send ping Check that ping get reply. with self.fuel_web.get_ssh_for_node(controllers[1].name) as ssh_contr: openstack.check_service(ssh=ssh_contr, commands=self.cmds) - openstack.check_connection_vms(ip_pair) + openstack.check_connection_vms(ip_pair, timeout=90) @test(depends_on=[SetupEnvironment.prepare_slaves_5], - groups=["dvs_reboot_vcenter_1", 'dvs_vcenter_system']) + groups=["dvs_reboot_vcenter_1"]) @log_snapshot_after_test def dvs_reboot_vcenter_1(self): """Verify that vmclusters should be migrate after reset controller. @@ -572,7 +576,7 @@ class TestDVSDestructive(TestBasic): cluster_id=cluster_id, test_sets=['smoke']) @test(depends_on=[SetupEnvironment.prepare_slaves_5], - groups=["dvs_reboot_vcenter_2", 'dvs_vcenter_system']) + groups=["dvs_reboot_vcenter_2"]) @log_snapshot_after_test def dvs_reboot_vcenter_2(self): """Verify that vmclusters should be migrate after reset controller. diff --git a/plugin_test/tests/test_plugin_vmware_dvs_maintenance.py b/plugin_test/tests/test_plugin_vmware_dvs_maintenance.py index 2a6b6fd..8e4810b 100644 --- a/plugin_test/tests/test_plugin_vmware_dvs_maintenance.py +++ b/plugin_test/tests/test_plugin_vmware_dvs_maintenance.py @@ -25,7 +25,9 @@ from fuelweb_test.settings import SERVTEST_TENANT from fuelweb_test.settings import SERVTEST_USERNAME from helpers import openstack -from tests.test_plugin_vmware_dvs_smoke import TestDVSSmoke +from tests.test_plugin_vmware_dvs_smoke import TestDVSBVT + + TestBasic = fuelweb_test.tests.base_test_case.TestBasic @@ -45,7 +47,7 @@ class TestDVSMaintenance(TestBasic): """Get node by name.""" return self.fuel_web.get_nailgun_node_by_name(name_node)['hostname'] - @test(depends_on=[TestDVSSmoke.dvs_vcenter_bvt], + @test(depends_on=[TestDVSBVT.dvs_vcenter_bvt], groups=["dvs_regression"]) @log_snapshot_after_test def dvs_regression(self): diff --git a/plugin_test/tests/test_plugin_vmware_dvs_smoke.py b/plugin_test/tests/test_plugin_vmware_dvs_smoke.py index 725d6a1..759ce38 100644 --- a/plugin_test/tests/test_plugin_vmware_dvs_smoke.py +++ b/plugin_test/tests/test_plugin_vmware_dvs_smoke.py @@ -26,7 +26,7 @@ TestBasic = fuelweb_test.tests.base_test_case.TestBasic SetupEnvironment = fuelweb_test.tests.base_test_case.SetupEnvironment -@test(groups=["plugins", 'dvs_vcenter_plugin']) +@test(groups=["plugins", 'dvs_vcenter_plugin', 'dvs_vcenter_smoke']) class TestDVSSmoke(TestBasic): """Smoke test suite. @@ -35,12 +35,86 @@ class TestDVSSmoke(TestBasic): will be used by QA to accept software builds from Development team. """ - def node_name(self, name_node): - """Get node by name.""" - return self.fuel_web.get_nailgun_node_by_name(name_node)['hostname'] - @test(depends_on=[SetupEnvironment.prepare_slaves_1], - groups=["dvs_vcenter_smoke", "dvs_vcenter_plugin"]) + groups=["dvs_install"]) + @log_snapshot_after_test + def dvs_install(self): + """Check that plugin can be installed. + + Scenario: + 1. Upload plugins to the master node + 2. Install plugin. + 3. Ensure that plugin is installed successfully using cli, + run command 'fuel plugins'. Check name, version of plugin. + + Duration: 30 min + + """ + self.env.revert_snapshot("ready_with_1_slaves") + + self.show_step(1) + self.show_step(2) + plugin.install_dvs_plugin( + self.ssh_manager.admin_ip) + + cmd = 'fuel plugins list' + + output = self.ssh_manager.execute_on_remote( + ip=self.ssh_manager.admin_ip, + cmd=cmd)['stdout'].pop().split(' ') + + # check name + assert_true( + plugin.plugin_name in output, + "Plugin '{0}' is not installed.".format(plugin.plugin_name) + ) + # check version + assert_true( + plugin.DVS_PLUGIN_VERSION in output, + "Plugin '{0}' is not installed.".format(plugin.plugin_name) + ) + self.env.make_snapshot("dvs_install", is_make=True) + + @test(depends_on=[dvs_install], + groups=["dvs_uninstall"]) + @log_snapshot_after_test + def dvs_uninstall(self): + """Check that plugin can be removed. + + Scenario: + 1. Revert to snapshot 'dvs_install'. + 2. Remove plugin. + 3. Verify that plugin is removed, run command 'fuel plugins'. + + + Duration: 5 min + + """ + self.show_step(1) + self.env.revert_snapshot("dvs_install") + + self.show_step(2) + cmd = 'fuel plugins --remove {0}=={1}'.format( + plugin.plugin_name, plugin.DVS_PLUGIN_VERSION) + + self.ssh_manager.execute_on_remote( + ip=self.ssh_manager.admin_ip, + cmd=cmd, + err_msg='Can not remove plugin.' + ) + + self.show_step(3) + output = self.ssh_manager.execute_on_remote( + ip=self.ssh_manager.admin_ip, + cmd='fuel plugins list')['stdout'].pop().split(' ') + + assert_true( + plugin.plugin_name not in output, + "Plugin '{0}' is not removed".format(plugin.plugin_name) + ) + + @test(depends_on=[dvs_install], + groups=["dvs_vcenter_smoke"]) @log_snapshot_after_test def dvs_vcenter_smoke(self): """Check deployment with VMware DVS plugin and one controller. @@ -66,10 +140,7 @@ class TestDVSSmoke(TestBasic): Duration: 1.8 hours """ - self.env.revert_snapshot("ready_with_1_slaves") - - plugin.install_dvs_plugin( - self.ssh_manager.admin_ip) + self.env.revert_snapshot("dvs_install") # Configure cluster with 2 vcenter clusters cluster_id = self.fuel_web.create_cluster( @@ -97,8 +168,13 @@ class TestDVSSmoke(TestBasic): self.fuel_web.run_ostf( cluster_id=cluster_id, test_sets=['smoke']) + +@test(groups=["plugins", 'dvs_vcenter_bvt']) +class TestDVSBVT(TestBasic): + """Build verification test.""" + @test(depends_on=[SetupEnvironment.prepare_slaves_9], - groups=["dvs_vcenter_bvt", "dvs_vcenter_plugin"]) + groups=["dvs_vcenter_bvt"]) @log_snapshot_after_test def dvs_vcenter_bvt(self): """Deploy cluster with DVS plugin and ceph storage. @@ -165,7 +241,8 @@ class TestDVSSmoke(TestBasic): ) # Configure VMWare vCenter settings - target_node_2 = self.node_name('slave-07') + target_node_2 = self.fuel_web.get_nailgun_node_by_name('slave-07') + target_node_2 = target_node_2['hostname'] self.fuel_web.vcenter_configure( cluster_id, target_node_2=target_node_2, @@ -179,78 +256,3 @@ class TestDVSSmoke(TestBasic): cluster_id=cluster_id, test_sets=['smoke']) self.env.make_snapshot("dvs_bvt", is_make=True) - - @test(depends_on=[SetupEnvironment.prepare_slaves_1], - groups=["dvs_install", "dvs_vcenter_plugin"]) - @log_snapshot_after_test - def dvs_install(self): - """Check that plugin can be installed. - - Scenario: - 1. Upload plugins to the master node - 2. Install plugin. - 3. Ensure that plugin is installed successfully using cli, - run command 'fuel plugins'. Check name, version of plugin. - - Duration: 30 min - - """ - self.env.revert_snapshot("ready_with_1_slaves") - - self.show_step(1) - self.show_step(2) - plugin.install_dvs_plugin( - self.ssh_manager.admin_ip) - - cmd = 'fuel plugins list' - - output = list(self.env.d_env.get_admin_remote().execute( - cmd)['stdout']).pop().split(' ') - - # check name - assert_true( - plugin.plugin_name in output, - "Plugin {} is not installed.".format(plugin.plugin_name) - ) - # check version - assert_true( - plugin.DVS_PLUGIN_VERSION in output, - "Plugin {} is not installed.".format(plugin.plugin_name) - ) - self.env.make_snapshot("dvs_install", is_make=True) - - @test(depends_on=[dvs_install], - groups=["dvs_uninstall", "dvs_vcenter_plugin"]) - @log_snapshot_after_test - def dvs_uninstall(self): - """Check that plugin can be removed. - - Scenario: - 1. Revert to snapshot 'dvs_install'. - 2. Remove plugin. - 3. Verify that plugin is removed, run command 'fuel plugins'. - - - Duration: 5 min - - """ - self.show_step(1) - self.env.revert_snapshot("dvs_install") - - self.show_step(2) - cmd = 'fuel plugins --remove {0}=={1}'.format( - plugin.plugin_name, plugin.DVS_PLUGIN_VERSION) - - assert_true( - self.env.d_env.get_admin_remote().execute(cmd)['exit_code'] == 0, - 'Can not remove plugin.') - - self.show_step(3) - cmd = 'fuel plugins list' - output = list(self.env.d_env.get_admin_remote().execute( - cmd)['stdout']).pop().split(' ') - - assert_true( - plugin.plugin_name not in output, - "Plugin is not removed {}".format(plugin.plugin_name) - ) diff --git a/plugin_test/tests/test_plugin_vmware_dvs_system.py b/plugin_test/tests/test_plugin_vmware_dvs_system.py index f7a77ff..4ef0e0b 100644 --- a/plugin_test/tests/test_plugin_vmware_dvs_system.py +++ b/plugin_test/tests/test_plugin_vmware_dvs_system.py @@ -81,7 +81,7 @@ class TestDVSSystem(TestBasic): "remote_ip_prefix": None}} @test(depends_on=[SetupEnvironment.prepare_slaves_5], - groups=["dvs_vcenter_systest_setup", 'dvs_vcenter_system']) + groups=["dvs_vcenter_systest_setup"]) @log_snapshot_after_test def dvs_vcenter_systest_setup(self): """Deploy cluster with plugin and vmware datastore backend. @@ -149,7 +149,7 @@ class TestDVSSystem(TestBasic): self.env.make_snapshot("dvs_vcenter_systest_setup", is_make=True) @test(depends_on=[dvs_vcenter_systest_setup], - groups=["dvs_vcenter_networks", 'dvs_vcenter_system']) + groups=["dvs_vcenter_networks"]) @log_snapshot_after_test def dvs_vcenter_networks(self): """Check abilities to create and terminate networks on DVS. @@ -166,7 +166,8 @@ class TestDVSSystem(TestBasic): """ self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() @@ -218,8 +219,9 @@ class TestDVSSystem(TestBasic): network_name=self.net_data[0].keys()[0], tenant_id=tenant.id)['network'] - logger.info('Create subnet {}'.format(net.keys()[0])) - subnet = os_conn.create_subnet( + logger.info('Create subnet {}'.format(self.net_data[0].keys()[0])) + # subnet + os_conn.create_subnet( subnet_name=self.net_data[0].keys()[0], network_id=network['id'], cidr=self.net_data[0][self.net_data[0].keys()[0]], @@ -231,7 +233,7 @@ class TestDVSSystem(TestBasic): logger.info('Networks net_1 and net_2 are present.') @test(depends_on=[dvs_vcenter_systest_setup], - groups=["dvs_vcenter_ping_public", 'dvs_vcenter_system']) + groups=["dvs_vcenter_ping_public"]) @log_snapshot_after_test def dvs_vcenter_ping_public(self): """Check connectivity instances to public network with floating ip. @@ -253,7 +255,8 @@ class TestDVSSystem(TestBasic): """ self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() @@ -307,7 +310,7 @@ class TestDVSSystem(TestBasic): openstack.check_connection_vms(ip_pair) @test(depends_on=[dvs_vcenter_systest_setup], - groups=["dvs_instances_one_group", 'dvs_vcenter_system']) + groups=["dvs_instances_one_group"]) @log_snapshot_after_test def dvs_instances_one_group(self): """Check creation instance in the one group simultaneously. @@ -327,7 +330,8 @@ class TestDVSSystem(TestBasic): """ self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() @@ -375,7 +379,7 @@ class TestDVSSystem(TestBasic): os_conn.verify_srv_deleted(srv) @test(depends_on=[dvs_vcenter_systest_setup], - groups=["dvs_vcenter_security", 'dvs_vcenter_system']) + groups=["dvs_vcenter_security"]) @log_snapshot_after_test def dvs_vcenter_security(self): """Check abilities to create and delete security group. @@ -418,7 +422,8 @@ class TestDVSSystem(TestBasic): wait_to_update_rules_on_dvs_ports = 30 self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() @@ -567,7 +572,7 @@ class TestDVSSystem(TestBasic): openstack.check_connection_vms(ip_pair, command='ssh') @test(depends_on=[dvs_vcenter_systest_setup], - groups=["dvs_vcenter_tenants_isolation", 'dvs_vcenter_system']) + groups=["dvs_vcenter_tenants_isolation"]) @log_snapshot_after_test def dvs_vcenter_tenants_isolation(self): """Connectivity between instances in different tenants. @@ -591,7 +596,8 @@ class TestDVSSystem(TestBasic): """ self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() @@ -605,28 +611,28 @@ class TestDVSSystem(TestBasic): admin.create_user_and_tenant('test', 'test', 'test') openstack.add_role_to_user(admin, 'test', 'admin', 'test') - test = os_actions.OpenStackActions( + test_os = os_actions.OpenStackActions( os_ip, 'test', 'test', 'test') - tenant = test.get_tenant('test') + tenant = test_os.get_tenant('test') self.show_step(3) - network_test = test.create_network( + network_test = test_os.create_network( network_name=self.net_data[0].keys()[0], tenant_id=tenant.id)['network'] - subnet_test = test.create_subnet( + subnet_test = test_os.create_subnet( subnet_name=network_test['name'], network_id=network_test['id'], cidr=self.net_data[0][self.net_data[0].keys()[0]], ip_version=4) # create security group with rules for ssh and ping - security_group_test = test.create_sec_group_for_ssh() + security_group_test = test_os.create_sec_group_for_ssh() self.show_step(4) - router = test.create_router('router_1', tenant=tenant) - test.add_router_interface( + router = test_os.create_router('router_1', tenant=tenant) + test_os.add_router_interface( router_id=router["id"], subnet_id=subnet_test["id"]) @@ -642,11 +648,11 @@ class TestDVSSystem(TestBasic): self.show_step(6) srv_2 = openstack.create_instances( - os_conn=test, vm_count=1, + os_conn=test_os, vm_count=1, nics=[{'net-id': network_test['id']}], security_groups=[security_group_test.name] ) - openstack.verify_instance_state(test) + openstack.verify_instance_state(test_os) self.show_step(7) fip_1 = openstack.create_and_assign_floating_ips(admin, srv_1) @@ -655,10 +661,10 @@ class TestDVSSystem(TestBasic): ips_1.append(admin.get_nova_instance_ip( srv, net_name=self.inter_net_name)) - fip_2 = openstack.create_and_assign_floating_ips(test, srv_2) + fip_2 = openstack.create_and_assign_floating_ips(test_os, srv_2) ips_2 = [] for srv in srv_2: - ips_2.append(test.get_nova_instance_ip( + ips_2.append(test_os.get_nova_instance_ip( srv, net_name=network_test['name'])) ip_pair = dict.fromkeys(fip_1) for key in ip_pair: @@ -670,7 +676,7 @@ class TestDVSSystem(TestBasic): openstack.check_connection_vms(ip_pair, result_of_command=1) @test(depends_on=[dvs_vcenter_systest_setup], - groups=["dvs_vcenter_same_ip", 'dvs_vcenter_system']) + groups=["dvs_vcenter_same_ip"]) @log_snapshot_after_test def dvs_vcenter_same_ip(self): """Connectivity between instances with same ip in different tenants. @@ -704,7 +710,8 @@ class TestDVSSystem(TestBasic): """ self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() @@ -720,44 +727,44 @@ class TestDVSSystem(TestBasic): admin.create_user_and_tenant('test', 'test', 'test') openstack.add_role_to_user(admin, 'test', 'admin', 'test') - test = os_actions.OpenStackActions( + test_os = os_actions.OpenStackActions( os_ip, 'test', 'test', 'test') - tenant = test.get_tenant('test') + tenant = test_os.get_tenant('test') self.show_step(3) logger.info('Create network {}'.format(self.net_data[0].keys()[0])) - network = test.create_network( + network = test_os.create_network( network_name=self.net_data[0].keys()[0], tenant_id=tenant.id)['network'] - subnet = test.create_subnet( + subnet = test_os.create_subnet( subnet_name=network['name'], network_id=network['id'], cidr=self.net_data[0][self.net_data[0].keys()[0]], ip_version=4) self.show_step(4) - router = test.create_router('router_1', tenant=tenant) - test.add_router_interface( + router = test_os.create_router('router_1', tenant=tenant) + test_os.add_router_interface( router_id=router["id"], subnet_id=subnet["id"]) # create security group with rules for ssh and ping - security_group = test.create_sec_group_for_ssh() + security_group = test_os.create_sec_group_for_ssh() self.show_step(5) self.show_step(6) srv_1 = openstack.create_instances( - os_conn=test, nics=[{'net-id': network['id']}], vm_count=1, + os_conn=test_os, nics=[{'net-id': network['id']}], vm_count=1, security_groups=[security_group.name] ) - openstack.verify_instance_state(test) + openstack.verify_instance_state(test_os) - fip_1 = openstack.create_and_assign_floating_ips(test, srv_1) + fip_1 = openstack.create_and_assign_floating_ips(test_os, srv_1) ips_1 = [] for srv in srv_1: - ips_1.append(test.get_nova_instance_ip( + ips_1.append(test_os.get_nova_instance_ip( srv, net_name=network['name'])) # create security group with rules for ssh and ping @@ -806,7 +813,7 @@ class TestDVSSystem(TestBasic): openstack.check_connection_vms(ip_pair) @test(depends_on=[SetupEnvironment.prepare_slaves_5], - groups=["dvs_volume", 'dvs_vcenter_system']) + groups=["dvs_volume"]) @log_snapshot_after_test def dvs_volume(self): """Deploy cluster with plugin and vmware datastore backend. @@ -952,7 +959,8 @@ class TestDVSSystem(TestBasic): """ self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() os_ip = self.fuel_web.get_public_vip(cluster_id) @@ -1020,7 +1028,8 @@ class TestDVSSystem(TestBasic): """ self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() os_ip = self.fuel_web.get_public_vip(cluster_id) @@ -1116,7 +1125,8 @@ class TestDVSSystem(TestBasic): """ self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() os_ip = self.fuel_web.get_public_vip(cluster_id) @@ -1229,7 +1239,8 @@ class TestDVSSystem(TestBasic): """ self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() @@ -1372,7 +1383,8 @@ class TestDVSSystem(TestBasic): template_path = 'plugin_test/templates/dvs_stack.yaml' self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() @@ -1442,7 +1454,8 @@ class TestDVSSystem(TestBasic): """ self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() os_ip = self.fuel_web.get_public_vip(cluster_id) @@ -1596,7 +1609,8 @@ class TestDVSSystem(TestBasic): """ self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() os_ip = self.fuel_web.get_public_vip(cluster_id) @@ -1749,7 +1763,8 @@ class TestDVSSystem(TestBasic): """ self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() os_ip = self.fuel_web.get_public_vip(cluster_id) @@ -1843,7 +1858,7 @@ class TestDVSSystem(TestBasic): flag = False @test(depends_on=[dvs_vcenter_systest_setup], - groups=["dvs_instances_batch_mix_sg", 'dvs_vcenter_system']) + groups=["dvs_instances_batch_mix_sg"]) @log_snapshot_after_test def dvs_instances_batch_mix_sg(self): """Launch/remove instances in the one group with few security groups. @@ -1882,7 +1897,8 @@ class TestDVSSystem(TestBasic): """ self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() @@ -1930,10 +1946,15 @@ class TestDVSSystem(TestBasic): self.show_step(3) self.show_step(4) - sg1 = os_conn.nova.security_groups.create( - 'SG1', "descr") - sg2 = os_conn.nova.security_groups.create( - 'SG2', "descr") + sg1 = os_conn.nova.security_groups.create('SG1', "descr") + sg2 = os_conn.nova.security_groups.create('SG2', "descr") + + self.icmp["security_group_rule"]["security_group_id"] = sg1.id + self.icmp["security_group_rule"]["remote_group_id"] = sg1.id + self.icmp["security_group_rule"]["direction"] = "ingress" + os_conn.neutron.create_security_group_rule(self.icmp) + self.icmp["security_group_rule"]["direction"] = "egress" + os_conn.neutron.create_security_group_rule(self.icmp) for sg in [sg1, sg2]: self.tcp["security_group_rule"]["security_group_id"] = sg.id @@ -1943,13 +1964,6 @@ class TestDVSSystem(TestBasic): self.tcp["security_group_rule"]["direction"] = "egress" os_conn.neutron.create_security_group_rule(self.tcp) - self.icmp["security_group_rule"]["security_group_id"] = sg.id - self.icmp["security_group_rule"]["remote_group_id"] = sg.id - self.icmp["security_group_rule"]["direction"] = "ingress" - os_conn.neutron.create_security_group_rule(self.icmp) - self.icmp["security_group_rule"]["direction"] = "egress" - os_conn.neutron.create_security_group_rule(self.icmp) - # add rules for ssh and ping os_conn.goodbye_security() default_sg = [ @@ -2023,7 +2037,8 @@ class TestDVSSystem(TestBasic): """ self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() os_ip = self.fuel_web.get_public_vip(cluster_id) @@ -2196,7 +2211,8 @@ class TestDVSSystem(TestBasic): """ self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster() @@ -2247,7 +2263,7 @@ class TestDVSSystem(TestBasic): openstack.check_connection_vms(ip_pair, result_of_command=1) @test(depends_on=[dvs_vcenter_systest_setup], - groups=["dvs_update_network", 'dvs_vcenter_system']) + groups=["dvs_update_network"]) @log_snapshot_after_test def dvs_update_network(self): """Check abilities to create and terminate networks on DVS. @@ -2262,7 +2278,8 @@ class TestDVSSystem(TestBasic): """ self.show_step(1) - self.env.revert_snapshot("dvs_vcenter_systest_setup") + # TODO(vgorin) Uncomment when reverting of WS snapshot is available + # self.env.revert_snapshot("dvs_vcenter_systest_setup") cluster_id = self.fuel_web.get_last_created_cluster()