bugfix for vstf stack name
[bottlenecks.git] / testsuites / vstf / run_vstf.py
index 4ea5666..319f005 100755 (executable)
@@ -11,6 +11,7 @@
 import os
 import argparse
 import time
+import subprocess
 import logging
 import urllib2
 import shutil
@@ -72,7 +73,7 @@ def _download_url(src_url, dest_dir):
 
     with open(dest, 'wb') as f:
         shutil.copyfileobj(response, f)
-    return file_name
+    return dest
 
 def vstf_stack_satisfy(name="bottlenecks_vstf_stack", status="CREATE_COMPLETE"):
     heat = _get_heat_client()
@@ -191,15 +192,30 @@ def get_instances(nova_client):
         print "Error [get_instances(nova_client)]:", e
         return None
 
-def vstf_run():
+def vstf_run(launch_file=None, test_file=None):
     print "================run vstf==============="
 
+    heat = _get_heat_client()
     nova = _get_nova_client()
     print(nova.servers.list())
+    print "## neutruon net-list:"
+    subprocess.call("neutron net-list", shell=True)
+    print "## nova list:"
+    subprocess.call("nova list", shell=True)
+    time.sleep(100)
     instances = get_instances(nova)
     if instances == None:
         print "Found *None* instances, exit vstf_run()!"
         return False
+    if launch_file == None or test_file == None:
+         print "Error, vstf launch/test file not given"
+         return False
+    cmd = "bash " + launch_file
+    subprocess.call(cmd, shell=True)
+    time.sleep(50)
+    cmd = "bash " + test_file
+    subprocess.call(cmd, shell=True)
+    time.sleep(20)
 
 def main():
 
@@ -253,10 +269,12 @@ def main():
         print "Cannot create instances, as Failed to create image(s)."
         exit (-1)
 
-    print "Wait 100 seconds after stack creation..."
-    time.sleep(100)
+    print "Wait 300 seconds after stack creation..."
+    time.sleep(300)
 
-    vstf_run()
+    launchfile = Bottlenecks_repo_dir + "/utils/infra_setup/heat_template/vstf_heat_template/launch_vstf.sh"
+    testfile = Bottlenecks_repo_dir + "/utils/infra_setup/heat_template/vstf_heat_template/vstf_test.sh"
+    vstf_run(launch_file=launchfile, test_file=testfile)
 
     vstf_env_cleanup()