Fix karaf log grep at test teardown 34/49834/2
authorAlon Kochba <alonko@hpe.com>
Tue, 27 Dec 2016 12:32:24 +0000 (14:32 +0200)
committerAlon Kochba <alonko@hpe.com>
Tue, 27 Dec 2016 12:34:38 +0000 (14:34 +0200)
Refactor karaf logs grep at teardown of test cases.
Currently the first ODL is always grepped twice, remove
the duplicate logic and refactor into its own function.

Change-Id: I62b5b82ffb180874480a6d5a041d94534273c7cd
Signed-off-by: Alon Kochba <alonko@hpe.com>
csit/libraries/OpenStackOperations.robot

index 14cbd76eeec712505c8340a63f9c31cdb1293bec..3ade496689bccd702dc0c9f7f5321b49b3c64623 100644 (file)
@@ -498,6 +498,13 @@ Get Karaf Log Types From Test Start
     \    Get Karaf Log Type From Test Start    ${ip}    ${test_name}    ${type}    ${user}    ${password}
     \    ...    ${prompt}    ${log_file}
 
+Get Karaf Log Events From Test Start
+    [Arguments]    ${test_name}    ${user}=${ODL_SYSTEM_USER}    ${password}=${ODL_SYSTEM_PASSWORD}    ${prompt}=${ODL_SYSTEM_PROMPT}
+    ${log_types} =    Create List    ERROR    WARN    Exception
+    Run Keyword If    0 < ${NUM_ODL_SYSTEM}    Get Karaf Log Types From Test Start    ${ODL_SYSTEM_IP}    ${test_name}    ${log_types}
+    Run Keyword If    1 < ${NUM_ODL_SYSTEM}    Get Karaf Log Types From Test Start    ${ODL_SYSTEM_2_IP}    ${test_name}    ${log_types}
+    Run Keyword If    2 < ${NUM_ODL_SYSTEM}    Get Karaf Log Types From Test Start    ${ODL_SYSTEM_3_IP}    ${test_name}    ${log_types}
+
 Get ControlNode Connection
     ${control_conn_id}=    SSHLibrary.Open Connection    ${OS_CONTROL_NODE_IP}    prompt=${DEFAULT_LINUX_PROMPT_STRICT}
     Utils.Flexible SSH Login    ${OS_USER}    ${DEVSTACK_SYSTEM_PASSWORD}
@@ -515,11 +522,7 @@ Get Test Teardown Debugs
     [Arguments]    ${test_name}=${TEST_NAME}
     Get OvsDebugInfo
     Get Model Dump    ${HA_PROXY_IP}
-    ${log_types} =    Create List    ERROR    WARN    Exception
-    Get Karaf Log Types From Test Start    ${ODL_SYSTEM_IP}    ${test_name}    ${log_types}
-    Run Keyword If    0 < ${NUM_ODL_SYSTEM}    Get Karaf Log Types From Test Start    ${ODL_SYSTEM_IP}    ${test_name}    ${log_types}
-    Run Keyword If    1 < ${NUM_ODL_SYSTEM}    Get Karaf Log Types From Test Start    ${ODL_SYSTEM_2_IP}    ${test_name}    ${log_types}
-    Run Keyword If    2 < ${NUM_ODL_SYSTEM}    Get Karaf Log Types From Test Start    ${ODL_SYSTEM_3_IP}    ${test_name}    ${log_types}
+    Get Karaf Log Events From Test Start    ${test_name}
 
 Show Debugs
     [Arguments]    @{vm_indices}