Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / suites / openflowplugin / Longevity / 010__longevity_test.robot
1 *** Settings ***
2 Documentation     Beta Version of the Longevity Test. Currently it does a single test:
3 ...               1. runs one iteration of the link scale test based on ${NUM_SWITCHES}
4 ...               Step 1 runs in a psuedo infinite loop and before each loop is
5 ...               run, a time check is made against the ${TEST_LENGTH}. If the test duration
6 ...               has expired, the loop is exited and the test is marked PASS
7 Suite Setup       Workflow Setup
8 Suite Teardown    Workflow Teardown
9 Library           DateTime
10 Resource          ../../../variables/Variables.robot
11 Resource          ../../../libraries/WorkflowsOpenFlow.robot
12 Resource          ../../../libraries/KarafKeywords.robot
13
14 *** Variables ***
15 ${NUM_SWITCHES}    36
16 ${SUSTAIN_TIME}    60s
17 ${TEST_LENGTH}    2h
18
19 *** Test Cases ***
20 Longevity Test
21     [Documentation]    Uses OpenFlow Full Mesh Topology workflow in a loop for given period of time ${TEST_LENGTH}
22     ${error_message}=    Set Variable    Fail initializing suite
23     ${switches}=    Convert to Integer    ${NUM_SWITCHES}
24     ${max_duration}=    DateTime.Convert Time    ${TEST_LENGTH}    number
25     ${start_time}=    DateTime.Get Current Date
26     #    This loop is not infinite, so going "sufficiently large" for now.
27     FOR    ${i}    IN RANGE    1    65536
28         ${status}    ${error_message}    ${topology_discover_time}    WorkflowsOpenFlow.Workflow Full Mesh Topology    ${switches}    ${SUSTAIN_TIME}
29         ${current_time}=    DateTime.Get Current Date
30         ${duration}=    DateTime.Subtract Date From Date    ${current_time}    ${start_time}    number
31         Exit For Loop If    '${status}' == 'FAIL'
32         Exit For Loop If    ${duration} > ${max_duration}
33     END
34     ${duration_compact}=    DateTime.Convert Time    ${duration}    compact
35     Log to console    ${\n}
36     Log To Console    Execution stopped because: ${error_message}
37     Log To Console    Test executed for ${duration_compact} seconds
38     Run Keyword If    '${status}' == 'FAIL'    Fail    ${error_message}