Automation to track and catch bug 2429
authorJamo Luhrsen <james.luhrsen@hp.com>
Mon, 11 May 2015 23:19:33 +0000 (16:19 -0700)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 12 May 2015 20:03:43 +0000 (20:03 +0000)
adding Bug_Validation folder to flow-services testplan

Change-Id: I33393ffae19d789f3a2cdd91fc4d51e46556d860
Signed-off-by: Jamo Luhrsen <james.luhrsen@hp.com>
test/csit/libraries/Utils.txt
test/csit/suites/openflowplugin/Bug_Validation/2429.robot [new file with mode: 0644]
test/csit/testplans/openflowplugin-flow-services-lithium-redesign.txt
test/csit/testplans/openflowplugin-flow-services.txt

index e849c5c51ee14dd76efe1985ca1b76dde70dd509..eaf62b630f99fe764168d025249c43a9a59f754f 100644 (file)
@@ -1,5 +1,6 @@
 *** Settings ***
 Library           SSHLibrary
+Library           String
 Library           ./UtilLibrary.py
 Resource          KarafKeywords.txt
 
@@ -103,6 +104,25 @@ Extract Value From Content
     ${value}=    Run Keyword If    '${strip}' == 'strip'    Strip Quotes    ${value}
     [Return]    ${value}
 
+Get Process ID Based On Regex On Remote System
+    [Documentation]    Uses ps to find a process that matches the supplied regex.  Returns the PID of that process
+    ...    The ${regex_string_to_match_on} should produce a unique process otherwise the PID returned may not be
+    ...    the expected PID
+    [Arguments]    ${remote_system}    ${regex_string_to_match_on}
+    # doing the extra -v grep in this command to exclude the grep process itself from the output
+    ${output}=    Run Command On Remote System    ${remote_system}    ps -elf | grep -v grep | grep ${regex_string_to_match_on} | awk '{print $4}'
+    # ${output} contains the system prompt and all we want is the value of the number
+    ${pid}=    Fetch From Left    ${output}    \r
+    [Return]    ${pid}
+
+Get Process Thread Count On Remote System
+    [Documentation]    Executes the ps command to retrieve the lightweight process (aka thread) count.
+    [Arguments]     ${remote_system}    ${pid}
+    ${output}=    Run Command On Remote System    ${remote_system}    ps --no-headers -o nlwp ${pid}
+    # ${output} contains the system prompt and all we want is the value of the number
+    ${thread_count}=    Fetch From Left    ${output}    \r
+    [Return]    ${thread_count}
+
 Strip Quotes
     [Arguments]    ${string_to_strip}
     [Documentation]    Will strip ALL quotes from given string and return the new string
@@ -120,6 +140,7 @@ Run Command On Remote System
     SSHLibrary.Write    ${cmd}
     ${output}=    SSHLibrary.Read Until    ${linux_prompt}
     SSHLibrary.Close Connection
+    Log    ${output}
     [Return]    ${output}
 
 Verify File Exists On Remote System
diff --git a/test/csit/suites/openflowplugin/Bug_Validation/2429.robot b/test/csit/suites/openflowplugin/Bug_Validation/2429.robot
new file mode 100644 (file)
index 0000000..38cef9e
--- /dev/null
@@ -0,0 +1,32 @@
+*** Settings ***
+Documentation     OF Handshake threads should be closed if the connection has a
+...               failure.  This bug was fixed in the Helium SR3 release but
+...               persisted in to the Lithium release.  Once fixed, this will
+...               catch any future regressions
+Metadata:         https://bugs.opendaylight.org/show_bug.cgi?id=2429
+Library           OperatingSystem
+Library           SSHLibrary
+Resource          ../../../libraries/Utils.txt
+Variables         ../../../variables/Variables.py
+
+*** Variables ***
+${openflow_port}                   6633
+${number_ofconnections_to_fail}    1000
+${margin_of_error}                 0.05   # percentage
+
+*** Test Cases ***
+Bug_2429
+    [Documentation]    Using the "nc" tool, a number of connections to the ${openflow_port}
+    ...    will be opened and closed to simulate a failed OF handshake.  The java threadcount
+    ...    will be compared before and after to ensure that there are no thread leaks.  Since
+    ...    it's reasonable for other valid threads to be started (or stopped) during the test
+    ...    a larger number of failed connections will be used and a small margin of error will
+    ...    determine if the test is a PASS or FAIL
+    ${controller_pid}=    Get Process ID Based On Regex On Remote System    ${CONTROLLER}    java.*distribution.*karaf
+    Should Match Regexp    ${controller_pid}    [0-9]+    PID was not discovered
+    ${starting_thread_count}=    Get Process Thread Count On Remote System    ${CONTROLLER}    ${controller_pid}
+    Repeat Keyword    ${number_ofconnections_to_fail}    Run    nc -w 1 ${CONTROLLER} ${openflow_port} &
+    ${ending_thread_count}=    Get Process Thread Count On Remote System    ${CONTROLLER}    ${controller_pid}
+    Log    starting count: ${starting_thread_count}\nending count: ${ending_thread_count}
+    ${acceptable_thread_count}=    Evaluate    ${starting_thread_count} + (${number_of_connections_to_fail} * ${margin_of_error})
+    Should Be True    ${ending_thread_count} <= ${acceptable_thread_count}    Final thread count of ${ending_thread_count} exceeds acceptable count: ${acceptable_thread_count}
\ No newline at end of file
index f65ba5a6615143c48886a1aad50a518118553c73..491197eda6c5bc54ad39f82c7445fb1bb0c52eba 100644 (file)
@@ -7,3 +7,4 @@ integration/test/csit/suites/openflowplugin/Flows_OF13
 integration/test/csit/suites/openflowplugin/Switch_Qualification
 integration/test/csit/suites/openflowplugin/Flows_Stats_OF13
 integration/test/csit/suites/openflowplugin/Groups_Meters_OF13
+integration/test/csit/suites/openflowplugin/Bug_Validation
index f65ba5a6615143c48886a1aad50a518118553c73..491197eda6c5bc54ad39f82c7445fb1bb0c52eba 100644 (file)
@@ -7,3 +7,4 @@ integration/test/csit/suites/openflowplugin/Flows_OF13
 integration/test/csit/suites/openflowplugin/Switch_Qualification
 integration/test/csit/suites/openflowplugin/Flows_Stats_OF13
 integration/test/csit/suites/openflowplugin/Groups_Meters_OF13
+integration/test/csit/suites/openflowplugin/Bug_Validation