ea23c6b78eb04b9821003831d91da5abb2222da0
[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
8 Library             DateTime
9 Resource            ../../../variables/Variables.robot
10 Resource            ../../../libraries/WorkflowsOpenFlow.robot
11 Resource            ../../../libraries/KarafKeywords.robot
12
13 Suite Setup         Workflow Setup
14 Suite Teardown      Workflow Teardown
15
16
17 *** Variables ***
18 ${NUM_SWITCHES}     36
19 ${SUSTAIN_TIME}     60s
20 ${TEST_LENGTH}      2h
21
22
23 *** Test Cases ***
24 Longevity Test
25     [Documentation]    Uses OpenFlow Full Mesh Topology workflow in a loop for given period of time ${TEST_LENGTH}
26     ${error_message}=    Set Variable    Fail initializing suite
27     ${switches}=    Convert to Integer    ${NUM_SWITCHES}
28     ${max_duration}=    DateTime.Convert Time    ${TEST_LENGTH}    number
29     ${start_time}=    DateTime.Get Current Date
30     #    This loop is not infinite, so going "sufficiently large" for now.
31     FOR    ${i}    IN RANGE    1    65536
32         ${status}    ${error_message}    ${topology_discover_time}=    WorkflowsOpenFlow.Workflow Full Mesh Topology
33         ...    ${switches}
34         ...    ${SUSTAIN_TIME}
35         ${current_time}=    DateTime.Get Current Date
36         ${duration}=    DateTime.Subtract Date From Date    ${current_time}    ${start_time}    number
37         IF    '${status}' == 'FAIL'            BREAK
38         IF    ${duration} > ${max_duration}            BREAK
39     END
40     ${duration_compact}=    DateTime.Convert Time    ${duration}    compact
41     Log to console    ${\n}
42     Log To Console    Execution stopped because: ${error_message}
43     Log To Console    Test executed for ${duration_compact} seconds
44     IF    '${status}' == 'FAIL'    Fail    ${error_message}