Step 1: Move vm scripts to the right place
[integration/test.git] / test / csit / suites / openflowplugin / Performance / 010_Cbench.robot
1 *** Settings ***
2 Documentation     Cbench Latency and Throughput tests can be run from an external
3 ...                 cbench.
4 ...                 If cbench is run with a medium number of switches or higher (e.g. 32+)
5 ...                 the normal openflow operations seem to break.
6 ...                 BUG:  https://bugs.opendaylight.org/show_bug.cgi?id=2897
7 Suite Setup       Cbench Suite Setup
8 Test Teardown     Log Results As Zero If Cbench Timed Out
9 Force Tags        cbench
10 Library           String
11 Resource          ../../../libraries/Utils.robot
12 Resource          ../../../libraries/KarafKeywords.robot
13
14
15 *** Variables ***
16 ${throughput_threshold}     30000
17 ${latency_threshold}        10000
18 ${switch_count}             8
19 ${duration_in_secs}         12
20 ${loops}                    10
21 ${num_of_unique_macs}       10000
22 ${cbench_system}            ${MININET}
23 ${cbench_executable}        /usr/local/bin/cbench
24 ${throughput_results_file}  throughput.csv
25 ${latency_results_file}     latency.csv
26
27 *** Testcases ***
28 Cbench Latency Test
29     [Documentation]     cbench executed in default latency mode.  Test parameters have defaults, but can be overridden
30     ...     on the pybot command line
31     [Tags]  latency
32     [Timeout]   ${test_timeout}
33     Log    Cbench tests using ${loops} iterations of ${duration_in_secs} second tests. Switch Count: ${switch_count}. Unique MACS to cycle: ${num_of_unique_macs}
34     Run Cbench And Log Results  -m ${duration_in_ms} -M ${num_of_unique_macs} -s ${switch_count} -l ${loops}     ${latency_threshold}     ${latency_results_file}
35
36 Cbench Throughput Test
37     [Documentation]     cbench executed in throughput mode (-t).  Test parameters have defaults, but can be overridden
38     ...     on the pybot command line
39     [Tags]  throughput
40     [Timeout]   ${test_timeout}
41     Log    Cbench tests using ${loops} iterations of ${duration_in_secs} second tests. Switch Count: ${switch_count}. Unique MACS to cycle: ${num_of_unique_macs}
42     Run Cbench And Log Results  -t -m ${duration_in_ms} -M ${num_of_unique_macs} -s ${switch_count} -l ${loops}     ${throughput_threshold}     ${throughput_results_file}
43
44 *** Keywords ***
45 Run Cbench And Log Results
46     [Arguments]    ${cbench_args}    ${average_threshold}   ${output_filename}=results.csv
47     ##If the cbench command fails to return, the keyword to run it will time out.  The test tear
48     ##down can catch this problem and log the results as zero.  However, we need to know which
49     ##file to log to, so setting it as a suite variable here.
50     Set Suite Variable    ${output_filename}
51     ${output}=    Run Command On Remote System    ${cbench_system}   ${cbench_executable} -c ${CONTROLLER} ${cbench_args}  prompt_timeout=${test_timeout}
52     Log     ${output}
53     Should Contain    ${output}    RESULT
54     ${result_line}=    Get Lines Containing String    ${output}    RESULT
55     @{results_list}=    Split String    ${result_line}
56     Log    ${results_list[5]}
57     Log    ${results_list[7]}
58     @{result_name_list}=    Split String    ${results_list[5]}    /
59     @{result_value_list}=    Split String    ${results_list[7]}    /
60     ${num_stats}=    Get Length    ${result_name_list}
61     : FOR    ${i}    IN RANGE    0    ${num_stats}
62     \    Log    ${result_name_list[${i}]} :: ${result_value_list[${i}]}
63     ${min}=    Set Variable    ${result_value_list[${0}]}
64     ${max}=    Set Variable    ${result_value_list[${1}]}
65     ${average}=    Set Variable    ${result_value_list[${2}]}
66     ${stdev}=    Set Variable    ${result_value_list[${3}]}
67     ${date}=    Get Time    d,m,s
68     Log    CBench Result: ${date},${cbench_args},${min},${max},${average},${stdev}
69     Log Results And Determine Status    ${min}    ${max}    ${average}    ${average_threshold}    ${output_filename}
70
71 Cbench Suite Setup
72     Append To File    ${latency_results_file}    LATENCY_MIN,LATENCY_MAX,LATENCY_AVERAGE\n
73     Append To File    ${throughput_results_file}    THROUGHPUT_MIN,THROUGHPUT_MAX,THROUGHPUT_AVERAGE\n
74     ${duration_in_ms}           Evaluate    ${duration_in_secs} * 1000
75     Set Suite Variable  ${duration_in_ms}
76     ##Setting the test timeout dynamically in case larger values on command line override default
77     ${test_timeout}             Evaluate    (${loops} * ${duration_in_secs}) * 1.5
78     Set Suite Variable  ${test_timeout}
79     Verify File Exists On Remote System     ${cbench_system}    ${cbench_executable}
80     Should Be True  ${loops} >= 2   If number of loops is less than 2, cbench will not run
81     Verify Feature Is Installed     odl-openflowplugin-drop-test
82     Issue Command On Karaf Console  dropallpacketsrpc on
83
84 Log Results And Determine Status
85     [Arguments]    ${min}    ${max}    ${average}   ${threshold}    ${output_file}
86     Append To File    ${output_file}    ${min},${max},${average}\n
87     Should Be True    ${average} > ${threshold}     ${average} flow_mods per/sec did not exceed threshold of ${threshold}
88
89 Log Results As Zero If Cbench Timed Out
90     Run Keyword If Timeout Occurred    Log Results And Determine Status    0    0    0    0    ${output_filename}