2 Documentation Test for measuring execution time of MD-SAL DataStore operations in cluster.
4 ... Copyright (c) 2015 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)
16 ... https://bugs.opendaylight.org/show_bug.cgi?id=4220
17 Suite Setup Start Suite
18 Suite Teardown Stop Suite
19 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
20 Library RequestsLibrary
23 Variables ../../../variables/Variables.py
24 Resource ../../../libraries/Utils.robot
25 Resource ../../../libraries/SetupUtils.robot
26 Resource ../../../libraries/ClusterKeywords.robot
29 ${ITEM_COUNT} ${10000}
30 ${ITEM_BATCH} ${10000}
31 ${PROCEDURE_TIMEOUT} 5m
32 ${threads} 6 # threads are assigned to cluster nodes in round robin way
33 ${addcarcmd} python cluster_rest_script.py --port ${RESTCONFPORT} add --itemtype car --itemcount ${ITEM_COUNT} --ipr ${ITEM_BATCH}
34 ${addpeoplecmd} python cluster_rest_script.py --port ${RESTCONFPORT} add-rpc --itemtype people --itemcount ${ITEM_COUNT} --threads 6
35 ${purchasecmd} python cluster_rest_script.py --port ${RESTCONFPORT} add-rpc --itemtype car-people --itemcount ${ITEM_COUNT} --threads 6
36 ${carurl} /restconf/config/car:cars
37 ${peopleurl} /restconf/config/people:people
38 ${carpeopleurl} /restconf/config/car-people:car-people
39 ${CONTROLLER_LOG_LEVEL} INFO
40 ${TOOL_OPTIONS} ${EMPTY}
41 ${SHARD_CAR_NAME} shard-car-config
42 ${SHARD_PEOPLE_NAME} shard-people-config
43 ${SHARD_CAR_PERSON_NAME} shard-car-people-config
47 [Documentation] Request to add ${ITEM_COUNT} cars (timeout in ${PROCEDURE_TIMEOUT}).
48 ${car_leader}= ClusterKeywords.Get Leader And Verify ${SHARD_CAR_NAME}
49 Start Tool ${addcarcmd} --host ${car_leader} ${TOOL_OPTIONS}
50 Wait Until Tool Finish ${PROCEDURE_TIMEOUT}
53 [Documentation] Store logs and verify result
55 Store File To Workspace cluster_rest_script.log cluster_rest_script_add_cars.log
56 ${rsp}= RequestsLibrary.Get Request session ${carurl} headers=${ACCEPT_XML}
57 ${count}= XML.Get Element Count ${rsp.content} xpath=car-entry
58 Should Be Equal As Numbers ${count} ${ITEM_COUNT}
61 [Documentation] Request to add ${ITEM_COUNT} people (timeout in ${PROCEDURE_TIMEOUT}).
62 ${people_leader}= ClusterKeywords.Get Leader And Verify ${SHARD_PEOPLE_NAME}
63 Start Tool ${addpeoplecmd} --host ${ODL_SYSTEM_1_IP},${ODL_SYSTEM_2_IP},${ODL_SYSTEM_3_IP} ${TOOL_OPTIONS}
64 Wait Until Tool Finish ${PROCEDURE_TIMEOUT}
67 [Documentation] Store logs and verify result
69 Store File To Workspace cluster_rest_script.log cluster_rest_script_add_people.log
70 ${rsp}= RequestsLibrary.Get Request session ${peopleurl} headers=${ACCEPT_XML}
71 ${count}= XML.Get Element Count ${rsp.content} xpath=person
72 Should Be Equal As Numbers ${count} ${ITEM_COUNT}
75 [Documentation] Request to purchase ${ITEM_COUNT} cars (timeout in ${PROCEDURE_TIMEOUT}).
76 Start Tool ${purchasecmd} --host ${ODL_SYSTEM_1_IP},${ODL_SYSTEM_2_IP},${ODL_SYSTEM_3_IP} ${TOOL_OPTIONS}
77 Wait Until Tool Finish ${PROCEDURE_TIMEOUT}
80 [Documentation] Store logs and verify result
82 Store File To Workspace cluster_rest_script.log cluster_rest_script_purchase_cars.log
83 Wait Until Keyword Succeeds ${PROCEDURE_TIMEOUT} 1 Purchase Is Completed ${ITEM_COUNT}
86 [Documentation] Remove cars from the datastore
87 ${rsp}= RequestsLibrary.Delete session ${carurl}
88 Should Be Equal As Numbers 200 ${rsp.status_code}
89 ${rsp}= RequestsLibrary.Get Request session ${carurl}
90 Should Be Equal As Numbers 404 ${rsp.status_code}
93 [Documentation] Remove people from the datastore
94 ${rsp}= RequestsLibrary.Delete session ${peopleurl}
95 Should Be Equal As Numbers 200 ${rsp.status_code}
96 ${rsp}= RequestsLibrary.Get Request session ${peopleurl}
97 Should Be Equal As Numbers 404 ${rsp.status_code}
100 [Documentation] Remove car-people entries from the datastore
101 ${rsp}= RequestsLibrary.Delete session ${carpeopleurl}
102 Should Be Equal As Numbers 200 ${rsp.status_code}
103 ${rsp}= RequestsLibrary.Get Request session ${carpeopleurl}
104 Should Be Equal As Numbers 404 ${rsp.status_code}
108 [Documentation] Suite setup keyword
109 SetupUtils.Setup_Utils_For_Setup_And_Teardown
110 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${CONTROLLER_LOG_LEVEL}
111 ${mininet_conn_id}= SSHLibrary.Open Connection ${TOOLS_SYSTEM_IP} prompt=${DEFAULT_LINUX_PROMPT} timeout=6s
112 Builtin.Set Suite Variable ${mininet_conn_id}
113 Utils.Flexible Mininet Login ${TOOLS_SYSTEM_USER}
114 SSHLibrary.Put File ${CURDIR}/../../../../tools/odl-mdsal-clustering-tests/scripts/cluster_rest_script.py .
115 ${stdout} ${stderr} ${rc}= SSHLibrary.Execute Command ls return_stdout=True return_stderr=True
117 RequestsLibrary.Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
120 [Documentation] Suite teardown keyword
121 SSHLibrary.Close All Connections
122 RequestsLibrary.Delete All Sessions
125 [Arguments] ${command} ${tool_opt}
126 [Documentation] Start the tool ${command} ${tool_opt}
127 BuiltIn.Log ${command}
128 ${output}= SSHLibrary.Write ${command} ${tool_opt}
129 BuiltIn.Log ${output}
131 Wait_Until_Tool_Finish
132 [Arguments] ${timeout}
133 [Documentation] Wait ${timeout} for the tool exit.
134 BuiltIn.Wait Until Keyword Succeeds ${timeout} 1s SSHLibrary.Read Until Prompt
136 Purchase Is Completed
137 [Arguments] ${item_count}
138 [Documentation] Check purchase of ${item_count} is completed.
139 ${rsp}= RequestsLibrary.Get Request session ${carpeopleurl} headers=${ACCEPT_XML}
140 ${count}= XML.Get Element Count ${rsp.content} xpath=car-person
141 Should Be Equal As Numbers ${count} ${item_count}
144 [Documentation] Stop the tool if still running.
145 Utils.Write_Bare_Ctrl_C
146 ${output}= SSHLibrary.Read delay=1s
147 BuiltIn.Log ${output}
149 Store_File_To_Workspace
150 [Arguments] ${source_file_name} ${target_file_name}
151 [Documentation] Store the ${source_file_name} to the workspace as ${target_file_name}.
152 ${output_log}= SSHLibrary.Execute_Command cat ${source_file_name}
153 BuiltIn.Log ${output_log}
154 Create File ${target_file_name} ${output_log}