add more debug info
[bottlenecks.git] / testsuites / posca / testcase_script / common_script.py
index b9954a7..2ca9f68 100644 (file)
@@ -35,7 +35,7 @@ def posca_tran_data(ES_ip, file_name):
 def posca_config_read(config_str, con_str, config):
     print("========== posca system bandwidth config read ===========")
     con_dic = {}
-    print(config_str)
+    print("Configuration file is %s" %(config_str))
     idx = 0
     with open(config_str, "rd") as cfgfile:
         config.readfp(cfgfile)
@@ -77,17 +77,19 @@ def posca_output_result(file_config, data_reply):
 
 def posca_get_reply(con_dic, task_id, time_test=1):
     reply_url = "http://%s/yardstick/results?action=getResult&task_id=%s\
-&measurement=tc100" % (con_dic["test_ip"], task_id)
+&measurement=netperf_bottlenecks" % (con_dic["test_ip"], task_id)
     time.sleep(float(con_dic["test_time"]))
     reply_response = requests.get(reply_url)
     reply_data = json.loads(reply_response.text)
-    print(reply_data)
+    print("return data is %s" %(reply_data))
     if reply_data["status"] == 1:
         return(reply_data["result"][0])
     if reply_data["status"] == 0:
         if time_test == 10:
             print("yardstick time out")
             sys.exit()
+        reply_result_data = posca_get_reply(con_dic, task_id, time_test=time_test+1)
+        return(reply_result_data)
         posca_get_reply(con_dic, task_id, time_test=time_test+1)
     if reply_data["status"] == 2:
         print("yardstick error exit")
@@ -95,8 +97,8 @@ def posca_get_reply(con_dic, task_id, time_test=1):
 
 
 def posca_send_data(con_dic, test_config, file_config):
-    base_url = "http://%s/yardstick/testcases/release/action" % (con_dic['test_ip'])
-    print(con_dic["test_ip"])
+    base_url = "http://%s/yardstick/testcases/samples/action" % (con_dic['test_ip'])
+    print("test ip addr is %s" %(base_url))
     test_dict = {
             "action":"runTestCase",
             "args":{
@@ -109,14 +111,14 @@ def posca_send_data(con_dic, test_config, file_config):
                         'target': 'node4.LF'
                         }
                  },
-                 "testcase":"tc100"
+                 "testcase":"netperf_bottlenecks"
             }
     }
     reponse = requests.post(
                         base_url, data=json.dumps(test_dict), headers=headers)
     ask_data = json.loads(reponse.text)
     task_id = ask_data["result"]
-    print(task_id)
+    print("yardstick task id is: %s" %(task_id))
     data_reply = posca_get_reply(con_dic, task_id)
     data_reply.update(test_config)
     posca_output_result(file_config, data_reply)
@@ -130,4 +132,7 @@ def posca_create_incluxdb(con_dic):
     }
     reponse = requests.post(
                         base_url, data=json.dumps(test_dict), headers=headers)
+    print("waiting for creating InfluxDB")
+    time.sleep(30)
+    print("Done, creating InflxDB Container")