car people performace suite for 3 node controller
[integration/test.git] / tools / odl-mdsal-clustering-tests / scripts / cluster_rest_script.py
index ce6342d37b23ccdf8b58059240f0dd72003a4c42..7a6d060a964ba8648b3a0bd9111eba173d1253d7 100644 (file)
@@ -241,7 +241,7 @@ def _task_executor(preparing_function, odl_ip="127.0.0.1", port="8181",
     Args:
         :param preparing_function: function to prepare http request object
 
-        :param odl_ip: ip address of ODL; default="127.0.0.1"
+        :param odl_ip: ip address of ODL or comma separated addesses; default="127.0.0.1"
 
         :param port: restconf port; default="8181"
 
@@ -258,6 +258,10 @@ def _task_executor(preparing_function, odl_ip="127.0.0.1", port="8181",
                        {"http_status_code1: "count1", etc.}
     """
 
+    # geting hosts
+    hosts = odl_ip.split(',')
+    nrhosts = len(hosts)
+
     items = [i+1 for i in range(item_count)]
     item_groups = []
     for i in range(0, item_count, items_per_request):
@@ -279,7 +283,7 @@ def _task_executor(preparing_function, odl_ip="127.0.0.1", port="8181",
         thr = threading.Thread(target=_request_sender,
                                args=(i, preparing_function, auth),
                                kwargs={"in_queue": send_queue, "exit_event": exit_event,
-                                       "odl_ip": odl_ip, "port": port,
+                                       "odl_ip": hosts[i % nrhosts], "port": port,
                                        "out_queue": result_queue})
         threads.append(thr)
         thr.start()
@@ -628,7 +632,8 @@ if __name__ == "__main__":
     parser = argparse.ArgumentParser(description="Cluster datastore"
                                                  "performance test script")
     parser.add_argument("--host", default="127.0.0.1",
-                        help="Host where odl controller is running"
+                        help="Host where odl controller is running."
+                             "Or comma separated list of hosts."
                              "(default is 127.0.0.1)")
     parser.add_argument("--port", default="8181",
                         help="Port on which odl's RESTCONF is listening"