Test suite to configure hosts on 2 switches for vpnservice
[integration/test.git] / test / csit / suites / openflowplugin / Longevity / 010__longevity.txt
1 *** Settings ***
2 Documentation     Beta Version of the Longevity Test.  Currently:
3 ...               1.  runs one iteration of the switch scale test based on ${NUM_SWITCHES}
4 ...               2.  runs one iteration of the host scale test based on ${NUM_HOSTS}
5 ...               Steps 1 and 2 are run in a psuedo infinite loop and before each loop is
6 ...               run, a time check is made against the ${TEST_LENGTH}. If the test duration
7 ...               has expired, the loop is exited and the test is marked PASS
8 ...
9 ...               If either of steps 1 or 2 fail to reach their configured value of ${NUM_SWITCHES}
10 ...               or ${NUM_HOSTS} the test will exit immediately and not continue.
11 Suite Setup       Longevity Suite Setup
12 Suite Teardown    Longevity Suite Teardown
13 Library           RequestsLibrary
14 Library           DateTime
15 Variables         ../../../variables/Variables.py
16 Resource          ../../../libraries/Scalability.txt
17
18 *** Variables ***
19 ${NUM_SWITCHES}           50
20 ${NUM_HOSTS}              200
21 ${TEST_LENGTH}            2 hours
22
23 *** Test Cases ***
24 Longevity Test
25     [Documentation]    Uses switch and host scale test functionality in a loop for given period of time
26     #  This loop is not infinite, so going "sufficiently large" for now.
27     : FOR  ${i}  IN RANGE    1    65536
28     \    ${expiration_flag}=    Check If There Is A Reason To Exit Test Or If Duration Has Expired
29     \    Exit For Loop If    "${expiration_flag}" == "True"
30     \    ${switch_count}=    Find Max Switches    ${NUM_SWITCHES}     ${NUM_SWITCHES}     ${NUM_SWITCHES}
31     \    Check If There Is A Reason To Exit Test Or If Duration Has Expired    ${switch_count}    ${NUM_SWITCHES}    Switch count not correct
32     \    ${host_count}=    Find Max Hosts    ${NUM_HOSTS}    ${NUM_HOSTS}    ${NUM_HOSTS}
33     \    Check If There Is A Reason To Exit Test Or If Duration Has Expired    ${host_count}    ${NUM_HOSTS}    Host count not correct
34
35 *** Keywords ***
36 Check If There Is A Reason To Exit Test Or If Duration Has Expired
37     [Documentation]    In order to simplify the main test case, this keyword will make all the neccessary checks
38     ...    to determine if the test should FAIL and quit because of some problem.  It will also return a bool to
39     ...    indicate if the requested duration of the longevity test has elapsed.  The caller does not have to use
40     ...    that return value.
41     [Arguments]    ${comparator1}=1    ${comparator2}=1    ${comparator_failure_message}=null
42     Should Be Equal    ${comparator1}    ${comparator2}    ${comparator_failure_message}
43     Verify Controller Is Not Dead    ${CONTROLLER}
44     ${is_expired}=    Check If Test Duration Is Expired
45     [Return]    ${is_expired}
46
47 Check If Test Duration Is Expired
48     [Documentation]    Compares the current time with that of the suite variable ${end_time} to determine if the
49     ...    test duration has expired.
50     ${test_is_expired}=  Set Variable    False
51     ${current_time}=    Get Current Date
52     ${current_time}=    Convert Date    ${current_time}    epoch
53     ${test_is_expired}=    Set Variable If    "${current_time}" > "${end_time}"    True
54     [Return]    ${test_is_expired}
55
56 Longevity Suite Setup
57     [Documentation]    In addtion to opening the REST session to the controller, the ${end_time} that this
58     ...    test should not exceed is calculated and made in to a suite wide variable.
59     Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
60     ${start_time}=    Get Current Date
61     ${end_time}=    Add Time To Date    ${start_time}    ${TEST_LENGTH}
62     ${end_time}=    Convert Date    ${end_time}    epoch
63     Set Suite Variable    ${end_time}
64
65 Longevity Suite Teardown
66     [Documentation]    Any cleanup neccessary to allow this test to be run in a static environment should go here
67     ...    Currently, the same steps needed for the scalability suites should suffice.
68     Scalability Suite Teardown