diff options
Diffstat (limited to 'testcases/vPing/CI/libraries/vPing_userdata.py')
-rw-r--r-- | testcases/vPing/CI/libraries/vPing_userdata.py | 64 |
1 files changed, 29 insertions, 35 deletions
diff --git a/testcases/vPing/CI/libraries/vPing_userdata.py b/testcases/vPing/CI/libraries/vPing_userdata.py index 798cf1c63..09acb2df2 100644 --- a/testcases/vPing/CI/libraries/vPing_userdata.py +++ b/testcases/vPing/CI/libraries/vPing_userdata.py @@ -78,31 +78,28 @@ TEST_DB = functest_yaml.get("results").get("test_db_url") NAME_VM_1 = functest_yaml.get("vping").get("vm_name_1") NAME_VM_2 = functest_yaml.get("vping").get("vm_name_2") GLANCE_IMAGE_NAME = functest_yaml.get("vping").get("image_name") -GLANCE_IMAGE_FILENAME = functest_yaml.get("general"). \ - get("openstack").get("image_file_name") -GLANCE_IMAGE_FORMAT = functest_yaml.get("general"). \ - get("openstack").get("image_disk_format") -GLANCE_IMAGE_PATH = functest_yaml.get("general"). \ - get("directories").get("dir_functest_data") + "/" + GLANCE_IMAGE_FILENAME +GLANCE_IMAGE_FILENAME = functest_yaml.get("general").get( + "openstack").get("image_file_name") +GLANCE_IMAGE_FORMAT = functest_yaml.get("general").get( + "openstack").get("image_disk_format") +GLANCE_IMAGE_PATH = functest_yaml.get("general").get("directories").get( + "dir_functest_data") + "/" + GLANCE_IMAGE_FILENAME FLAVOR = functest_yaml.get("vping").get("vm_flavor") # NEUTRON Private Network parameters -NEUTRON_PRIVATE_NET_NAME = functest_yaml.get("vping"). \ - get("vping_private_net_name") -NEUTRON_PRIVATE_SUBNET_NAME = functest_yaml.get("vping"). \ - get("vping_private_subnet_name") -NEUTRON_PRIVATE_SUBNET_CIDR = functest_yaml.get("vping"). \ - get("vping_private_subnet_cidr") -NEUTRON_ROUTER_NAME = functest_yaml.get("vping"). \ - get("vping_router_name") +NEUTRON_PRIVATE_NET_NAME = functest_yaml.get("vping").get( + "vping_private_net_name") +NEUTRON_PRIVATE_SUBNET_NAME = functest_yaml.get("vping").get( + "vping_private_subnet_name") +NEUTRON_PRIVATE_SUBNET_CIDR = functest_yaml.get("vping").get( + "vping_private_subnet_cidr") +NEUTRON_ROUTER_NAME = functest_yaml.get("vping").get("vping_router_name") -SECGROUP_NAME = functest_yaml.get("vping"). \ - get("vping_sg_name") -SECGROUP_DESCR = functest_yaml.get("vping"). \ - get("vping_sg_descr") +SECGROUP_NAME = functest_yaml.get("vping").get("vping_sg_name") +SECGROUP_DESCR = functest_yaml.get("vping").get("vping_sg_descr") def pMsg(value): @@ -165,24 +162,22 @@ def create_private_neutron_net(neutron): else: neutron.format = 'json' logger.info('Creating neutron network %s..' % NEUTRON_PRIVATE_NET_NAME) - network_id = openstack_utils. \ - create_neutron_net(neutron, NEUTRON_PRIVATE_NET_NAME) + network_id = openstack_utils.create_neutron_net( + neutron, NEUTRON_PRIVATE_NET_NAME) if not network_id: return False logger.debug("Network '%s' created successfully" % network_id) logger.debug('Creating Subnet....') - subnet_id = openstack_utils. \ - create_neutron_subnet(neutron, - NEUTRON_PRIVATE_SUBNET_NAME, - NEUTRON_PRIVATE_SUBNET_CIDR, - network_id) + subnet_id = openstack_utils.create_neutron_subnet( + neutron, NEUTRON_PRIVATE_SUBNET_NAME, NEUTRON_PRIVATE_SUBNET_CIDR, + network_id) if not subnet_id: return False logger.debug("Subnet '%s' created successfully" % subnet_id) logger.debug('Creating Router...') - router_id = openstack_utils. \ - create_neutron_router(neutron, NEUTRON_ROUTER_NAME) + router_id = openstack_utils.create_neutron_router( + neutron, NEUTRON_ROUTER_NAME) if not router_id: return False @@ -279,9 +274,8 @@ def main(): neutron_client = neutronclient.Client(**creds_neutron) creds_keystone = openstack_utils.get_credentials("keystone") keystone_client = keystoneclient.Client(**creds_keystone) - glance_endpoint = keystone_client.\ - service_catalog.url_for(service_type='image', - endpoint_type='publicURL') + glance_endpoint = keystone_client.service_catalog.url_for( + service_type='image', endpoint_type='publicURL') glance_client = glanceclient.Client(1, glance_endpoint, token=keystone_client.auth_token) EXIT_CODE = -1 @@ -375,9 +369,9 @@ def main(): # the long chain corresponds to the ping procedure converted with base 64 # tune (e.g. flavor, images, network) to your specific openstack # configuration here - u = "#!/bin/sh\n\nwhile true; do\n ping -c 1 %s 2>&1 >/dev/null\n " \ - "RES=$?\n if [ \"Z$RES\" = \"Z0\" ] ; then\n echo 'vPing OK'\n " \ - "break\n else\n echo 'vPing KO'\n fi\n sleep 1\ndone\n" % test_ip + u = ("#!/bin/sh\n\nwhile true; do\n ping -c 1 %s 2>&1 >/dev/null\n " + "RES=$?\n if [ \"Z$RES\" = \"Z0\" ] ; then\n echo 'vPing OK'\n " + "break\n else\n echo 'vPing KO'\n fi\n sleep 1\ndone\n" % test_ip) # create VM logger.info("Creating instance '%s'..." % NAME_VM_2) @@ -421,8 +415,8 @@ def main(): logger.info("vPing duration:'%s'" % duration) EXIT_CODE = 0 break - elif "failed to read iid from metadata" in console_log or \ - metadata_tries > 5: + elif ("failed to read iid from metadata" in console_log or + metadata_tries > 5): EXIT_CODE = -2 break elif sec == PING_TIMEOUT: |