3146390261602ddf90975cf821adca2c226b5ef2
[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 Force Tags        cbench
9 Library           String
10 Resource          ../../../libraries/Utils.txt
11 Resource          ../../../libraries/KarafKeywords.txt
12
13
14 *** Variables ***
15 ${throughput_threshold}     30000
16 ${latency_threshold}        10000
17 ${switch_count}             8
18 ${duration_in_secs}         12
19 ${loops}                    10
20 ${num_of_unique_macs}       10000
21 ${cbench_system}            ${MININET}
22 ${cbench_executable}        /usr/local/bin/cbench
23 ${throughput_results_file}  throughput.csv
24 ${latency_results_file}     latency.csv
25
26 *** Testcases ***
27 Cbench Throughput Test
28     [Documentation]     cbench executed in throughput mode (-t).  Test parameters have defaults, but can be overridden
29     ...     on the pybot command line
30     [Tags]  throughput
31     [Timeout]   ${test_timeout}
32     Log    Cbench tests using ${loops} iterations of ${duration_in_secs} second tests. Switch Count: ${switch_count}. Unique MACS to cycle: ${num_of_unique_macs}
33     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}
34
35 Cbench Latency Test
36     [Documentation]     cbench executed in default latency mode.  Test parameters have defaults, but can be overridden
37     ...     on the pybot command line
38     [Tags]  latency
39     [Timeout]   ${test_timeout}
40     Log    Cbench tests using ${loops} iterations of ${duration_in_secs} second tests. Switch Count: ${switch_count}. Unique MACS to cycle: ${num_of_unique_macs}
41     Run Cbench And Log Results  -m ${duration_in_ms} -M ${num_of_unique_macs} -s ${switch_count} -l ${loops}     ${latency_threshold}     ${latency_results_file}
42
43 *** Keywords ***
44 Run Cbench And Log Results
45     [Arguments]    ${cbench_args}    ${average_threshold}   ${output_filename}=results.csv
46     ${output}=  Run Command On Remote System    ${cbench_system}   ${cbench_executable} -c ${CONTROLLER} ${cbench_args}  prompt_timeout=${test_timeout}
47     Log     ${output}
48     Should Contain    ${output}    RESULT
49     ${result_line}=    Get Lines Containing String    ${output}    RESULT
50     @{results_list}=    Split String    ${result_line}
51     Log    ${results_list[5]}
52     Log    ${results_list[7]}
53     @{result_name_list}=    Split String    ${results_list[5]}    /
54     @{result_value_list}=    Split String    ${results_list[7]}    /
55     ${num_stats}=    Get Length    ${result_name_list}
56     : FOR    ${i}    IN RANGE    0    ${num_stats}
57     \    Log    ${result_name_list[${i}]} :: ${result_value_list[${i}]}
58     ${min}=    Set Variable    ${result_value_list[${0}]}
59     ${max}=    Set Variable    ${result_value_list[${1}]}
60     ${average}=    Set Variable    ${result_value_list[${2}]}
61     ${stdev}=    Set Variable    ${result_value_list[${3}]}
62     ${date}=    Get Time    d,m,s
63     Log    CBench Result: ${date},${cbench_args},${min},${max},${average},${stdev}
64     Append To File    ${output_filename}    ${min},${max},${average}\n
65     Should Be True    ${average} > ${average_threshold}     ${average} flow_mods per/sec did not exceed threshold of ${average_threshold}
66
67 Cbench Suite Setup
68     Append To File    ${latency_results_file}    LATENCY_MIN,LATENCY_MAX,LATENCY_AVERAGE\n
69     Append To File    ${throughput_results_file}    THROUGHPUT_MIN,THROUGHPUT_MAX,THROUGHPUT_AVERAGE\n
70     ${duration_in_ms}           Evaluate    ${duration_in_secs} * 1000
71     Set Suite Variable  ${duration_in_ms}
72     ##Setting the test timeout dynamically in case larger values on command line override default
73     ${test_timeout}             Evaluate    (${loops} * ${duration_in_secs}) * 1.5
74     Set Suite Variable  ${test_timeout}
75     Verify File Exists On Remote System     ${cbench_system}    ${cbench_executable}
76     Should Be True  ${loops} >= 2   If number of loops is less than 2, cbench will not run
77     Verify Feature Is Installed     odl-openflowplugin-drop-test
78     Issue Command On Karaf Console  dropallpacketsrpc on