Replace deprecated variables in suites/openflowplugin (1).
[integration/test.git] / 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 *** 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 Latency Test
28     [Documentation]    cbench executed in default latency mode. Test parameters have defaults, but can be overridden
29     ...    on the pybot command line
30     [Tags]    latency
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    -m ${duration_in_ms} -M ${num_of_unique_macs} -s ${switch_count} -l ${loops}    ${latency_threshold}    ${latency_results_file}
34
35 Cbench Throughput Test
36     [Documentation]    cbench executed in throughput mode (-t). Test parameters have defaults, but can be overridden
37     ...    on the pybot command line
38     [Tags]    throughput
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    -t -m ${duration_in_ms} -M ${num_of_unique_macs} -s ${switch_count} -l ${loops}    ${throughput_threshold}    ${throughput_results_file}
42
43 *** Keywords ***
44 Run Cbench And Log Results
45     [Arguments]    ${cbench_args}    ${average_threshold}    ${output_filename}=results.csv
46     ##If the cbench command fails to return, the keyword to run it will time out.    The test tear
47     ##down can catch this problem and log the results as zero.    However, we need to know which
48     ##file to log to, so setting it as a suite variable here.
49     Set Suite Variable    ${output_filename}
50     ${output}=    Run Command On Remote System    ${cbench_system}    ${cbench_executable} -c ${ODL_SYSTEM_IP} ${cbench_args}    prompt_timeout=${test_timeout}
51     Log    ${output}
52     Should Contain    ${output}    RESULT
53     ${result_line}=    Get Lines Containing String    ${output}    RESULT
54     @{results_list}=    Split String    ${result_line}
55     Log    ${results_list[5]}
56     Log    ${results_list[7]}
57     @{result_name_list}=    Split String    ${results_list[5]}    /
58     @{result_value_list}=    Split String    ${results_list[7]}    /
59     ${num_stats}=    Get Length    ${result_name_list}
60     : FOR    ${i}    IN RANGE    0    ${num_stats}
61     \    Log    ${result_name_list[${i}]} :: ${result_value_list[${i}]}
62     ${min}=    Set Variable    ${result_value_list[${0}]}
63     ${max}=    Set Variable    ${result_value_list[${1}]}
64     ${average}=    Set Variable    ${result_value_list[${2}]}
65     ${stdev}=    Set Variable    ${result_value_list[${3}]}
66     ${date}=    Get Time    d,m,s
67     Log    CBench Result: ${date},${cbench_args},${min},${max},${average},${stdev}
68     Log Results And Determine Status    ${min}    ${max}    ${average}    ${average_threshold}    ${output_filename}
69
70 Cbench Suite Setup
71     Append To File    ${latency_results_file}    LATENCY_MIN,LATENCY_MAX,LATENCY_AVERAGE\n
72     Append To File    ${throughput_results_file}    THROUGHPUT_MIN,THROUGHPUT_MAX,THROUGHPUT_AVERAGE\n
73     ${duration_in_ms}    Evaluate    ${duration_in_secs} * 1000
74     Set Suite Variable    ${duration_in_ms}
75     ##Setting the test timeout dynamically in case larger values on command line override default
76     ${test_timeout}    Evaluate    (${loops} * ${duration_in_secs}) * 1.5
77     Set Suite Variable    ${test_timeout}
78     Verify File Exists On Remote System    ${cbench_system}    ${cbench_executable}
79     Should Be True    ${loops} >= 2    If number of loops is less than 2, cbench will not run
80     Verify Feature Is Installed    odl-openflowplugin-drop-test
81     Issue Command On Karaf Console    dropallpacketsrpc on
82
83 Log Results And Determine Status
84     [Arguments]    ${min}    ${max}    ${average}    ${threshold}    ${output_file}
85     Append To File    ${output_file}    ${min},${max},${average}\n
86     Should Be True    ${average} > ${threshold}    ${average} flow_mods per/sec did not exceed threshold of ${threshold}
87
88 Log Results As Zero If Cbench Timed Out
89     Run Keyword If Timeout Occurred    Log Results And Determine Status    0    0    0    0    ${output_filename}