Scale Test To Find Maximum Hosts
authorSANDEEP GANGADHARAN <SANDEEP.GANGADHARAN@HP.COM>
Fri, 22 Sep 1995 23:20:21 +0000 (16:20 -0700)
committerSANDEEP GANGADHARAN <SANDEEP.GANGADHARAN@HP.COM>
Wed, 13 May 2015 04:54:18 +0000 (21:54 -0700)
Added testplan for l2switch scale
Change-Id: Ib5bdc23d2e1023b44b0b8536efdd2a3e44b93cae

Signed-off-by: SANDEEP GANGADHARAN <SANDEEP.GANGADHARAN@HP.COM>
test/csit/libraries/Scalability.txt
test/csit/suites/l2switch/Maximum_Hosts/010__finding_max_hosts.robot [new file with mode: 0644]
test/csit/suites/openflowplugin/Maximum_Switches/010__finding_max_switches.txt
test/csit/testplans/l2switch-scalability-daily.txt [new file with mode: 0644]

index 066a2a70f1db90be6c6ed0e067e3e87d9f4927fd..bfef2f22613557c4970e954de934609541843803 100644 (file)
@@ -1,6 +1,10 @@
 *** Settings ***
 Library           SSHLibrary
 Resource          Utils.txt
+Library           String
+Library           Collections
+Library           ../variables/Variables.py
+Library           RequestsLibrary
 
 *** Variables ***
 ${linux_prompt}    >
@@ -33,6 +37,101 @@ Find Max Switches
     \    ${max-switches}    Convert To String    ${switches}
     [Return]    ${max-switches}
 
+Find Max Hosts
+    [Arguments]    ${begin}    ${stop}    ${step}
+    [Documentation]    Will find out max hosts starting from ${begin} till reaching ${stop} and in steps defined by ${step}
+    ${max-hosts}    Set Variable    ${0}
+    ${stop}    Convert to Integer    ${stop}
+    ${step}    Convert to Integer    ${step}
+    : FOR    ${hosts}    IN RANGE    ${begin}    ${stop+1}    ${step}
+    \    Start Mininet With One Switch And ${hosts} hosts
+    \    ${status}    ${result}    Run Keyword And Ignore Error   Wait Until Keyword Succeeds    120s    30s
+    \    ...    Check Every Switch  ${1}
+    \    Exit For Loop If    '${status}' == 'FAIL'
+    \    @{host_list}=      Get Mininet Hosts
+    \    ${status}=     Ping All Hosts     @{host_list}
+    \    Exit For Loop If    ${status} != ${0}
+    \    ${status}    ${result}    Run Keyword And Ignore Error    Verify Controller Is Not Dead    ${CONTROLLER}
+    \    Exit For Loop If    '${status}' == 'FAIL'
+    \    ${status}    ${result}    Run Keyword And Ignore Error    Wait Until Keyword Succeeds    120s    30s
+    \    ...    Check Number Of Hosts    ${hosts}
+    \    Exit For Loop If    '${status}' == 'FAIL'
+    \    Stop Mininet
+    \    ${status}    ${result}    Run Keyword And Ignore Error    Check No Switches    ${1}
+    \    Exit For Loop If    '${status}' == 'FAIL'
+    \    ${status}    ${result}    Run Keyword And Ignore Error    Check No Hosts
+    \    Exit For Loop If    '${status}' == 'FAIL'
+    \    ${max-hosts}    Convert To String    ${hosts}
+    [Return]    ${max-hosts}
+
+
+Get Mininet Hosts
+    [Documentation]  Get all the hosts from mininet
+    ${host_list}=       Create List
+    Write       nodes
+    ${out}=     Read Until      mininet>
+    @{words}=       Split String    ${out}  ${SPACE}
+    :FOR  ${item}   IN  @{words}
+    \   ${h}=   Get Lines Matching Regexp       ${item.rstrip()}     .*h[0-9]*s.
+    \   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
+    ${source}=      Get From List   ${host_list}  ${0}
+    : FOR    ${h}   IN  @{host_list}
+    \   ${status}=   Ping Two Hosts      ${source}   ${h}    1
+    \   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
+    Log To Console   Starting mininet with one switch and ${hosts} hosts
+    ${mininet_conn_id}=    Open Connection    ${MININET}    prompt=${linux_prompt}    timeout=${hosts*3}
+    Set Suite Variable    ${mininet_conn_id}
+    Login With Public Key    ${MININET_USER}    ${USER_HOME}/.ssh/id_rsa    any
+    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
+    ${resp}    RequestsLibrary.Get    session    ${OPERATIONAL_TOPO_API}
+    Log     Check number of hosts in inventory
+    Log To Console  Check number of hosts in inventory
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${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.
+    Run Keyword If       '${connection_index}'  !=   '${EMPTY}'        Switch Connection   ${connection_index}
+    Run Keyword If       '${connection_alias}'  !=   '${EMPTY}'        Switch Connection   ${connection_alias}
+    Write     ${host1} ping -c ${pingcount} ${host2}
+    ${out}=     Read Until  mininet>
+    ${ret}=     Get Lines Matching Regexp   ${out}  .*100% packet loss.*
+    ${len}=     Get Length      ${ret}
+    [Return]    ${len}
+
+Check No Hosts
+    [Documentation]    Check if all hosts are deleted from inventory
+    ${resp}    RequestsLibrary.Get    session    ${OPERATIONAL_TOPO_API}
+    Log To Console    Checking no hosts are present in operational database
+    Log    Checking no hosts are present in operational database
+    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
@@ -97,3 +196,7 @@ Stop Mininet
     Write    exit
     Read Until    ${linux_prompt}
     Close Connection
+
+Scalability Suite Teardown
+    Delete All Sessions
+    Clean Mininet System
\ No newline at end of file
diff --git a/test/csit/suites/l2switch/Maximum_Hosts/010__finding_max_hosts.robot b/test/csit/suites/l2switch/Maximum_Hosts/010__finding_max_hosts.robot
new file mode 100644 (file)
index 0000000..c1873d9
--- /dev/null
@@ -0,0 +1,23 @@
+*** Settings ***
+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           RequestsLibrary
+Variables         ../../../variables/Variables.py
+Resource          ../../../libraries/Scalability.txt
+
+*** Variables ***
+${MIN_HOSTS}    100
+${MAX_HOSTS}    2000
+${STEP_HOSTS}    100
+${HOSTS_RESULT_FILE}    hosts.csv
+
+*** Test Cases ***
+Find Max Supported Hosts
+    [Documentation]    Find max number of hosts starting from ${MIN_HOSTS} till reaching ${MAX_HOSTS} in steps of ${STEP_HOSTS}
+    Append To File    ${HOSTS_RESULT_FILE}    Max Hosts. All hosts connected to a single switch\n
+    ${max-hosts}    Find Max Hosts    ${MIN_HOSTS}    ${MAX_HOSTS}    ${STEP_HOSTS}
+    Log    ${max-hosts}
+    Append To File    ${HOSTS_RESULT_FILE}    ${max-hosts}\n
+
index d3d3f71be47bad7c713ffaf623239805082a2ecd..6228175ffc06585edb6f6930e6277ae190baca7d 100644 (file)
@@ -21,7 +21,3 @@ Find Max Switches
     Log    ${max-switches}
     Append To File    ${SWITCHES_RESULT_FILE}    ${max-switches}\n
 
-*** Keywords ***
-Scalability Suite Teardown
-    Delete All Sessions
-    Clean Mininet System
\ No newline at end of file
diff --git a/test/csit/testplans/l2switch-scalability-daily.txt b/test/csit/testplans/l2switch-scalability-daily.txt
new file mode 100644 (file)
index 0000000..b4043fc
--- /dev/null
@@ -0,0 +1,2 @@
+# Place the suites in run order:
+integration/test/csit/suites/l2switch/Maximum_Hosts