Fix car-people performance test 53/38553/2
authorLuis Gomez <ecelgp@gmail.com>
Mon, 9 May 2016 00:07:42 +0000 (17:07 -0700)
committerJamo Luhrsen <jluhrsen@redhat.com>
Mon, 9 May 2016 23:34:21 +0000 (23:34 +0000)
Modify python script to register people rpc.
Add WUKS for Purchase verify.
Remove Netconf check.

Change-Id: I7e3408999e4a97895d658a531cb06a640cc6ec0e
Signed-off-by: Luis Gomez <ecelgp@gmail.com>
csit/suites/controller/OneNode_Datastore/010_crud_mdsal_perf.robot
csit/suites/controller/ThreeNodes_Datastore/010_crud_mdsal_perf.robot
csit/testplans/controller-rest-cars-perf.txt
tools/odl-mdsal-clustering-tests/scripts/cluster_rest_script.py

index 06d841b1fa291acacd194412f73afb3d21077102..0bbf6075f14779343ba7dc64d4ec6dd507e51504 100644 (file)
@@ -29,7 +29,7 @@ ${ITEM_COUNT}     ${10000}
 ${ITEM_BATCH}     ${10000}
 ${PROCEDURE_TIMEOUT}    5m
 ${addcarcmd}      python cluster_rest_script.py --host ${ODL_SYSTEM_IP} --port ${RESTCONFPORT} add --itemtype car --itemcount ${ITEM_COUNT} --ipr ${ITEM_BATCH}
-${addpeoplecmd}    python cluster_rest_script.py --host ${ODL_SYSTEM_IP} --port ${RESTCONFPORT} add --itemtype people --itemcount ${ITEM_COUNT} --ipr ${ITEM_BATCH}
+${addpeoplecmd}    python cluster_rest_script.py --host ${ODL_SYSTEM_IP} --port ${RESTCONFPORT} add-rpc --itemtype people --itemcount ${ITEM_COUNT} --threads 5
 ${purchasecmd}    python cluster_rest_script.py --host ${ODL_SYSTEM_IP} --port ${RESTCONFPORT} add-rpc --itemtype car-people --itemcount ${ITEM_COUNT} --threads 5
 ${carurl}         /restconf/config/car:cars
 ${peopleurl}      /restconf/config/people:people
@@ -73,10 +73,7 @@ Verify Purchases
     [Documentation]    Store logs and verify result
     Stop Tool
     Store File To Workspace    cluster_rest_script.log    cluster_rest_script_purchase_cars.log
-    ${rsp}=    RequestsLibrary.Get Request    session    ${carpeopleurl}    headers=${ACCEPT_XML}
-    ${count}=    XML.Get Element Count    ${rsp.content}    xpath=car-person
-    Should Be Equal As Numbers    ${count}    ${ITEM_COUNT}
-    [Teardown]    Report_Failure_Due_To_Bug    4220
+    Wait Until Keyword Succeeds    ${PROCEDURE_TIMEOUT}    1    Purchase Is Completed    ${ITEM_COUNT}
 
 Delete Cars
     [Documentation]    Remove cars from the datastore
@@ -129,6 +126,13 @@ Wait_Until_Tool_Finish
     [Documentation]    Wait ${timeout} for the tool exit.
     BuiltIn.Wait Until Keyword Succeeds    ${timeout}    1s    SSHLibrary.Read Until Prompt
 
+Purchase Is Completed
+    [Arguments]    ${item_count}
+    [Documentation]    Check purchase of ${item_count} is completed.
+    ${rsp}=    RequestsLibrary.Get Request    session    ${carpeopleurl}    headers=${ACCEPT_XML}
+    ${count}=    XML.Get Element Count    ${rsp.content}    xpath=car-person
+    Should Be Equal As Numbers    ${count}    ${item_count}
+
 Stop_Tool
     [Documentation]    Stop the tool if still running.
     Utils.Write_Bare_Ctrl_C
index ad14914a70625e8b2bc9e08a7abaff0092576eb4..777706ba994d4f813818655b701e202cff7ee4b1 100644 (file)
@@ -31,7 +31,7 @@ ${ITEM_BATCH}     ${10000}
 ${PROCEDURE_TIMEOUT}    5m
 ${threads}        6    # threads are assigned to cluster nodes in round robin way
 ${addcarcmd}      python cluster_rest_script.py --port ${RESTCONFPORT} add --itemtype car --itemcount ${ITEM_COUNT} --ipr ${ITEM_BATCH}
-${addpeoplecmd}    python cluster_rest_script.py --port ${RESTCONFPORT} add --itemtype people --itemcount ${ITEM_COUNT} --ipr ${ITEM_BATCH}
+${addpeoplecmd}    python cluster_rest_script.py --port ${RESTCONFPORT} add-rpc --itemtype people --itemcount ${ITEM_COUNT} --threads 6
 ${purchasecmd}    python cluster_rest_script.py --port ${RESTCONFPORT} add-rpc --itemtype car-people --itemcount ${ITEM_COUNT} --threads 6
 ${carurl}         /restconf/config/car:cars
 ${peopleurl}      /restconf/config/people:people
@@ -60,7 +60,7 @@ Verify Cars
 Add People
     [Documentation]    Request to add ${ITEM_COUNT} people (timeout in ${PROCEDURE_TIMEOUT}).
     ${people_leader}=    ClusterKeywords.Get Leader And Verify    ${SHARD_PEOPLE_NAME}
-    Start Tool    ${addpeoplecmd}    --host ${people_leader} ${TOOL_OPTIONS}
+    Start Tool    ${addpeoplecmd}    --host ${ODL_SYSTEM_1_IP},${ODL_SYSTEM_2_IP},${ODL_SYSTEM_3_IP} ${TOOL_OPTIONS}
     Wait Until Tool Finish    ${PROCEDURE_TIMEOUT}
 
 Verify People
@@ -80,10 +80,7 @@ Verify Purchases
     [Documentation]    Store logs and verify result
     Stop Tool
     Store File To Workspace    cluster_rest_script.log    cluster_rest_script_purchase_cars.log
-    ${rsp}=    RequestsLibrary.Get Request    session    ${carpeopleurl}    headers=${ACCEPT_XML}
-    ${count}=    XML.Get Element Count    ${rsp.content}    xpath=car-person
-    Should Be Equal As Numbers    ${count}    ${ITEM_COUNT}
-    [Teardown]    Report_Failure_Due_To_Bug    4220
+    Wait Until Keyword Succeeds    ${PROCEDURE_TIMEOUT}    1    Purchase Is Completed    ${ITEM_COUNT}
 
 Delete Cars
     [Documentation]    Remove cars from the datastore
@@ -136,6 +133,13 @@ Wait_Until_Tool_Finish
     [Documentation]    Wait ${timeout} for the tool exit.
     BuiltIn.Wait Until Keyword Succeeds    ${timeout}    1s    SSHLibrary.Read Until Prompt
 
+Purchase Is Completed
+    [Arguments]    ${item_count}
+    [Documentation]    Check purchase of ${item_count} is completed.
+    ${rsp}=    RequestsLibrary.Get Request    session    ${carpeopleurl}    headers=${ACCEPT_XML}
+    ${count}=    XML.Get Element Count    ${rsp.content}    xpath=car-person
+    Should Be Equal As Numbers    ${count}    ${item_count}
+
 Stop_Tool
     [Documentation]    Stop the tool if still running.
     Utils.Write_Bare_Ctrl_C
index 22bea721a31b4612d7f043da955ea85cbcc704d6..3df2d643e5e9dca9df0f116e8310ddb9f75e9fed 100644 (file)
@@ -5,5 +5,4 @@
 # and is available at http://www.eclipse.org/legal/epl-v10.html
 
 # Place the suites in run order:
-integration/test/csit/suites/netconf/ready/netconfready.robot
 integration/test/csit/suites/controller/OneNode_Datastore/010_crud_mdsal_perf.robot
index 27c703362b70ed5f5daf46eb6ca43fec5820d5e7..818a729a45cb119dac070362c737e97b64769a6c 100644 (file)
@@ -23,14 +23,14 @@ _template_add_car = {
     ]
 }
 
-_template_add_people = {
-    "person": [
+_template_add_people_rpc = {
+    "input": [
         {
-            "id": "to be replaced",
-            "gender": "male",
-            "age": "99",
-            "address": "to be replaced",
-            "contactNo": "to be replaced"
+            "people:id": "to be replaced",
+            "people:gender": "male",
+            "people:age": "99",
+            "people:address": "to be replaced",
+            "people:contactNo": "to be replaced"
         }
     ]
 }
@@ -113,7 +113,7 @@ def _prepare_add_car(odl_ip, port, item_list, auth):
     return req
 
 
-def _prepare_add_people(odl_ip, port, item_list, auth):
+def _prepare_add_people_rpc(odl_ip, port, item_list, auth):
     """Creates a POST http requests to configure people in configuration datastore.
 
     Args:
@@ -129,14 +129,14 @@ def _prepare_add_people(odl_ip, port, item_list, auth):
         :returns req: http request object
     """
 
-    container = {"person": []}
-    for item in item_list:
-        entry = copy.deepcopy(_template_add_people["person"][0])
-        entry["id"] = str(item)
-        entry["address"] = "address" + str(item)
-        entry["contactNo"] = str(item)
-        container["person"].append(entry)
-    req = _build_post(odl_ip, port, "config/people:people", container, auth)
+    container = {"input": {}}
+    item = item_list[0]
+    entry = container["input"]
+    entry["people:id"] = str(item)
+    entry["people:address"] = "address" + str(item)
+    entry["people:contactNo"] = str(item)
+    container["input"] = entry
+    req = _build_post(odl_ip, port, "operations/people:add-person", container, auth)
     return req
 
 
@@ -542,7 +542,7 @@ def add_car(odl_ip, port, thread_count, item_count, auth, items_per_request):
         raise Exception("Not all cars were configured: " + repr(res))
 
 
-def add_people(odl_ip, port, thread_count, item_count, auth, items_per_request):
+def add_people_rpc(odl_ip, port, thread_count, item_count, auth, items_per_request):
     """Configure people entries to the config datastore.
 
     Args:
@@ -565,10 +565,15 @@ def add_people(odl_ip, port, thread_count, item_count, auth, items_per_request):
 
     logger.info("Add %s people to %s:%s (%s per request)",
                 item_count, odl_ip, port, items_per_request)
-    res = _task_executor(_prepare_add_people, odl_ip=odl_ip, port=port,
+    if items_per_request != 1:
+        logger.error("Only 1 item per request is supported, " +
+                     "you specified: {0}".format(item_count))
+        raise NotImplementedError("Only 1 item per request is supported, " +
+                                  "you specified: {0}".format(item_count))
+    res = _task_executor(_prepare_add_people_rpc, odl_ip=odl_ip, port=port,
                          thread_count=thread_count, item_count=item_count,
                          items_per_request=items_per_request, auth=auth)
-    if res.keys() != [204]:
+    if res.keys() != [200]:
         logger.error("Not all people were configured: " + repr(res))
         raise Exception("Not all people were configured: " + repr(res))
 
@@ -606,7 +611,7 @@ def add_car_people_rpc(odl_ip, port, thread_count, item_count, auth,
     res = _task_executor(_prepare_add_car_people_rpc, odl_ip=odl_ip, port=port,
                          thread_count=thread_count, item_count=item_count,
                          items_per_request=items_per_request, auth=auth)
-    if res.keys() != [204]:
+    if res.keys() != [200]:
         logger.error("Not all rpc calls passed: " + repr(res))
         raise Exception("Not all rpc calls passed: " + repr(res))
 
@@ -615,10 +620,10 @@ _actions = ["add", "get", "delete", "add-rpc"]
 _items = ["car", "people", "car-people"]
 
 _handler_matrix = {
-    "add": {"car": add_car, "people": add_people},
+    "add": {"car": add_car},
     "get": {"car": get_car, "people": get_people, "car-people": get_car_people},
     "delete": {"car": delete_car, "people": delete_people, "car-people": delete_car_people},
-    "add-rpc": {"car-people": add_car_people_rpc},
+    "add-rpc": {"car-people": add_car_people_rpc, "people": add_people_rpc},
 }