Beta version of a longevity test
authorJamo Luhrsen <james.luhrsen@hp.com>
Tue, 19 May 2015 22:48:08 +0000 (15:48 -0700)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 20 May 2015 02:51:21 +0000 (02:51 +0000)
openflow specific

reuses smaller values and single iterations of the hosts and switch
scale tests

this is intended to help meet Lithium deliverables for the integration
group, however this is also a Linux Foundation summer intern project.
I hope this can be a building block for that project.

Change-Id: If84ed95106bbde84f50edbd4c45b189341935407
Signed-off-by: Jamo Luhrsen <james.luhrsen@hp.com>
test/csit/libraries/Scalability.txt
test/csit/suites/openflowplugin/Longevity/010__longevity.txt [new file with mode: 0644]
test/csit/suites/openflowplugin/Maximum_Switches/010__finding_max_switches.txt

index bfef2f22613557c4970e954de934609541843803..08029e2d13b5a4570704a3259b52b5dfb75cf163 100644 (file)
@@ -3,7 +3,7 @@ Library           SSHLibrary
 Resource          Utils.txt
 Library           String
 Library           Collections
-Library           ../variables/Variables.py
+Variables           ../variables/Variables.py
 Library           RequestsLibrary
 
 *** Variables ***
@@ -64,7 +64,6 @@ Find Max Hosts
     \    ${max-hosts}    Convert To String    ${hosts}
     [Return]    ${max-hosts}
 
-
 Get Mininet Hosts
     [Documentation]  Get all the hosts from mininet
     ${host_list}=       Create List
@@ -76,7 +75,6 @@ Get Mininet Hosts
     \   Run Keyword If  '${h}' != '${EMPTY}'    Append To List     ${host_list}   ${h}
     [Return]  ${host_list}
 
-
 Ping All Hosts
     [Arguments]     @{host_list}
     [Documentation]  Do one round of ping from one host to all other hosts in mininet
@@ -86,8 +84,6 @@ Ping All Hosts
     \   Exit For Loop If    ${status}!=${0}
     [Return]    ${status}
 
-
-
 Start Mininet With One Switch And ${hosts} hosts
     [Documentation]    Start mininet with one switch and ${hosts} hosts
     Log     Starting mininet with one switch and ${hosts} hosts
@@ -98,7 +94,6 @@ Start Mininet With One Switch And ${hosts} hosts
     Write    sudo mn --controller=remote,ip=${CONTROLLER} --topo linear,1,${hosts} --switch ovsk,protocols=OpenFlow13
     Read Until    mininet>
 
-
 Check Number Of Hosts
     [Arguments]    ${hosts}
     [Documentation]    Check number of hosts in inventory
@@ -109,7 +104,6 @@ Check Number Of Hosts
     ${count}=    Get Count       ${resp.content}    "node-id":"host:
     Should Be Equal As Integers  ${count}   ${hosts}
 
-
 Ping Two Hosts
     [Arguments]     ${host1}    ${host2}    ${pingcount}=2   ${connection_index}=${EMPTY}   ${connection_alias}=${EMPTY}
     [Documentation]  Ping between mininet hosts. Must be used only after a mininet session is in place.Returns non zero value if there is 100% packet loss.
@@ -129,9 +123,6 @@ Check No Hosts
     Should Be Equal As Strings    ${resp.status_code}    200
     Should Not Contain    ${resp.content}    "node-id":"host:
 
-
-
-
 Start Mininet Linear
     [Arguments]    ${switches}
     [Documentation]    Start mininet linear topology with ${switches} nodes
@@ -173,7 +164,7 @@ Check Linear Topology
 Check No Switches
     [Arguments]    ${switches}
     [Documentation]    Check no switch is in inventory
-    ${resp}    RequestsLibrary.Get    session    /restconf/operational/opendaylight-inventory:nodes
+    ${resp}    RequestsLibrary.Get    session    ${OPERATIONAL_NODES_API}
     Log To Console    Checking No Switches
     Should Be Equal As Strings    ${resp.status_code}    200
     : FOR    ${switch}    IN RANGE    1    ${switches+1}
@@ -182,7 +173,7 @@ Check No Switches
 Check No Topology
     [Arguments]    ${switches}
     [Documentation]    Check no switch is in topology
-    ${resp}    RequestsLibrary.Get    session    /restconf/operational/network-topology:network-topology/
+    ${resp}    RequestsLibrary.Get    session    ${OPERATIONAL_TOPO_API}
     Log To Console    Checking No Topology
     Should Be Equal As Strings    ${resp.status_code}    200
     : FOR    ${switch}    IN RANGE    1    ${switches+1}
diff --git a/test/csit/suites/openflowplugin/Longevity/010__longevity.txt b/test/csit/suites/openflowplugin/Longevity/010__longevity.txt
new file mode 100644 (file)
index 0000000..204b9b4
--- /dev/null
@@ -0,0 +1,68 @@
+*** Settings ***
+Documentation     Beta Version of the Longevity Test.  Currently:
+...               1.  runs one iteration of the switch scale test based on ${NUM_SWITCHES}
+...               2.  runs one iteration of the host scale test based on ${NUM_HOSTS}
+...               Steps 1 and 2 are run in a psuedo infinite loop and before each loop is
+...               run, a time check is made against the ${TEST_LENGTH}. If the test duration
+...               has expired, the loop is exited and the test is marked PASS
+...
+...               If either of steps 1 or 2 fail to reach their configured value of ${NUM_SWITCHES}
+...               or ${NUM_HOSTS} the test will exit immediately and not continue.
+Suite Setup       Longevity Suite Setup
+Suite Teardown    Longevity Suite Teardown
+Library           RequestsLibrary
+Library           DateTime
+Variables         ../../../variables/Variables.py
+Resource          ../../../libraries/Scalability.txt
+
+*** Variables ***
+${NUM_SWITCHES}           50
+${NUM_HOSTS}              200
+${TEST_LENGTH}            2 hours
+
+*** Test Cases ***
+Longevity Test
+    [Documentation]    Uses switch and host scale test functionality in a loop for given period of time
+    #  This loop is not infinite, so going "sufficiently large" for now.
+    : FOR  ${i}  IN RANGE    1    65536
+    \    ${expiration_flag}=    Check If There Is A Reason To Exit Test Or If Duration Has Expired
+    \    Exit For Loop If    "${expiration_flag}" == "True"
+    \    ${switch_count}=    Find Max Switches    ${NUM_SWITCHES}     ${NUM_SWITCHES}     ${NUM_SWITCHES}
+    \    Check If There Is A Reason To Exit Test Or If Duration Has Expired    ${switch_count}    ${NUM_SWITCHES}    Switch count not correct
+    \    ${host_count}=    Find Max Hosts    ${NUM_HOSTS}    ${NUM_HOSTS}    ${NUM_HOSTS}
+    \    Check If There Is A Reason To Exit Test Or If Duration Has Expired    ${host_count}    ${NUM_HOSTS}    Host count not correct
+
+*** Keywords ***
+Check If There Is A Reason To Exit Test Or If Duration Has Expired
+    [Documentation]    In order to simplify the main test case, this keyword will make all the neccessary checks
+    ...    to determine if the test should FAIL and quit because of some problem.  It will also return a bool to
+    ...    indicate if the requested duration of the longevity test has elapsed.  The caller does not have to use
+    ...    that return value.
+    [Arguments]    ${comparator1}=1    ${comparator2}=1    ${comparator_failure_message}=null
+    Should Be Equal    ${comparator1}    ${comparator2}    ${comparator_failure_message}
+    Verify Controller Is Not Dead    ${CONTROLLER}
+    ${is_expired}=    Check If Test Duration Is Expired
+    [Return]    ${is_expired}
+
+Check If Test Duration Is Expired
+    [Documentation]    Compares the current time with that of the suite variable ${end_time} to determine if the
+    ...    test duration has expired.
+    ${test_is_expired}=  Set Variable    False
+    ${current_time}=    Get Current Date
+    ${current_time}=    Convert Date    ${current_time}    epoch
+    ${test_is_expired}=    Set Variable If    "${current_time}" > "${end_time}"    True
+    [Return]    ${test_is_expired}
+
+Longevity Suite Setup
+    [Documentation]    In addtion to opening the REST session to the controller, the ${end_time} that this
+    ...    test should not exceed is calculated and made in to a suite wide variable.
+    Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
+    ${start_time}=    Get Current Date
+    ${end_time}=    Add Time To Date    ${start_time}    ${TEST_LENGTH}
+    ${end_time}=    Convert Date    ${end_time}    epoch
+    Set Suite Variable    ${end_time}
+
+Longevity Suite Teardown
+    [Documentation]    Any cleanup neccessary to allow this test to be run in a static environment should go here
+    ...    Currently, the same steps needed for the scalability suites should suffice.
+    Scalability Suite Teardown
\ No newline at end of file
index 6228175ffc06585edb6f6930e6277ae190baca7d..4cc2e7ca2d78a739350f744d823cdb26b9e8af35 100644 (file)
@@ -3,7 +3,7 @@ Documentation     Test suite for finding out max number of switches
 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
 Suite Teardown    Scalability Suite Teardown
 Library           OperatingSystem
-Library           ../../../libraries/RequestsLibrary.py
+Library           RequestsLibrary
 Variables         ../../../variables/Variables.py
 Resource          ../../../libraries/Scalability.txt