From f670ac5d8572ed93811ad01a9d27142cba77de5d Mon Sep 17 00:00:00 2001 From: MatthewLi Date: Wed, 1 Jun 2016 05:52:51 -0400 Subject: file download separated from image creation progress JIRA: BOTTLENECK-86 Change-Id: I1603d8121d58ea36d6bd2aa241590fddd70c2e6f Signed-off-by: MatthewLi --- .../internal/run_rubbos_internal.sh | 2 +- testsuites/rubbos/run_rubbos.py | 20 ++++++++------ testsuites/vstf/run_vstf.py | 31 ++++++++++++++-------- testsuites/vstf/testsuite_story/vstf_story1 | 1 - 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/testsuites/rubbos/puppet_manifests/internal/run_rubbos_internal.sh b/testsuites/rubbos/puppet_manifests/internal/run_rubbos_internal.sh index 0fa914e2..4ae04fc6 100755 --- a/testsuites/rubbos/puppet_manifests/internal/run_rubbos_internal.sh +++ b/testsuites/rubbos/puppet_manifests/internal/run_rubbos_internal.sh @@ -165,8 +165,8 @@ fetch_remote_resources() { rm -rf $LOCAL_GIT_REPO fi mkdir -p $LOCAL_GIT_REPO - #sudo dpkg --configure -a sudo apt-get update + sudo dpkg --configure -a sudo apt-get install -y git cd $LOCAL_GIT_REPO git clone ${REMOTE_GIT_REPO} diff --git a/testsuites/rubbos/run_rubbos.py b/testsuites/rubbos/run_rubbos.py index 42f8d509..18aeab6f 100755 --- a/testsuites/rubbos/run_rubbos.py +++ b/testsuites/rubbos/run_rubbos.py @@ -129,16 +129,14 @@ def rubbos_env_cleanup(): else: return True -def rubbos_create_images(src_url=None, image_name="bottlenecks_rubbos_image"): +def rubbos_create_images(imagefile=None, image_name="bottlenecks_rubbos_image"): print "========== Create rubbos image in OS ==========" - dest_dir = '/tmp' - file_name = _download_url(src_url, dest_dir) - #file_name = "bottlenecks-trusty-server.img" - if file_name == None: + + if imagefile == None: + print "imagefile not set/found" return False glance = _get_glance_client() - imagefile = dest_dir + "/" + file_name image = glance.images.create(name=image_name, disk_format="qcow2", container_format="bare") with open(imagefile) as fimage: glance.images.upload(image.id, fimage) @@ -360,7 +358,13 @@ def main(): rubbos_env_prepare(Heat_template) rubbos_env_cleanup() - image_created = rubbos_create_images(image_url) + dest_dir = "/tmp" + image_file = _download_url(image_url, dest_dir) + if image_file == None: + print "error with downloading image(s)" + exit(-1) + + image_created = rubbos_create_images(imagefile=image_file) keyPath = Bottlenecks_repo_dir + "/utils/infra_setup/bottlenecks_key/bottlenecks_key.pub" rubbos_create_keypairs(key_path=keyPath) rubbos_create_flavors() @@ -371,7 +375,7 @@ def main(): print "Cannot create instances, as Failed to create image(s)." exit (-1) - print "Wait 300 seconds after stack creation........." + print "Wait 300 seconds after stack creation..." time.sleep(300) #reboot_instances() diff --git a/testsuites/vstf/run_vstf.py b/testsuites/vstf/run_vstf.py index 20cfa21a..4ea56661 100755 --- a/testsuites/vstf/run_vstf.py +++ b/testsuites/vstf/run_vstf.py @@ -127,15 +127,14 @@ def vstf_env_cleanup(): else: return True -def vstf_create_images(src_url=None, image_name="bottlenecks_vstf_image"): +def vstf_create_images(imagefile=None, image_name="bottlenecks_vstf_image"): print "========== Create vstf image in OS ==========" - dest_dir = '/tmp' - file_name = _download_url(src_url, dest_dir) - if file_name == None: + + if imagefile == None: + print "imagefile not set/found" return False glance = _get_glance_client() - imagefile = dest_dir + "/" + file_name image = glance.images.create(name=image_name, disk_format="qcow2", container_format="bare") with open(imagefile) as fimage: glance.images.upload(image.id, fimage) @@ -209,6 +208,19 @@ def main(): manager_image_url = 'http://artifacts.opnfv.org/bottlenecks/vstf-manager-new.img' agent_image_url = 'http://artifacts.opnfv.org/bottlenecks/vstf-agent-new.img' + #vstf_env_prepare(testcase_cfg) + vstf_env_cleanup() + + dest_dir = "/tmp" + manager_file = _download_url(manager_image_url, dest_dir) + if manager_file == None: + print "error with downloading image(s)" + exit(-1) + agent_file = _download_url(agent_image_url, dest_dir) + if agent_file == None: + print "error with downloading image(s)" + exit(-1) + #TO DO:the parameters are all used defaults here, it should be changed depends on what it is really named parameters={'key_name': 'bottlenecks_vstf_keypair', 'flavor': 'bottlenecks_vstf_flavor', @@ -228,12 +240,9 @@ def main(): target_image_created = False stack_created = False - #vstf_env_prepare(testcase_cfg) - vstf_env_cleanup() - - manager_image_created = vstf_create_images(src_url=manager_image_url, image_name="vstf-manager") - tester_image_created = vstf_create_images(src_url=agent_image_url, image_name="vstf-tester") - target_image_created = vstf_create_images(src_url=agent_image_url, image_name="vstf-target") + manager_image_created = vstf_create_images(imagefile=manager_file, image_name="vstf-manager") + tester_image_created = vstf_create_images(imagefile=agent_file, image_name="vstf-tester") + target_image_created = vstf_create_images(imagefile=agent_file, image_name="vstf-target") keyPath = Bottlenecks_repo_dir + "/utils/infra_setup/bottlenecks_key/bottlenecks_key.pub" vstf_create_keypairs(key_path=keyPath) vstf_create_flavors() diff --git a/testsuites/vstf/testsuite_story/vstf_story1 b/testsuites/vstf/testsuite_story/vstf_story1 index 5a6ba9cc..8e855e62 100755 --- a/testsuites/vstf/testsuite_story/vstf_story1 +++ b/testsuites/vstf/testsuite_story/vstf_story1 @@ -1,2 +1 @@ vstf_Tu1 -vstf_Tu3 -- cgit 1.2.3-korg