Fix PcepOperations typos
[integration/test.git] / csit / libraries / SetupUtils.robot
index 60d8c92f5253541ccd05a4935b406a7cc350cc93..466bcb0a8bfab7cb97a2749c8012becdeb300170 100644 (file)
@@ -1,36 +1,68 @@
 *** Settings ***
 *** Settings ***
-Documentation     Simple resource with setup keywords which combine FailFast and Karaf logging.
+Documentation       Simple resource with setup keywords which combine FailFast and Karaf logging.
 ...
 ...
-...               See FailFast.robot documentation for intricacies of that library.
-Resource          ${CURDIR}/FailFast.robot
-Resource          ${CURDIR}/KarafKeywords.robot
-Resource          ${CURDIR}/Utils.robot
+...                 Copyright (c) 2015-2017 Cisco Systems, Inc. and others. All rights reserved.
+...
+...                 This program and the accompanying materials are made available under the
+...                 terms of the Eclipse Public License v1.0 which accompanies this distribution,
+...                 and is available at http://www.eclipse.org/legal/epl-v10.html
+...
+...
+...                 In order for most keywords to work properly, the initialization keyword
+...                 Setup_Utils_For_Setup_And_Teardown has to be called, best in sute setup.
+...                 This initialization also initializes dependend Resources,
+...                 (most important KarafKeywords) whcih may initialize their dependecies as well.
+...
+...                 See FailFast.robot documentation for intricacies of that library.
+
+Resource            ${CURDIR}/FailFast.robot
+Resource            ${CURDIR}/KarafKeywords.robot
+Resource            ${CURDIR}/Utils.robot
+
 
 *** Variables ***
 
 *** Variables ***
-${SetupUtils__Known_Bug_ID}    ${EMPTY}
+${SetupUtils__Known_Bug_ID}     ${EMPTY}
+
 
 *** Keywords ***
 Setup_Utils_For_Setup_And_Teardown
 
 *** Keywords ***
 Setup_Utils_For_Setup_And_Teardown
-    [Documentation]    Prepare both FailFast and karaf logging, to be used in suite setup.
+    [Documentation]    Prepare both FailFast and Karaf logging, log that the caller suite has started.
+    ...    This keyword is to be used in suite setup, and without it the other keywords may not work properly.
+    [Arguments]    ${http_timeout}=${DEFAULT_TIMEOUT_HTTP}
     FailFast.Do_Not_Fail_Fast_From_Now_On
     FailFast.Do_Not_Fail_Fast_From_Now_On
-    KarafKeywords.Open_Controller_Karaf_Console_On_Background
+    KarafKeywords.Setup Karaf Keywords    http_timeout=${http_timeout}
     BuiltIn.Run Keyword And Ignore Error    KarafKeywords.Log_Test_Suite_Start_To_Controller_Karaf
 
 Setup_Test_With_Logging_And_Fast_Failing
     [Documentation]    Test case setup which skips on previous failure. If not, logs test case name to Karaf log.
     ...    Recommended to be used as the default test case setup.
     BuiltIn.Run Keyword And Ignore Error    KarafKeywords.Log_Test_Suite_Start_To_Controller_Karaf
 
 Setup_Test_With_Logging_And_Fast_Failing
     [Documentation]    Test case setup which skips on previous failure. If not, logs test case name to Karaf log.
     ...    Recommended to be used as the default test case setup.
+    [Arguments]    ${member_index_list}=${EMPTY}
     FailFast.Fail_This_Fast_On_Previous_Error
     FailFast.Fail_This_Fast_On_Previous_Error
-    BuiltIn.Run Keyword And Ignore Error    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
+    BuiltIn.Run Keyword And Ignore Error
+    ...    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
+    ...    member_index_list=${member_index_list}
 
 Setup_Test_With_Logging_And_Without_Fast_Failing
     [Documentation]    Test case setup which explicitly ignores previous failure and logs test case name to Karaf log.
     ...    Needed if the recommended default is to be overriden.
 
 Setup_Test_With_Logging_And_Without_Fast_Failing
     [Documentation]    Test case setup which explicitly ignores previous failure and logs test case name to Karaf log.
     ...    Needed if the recommended default is to be overriden.
+    [Arguments]    ${member_index_list}=${EMPTY}
     FailFast.Run_Even_When_Failing_Fast
     FailFast.Run_Even_When_Failing_Fast
-    BuiltIn.Run Keyword And Ignore Error    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
+    BuiltIn.Run Keyword And Ignore Error
+    ...    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
+    ...    member_index_list=${member_index_list}
+
+Setup_Logging_For_Debug_Purposes_On_List_Or_All
+    [Documentation]    Set the log level for given loggers on node nodes of the cluster
+    [Arguments]    ${log_level}    ${loggers_list}    ${member_index_list}=${EMPTY}
+    FOR    ${logger}    IN    @{loggers_list}
+        ClusterManagement.Run_Karaf_Command_On_List_Or_All
+        ...    log:set ${log_level} ${logger}
+        ...    member_index_list=${member_index_list}
+    END
 
 Set_Known_Bug_Id
 
 Set_Known_Bug_Id
-    [Arguments]    ${id}
     [Documentation]    Tell the Teardown keywords that any failure from now on is due to the specified known bug.
     [Documentation]    Tell the Teardown keywords that any failure from now on is due to the specified known bug.
+    [Arguments]    ${id}
     Set_Suite_Variable    ${SetupUtils__Known_Bug_ID}    ${id}
 
 Set_Unknown_Bug_Id
     Set_Suite_Variable    ${SetupUtils__Known_Bug_ID}    ${id}
 
 Set_Unknown_Bug_Id
@@ -38,7 +70,10 @@ Set_Unknown_Bug_Id
     Set_Known_Bug_Id    ${EMPTY}
 
 SetupUtils__Report_Bugs_Causing_Failure
     Set_Known_Bug_Id    ${EMPTY}
 
 SetupUtils__Report_Bugs_Causing_Failure
-    BuiltIn.Run_Keyword_And_Return_If    '${SetupUtils__Known_Bug_ID}' != ''    Utils.Report_Failure_Due_To_Bug    ${SetupUtils__Known_Bug_ID}
+    IF    '${SetupUtils__Known_Bug_ID}' != ''
+        Utils.Report_Failure_Due_To_Bug    ${SetupUtils__Known_Bug_ID}
+    END
+    BuiltIn.Run_Keyword_And_Return_If    '${SetupUtils__Known_Bug_ID}' != ''    Set_Known_Bug_Id    ${EMPTY}
     Utils.Report_Failure_And_Point_To_Linked_Bugs
 
 Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
     Utils.Report_Failure_And_Point_To_Linked_Bugs
 
 Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed