2 Documentation Test for measuring execution time of MD-SAL DataStore operations.
4 ... Copyright (c) 2015-2017 Cisco Systems, Inc. and others. All rights reserved.
6 ... This program and the accompanying materials are made available under the
7 ... terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ... and is available at http://www.eclipse.org/legal/epl-v10.html
10 ... This test suite requires odl-restconf and odl-clustering-test-app modules.
11 ... The script cluster_rest_script.py is used for generating requests for
12 ... operations on people, car and car-people DataStore test models.
13 ... (see the https://wiki.opendaylight.org/view/MD-SAL_Clustering_Test_Plan)
15 ... TODO: Decide whether keyword names should contain spaces or underscores.
16 Suite Setup Start Suite
17 Suite Teardown Stop Suite
18 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
19 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
20 Library RequestsLibrary
23 Resource ../../../libraries/RemoteBash.robot
24 Resource ../../../libraries/SetupUtils.robot
25 Resource ../../../libraries/SSHKeywords.robot
26 Resource ../../../libraries/TemplatedRequests.robot
27 Resource ../../../libraries/Utils.robot
28 Variables ../../../variables/Variables.py
31 ${ITEM_COUNT} ${10000}
32 ${ITEM_BATCH} ${10000}
33 ${PROCEDURE_TIMEOUT} 11m
34 ${addcarcmd} python cluster_rest_script.py --host ${ODL_SYSTEM_IP} --port ${RESTCONFPORT} add --itemtype car --itemcount ${ITEM_COUNT} --ipr ${ITEM_BATCH}
35 ${addpeoplecmd} python cluster_rest_script.py --host ${ODL_SYSTEM_IP} --port ${RESTCONFPORT} add-rpc --itemtype people --itemcount ${ITEM_COUNT} --threads 5
36 ${purchasecmd} python cluster_rest_script.py --host ${ODL_SYSTEM_IP} --port ${RESTCONFPORT} add-rpc --itemtype car-people --itemcount ${ITEM_COUNT} --threads 5
37 ${carurl} /restconf/config/car:cars
38 ${peopleurl} /restconf/config/people:people
39 ${carpeopleurl} /restconf/config/car-people:car-people
40 ${CONTROLLER_LOG_LEVEL} INFO
41 ${TOOL_OPTIONS} ${EMPTY}
45 [Documentation] Request to add ${ITEM_COUNT} cars (timeout in ${PROCEDURE_TIMEOUT}).
46 Start Tool ${addcarcmd} ${TOOL_OPTIONS}
47 ${output}= Wait Until Tool Finish ${PROCEDURE_TIMEOUT}
49 BuiltIn.Should Not Contain ${output} ERROR
52 [Documentation] Store logs and verify result
54 Store File To Workspace cluster_rest_script.log cluster_rest_script_add_cars.log
55 ${rsp}= RequestsLibrary.Get Request session ${carurl} headers=${ACCEPT_XML}
56 ${count}= XML.Get Element Count ${rsp.content} xpath=car-entry
57 Should Be Equal As Numbers ${count} ${ITEM_COUNT}
60 [Documentation] Request to add ${ITEM_COUNT} people (timeout in ${PROCEDURE_TIMEOUT}).
61 Start Tool ${addpeoplecmd} ${TOOL_OPTIONS}
62 Wait Until Tool Finish ${PROCEDURE_TIMEOUT}
65 [Documentation] Store logs and verify result
67 Store File To Workspace cluster_rest_script.log cluster_rest_script_add_people.log
68 ${rsp}= RequestsLibrary.Get Request session ${peopleurl} headers=${ACCEPT_XML}
69 ${count}= XML.Get Element Count ${rsp.content} xpath=person
70 Should Be Equal As Numbers ${count} ${ITEM_COUNT}
73 [Documentation] Request to purchase ${ITEM_COUNT} cars (timeout in ${PROCEDURE_TIMEOUT}).
74 Start Tool ${purchasecmd} ${TOOL_OPTIONS}
75 Wait Until Tool Finish ${PROCEDURE_TIMEOUT}
78 [Documentation] Store logs and verify result
80 Store File To Workspace cluster_rest_script.log cluster_rest_script_purchase_cars.log
81 Wait Until Keyword Succeeds ${PROCEDURE_TIMEOUT} 1 Purchase Is Completed ${ITEM_COUNT}
84 [Documentation] Remove cars from the datastore
85 ${rsp}= RequestsLibrary.Delete Request session ${carurl}
86 Should Be Equal As Numbers 200 ${rsp.status_code}
87 ${rsp}= RequestsLibrary.Get Request session ${carurl}
88 Should Be Equal As Numbers ${DELETED_STATUS_CODES} ${rsp.status_code}
91 [Documentation] Remove people from the datastore
92 ${rsp}= RequestsLibrary.Delete Request session ${peopleurl}
93 Should Be Equal As Numbers 200 ${rsp.status_code}
94 ${rsp}= RequestsLibrary.Get Request session ${peopleurl}
95 Should Be Equal As Numbers ${DELETED_STATUS_CODES} ${rsp.status_code}
98 [Documentation] Remove car-people entries from the datastore
99 ${rsp}= RequestsLibrary.Delete Request session ${carpeopleurl}
100 Should Be Equal As Numbers 200 ${rsp.status_code}
101 ${rsp}= RequestsLibrary.Get Request session ${carpeopleurl}
102 Should Be Equal As Numbers ${DELETED_STATUS_CODES} ${rsp.status_code}
106 [Documentation] Suite setup keyword.
107 SetupUtils.Setup_Utils_For_Setup_And_Teardown
108 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${CONTROLLER_LOG_LEVEL}
109 ${mininet_conn_id}= SSHLibrary.Open Connection ${TOOLS_SYSTEM_IP} prompt=${TOOLS_SYSTEM_PROMPT} timeout=6s
110 Builtin.Set Suite Variable ${mininet_conn_id}
111 SSHKeywords.Flexible Mininet Login ${TOOLS_SYSTEM_USER}
112 SSHLibrary.Put File ${CURDIR}/../../../../tools/odl-mdsal-clustering-tests/scripts/cluster_rest_script.py .
113 ${stdout} ${stderr} ${rc}= SSHLibrary.Execute Command ls return_stdout=True return_stderr=True
115 RequestsLibrary.Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
118 [Documentation] Suite teardown keyword
119 SSHLibrary.Close All Connections
120 RequestsLibrary.Delete All Sessions
123 [Arguments] ${command} ${tool_opt}
124 [Documentation] Start the tool ${command} ${tool_opt}
125 BuiltIn.Log ${command}
126 ${output}= SSHLibrary.Write ${command} ${tool_opt}
127 BuiltIn.Log ${output}
129 Wait_Until_Tool_Finish
130 [Arguments] ${timeout}
131 [Documentation] Wait ${timeout} for the tool exit, return the printed output.
132 BuiltIn.Run Keyword And Return BuiltIn.Wait Until Keyword Succeeds ${timeout} 1s SSHLibrary.Read Until Prompt
134 Purchase Is Completed
135 [Arguments] ${item_count}
136 [Documentation] Check purchase of ${item_count} is completed.
137 ${rsp}= RequestsLibrary.Get Request session ${carpeopleurl} headers=${ACCEPT_XML}
138 ${count}= XML.Get Element Count ${rsp.content} xpath=car-person
139 Should Be Equal As Numbers ${count} ${item_count}
142 [Documentation] Stop the tool if still running.
143 RemoteBash.Write_Bare_Ctrl_C
144 ${output}= SSHLibrary.Read delay=1s
145 BuiltIn.Log ${output}
147 Store_File_To_Workspace
148 [Arguments] ${source_file_name} ${target_file_name}
149 [Documentation] Store the ${source_file_name} to the workspace as ${target_file_name}.
150 ${output_log}= SSHLibrary.Execute_Command cat ${source_file_name}
151 BuiltIn.Log ${output_log}
152 Create File ${target_file_name} ${output_log}