Added Syslog Scripts to run in Cassandra,HBase and HSQLDB
[integration/test.git] / csit / libraries / BGPSpeaker.robot
index f2456dc092c3321b8253a39c9f701699965938cc..dc547cae1a1f475ee4ce5a93d9eb31788a132965 100644 (file)
@@ -8,11 +8,15 @@ Documentation     Robot keyword library (Resource) for handling the BGP speaker
 ...               and is available at http://www.eclipse.org/legal/epl-v10.html
 ...
 ...
-...               This library assumes that a SSH connections exists (and is switched to)
-...               to a Linux machine (usualy MININET) where the Python BGP speaker should be running.
+...               This library assumes that a SSH connection exists (and is switched to)
+...               to a Linux machine (usualy TOOLS_SYSTEM) where the Python BGP speaker should be run.
 ...               It also assumes that the current working directory on that connection is the
 ...               directory where the speaker tool was deployed as there are no paths to neither
 ...               the play.py nor the log files in the commands.
+...
+...               Aside BGP Speaker utility, there is also BGP Manager starting utilities in parallel.
+...               For purpose of dumping logs and killing, Manager behaves the same as Speaker.
+...
 ...               TODO: The Utils.robot library has a "Run Command On Remote System" if we didn't
 ...               want to make the assumption that an SSH connection was already open.
 ...               alternative TODO: Explain that it is not worth to perform separate SSH logins.
@@ -20,7 +24,7 @@ Library           SSHLibrary
 Resource          ${CURDIR}/Utils.robot
 
 *** Variables ***
-${player_output_log}    play.py.out
+${BGPSpeaker__OUTPUT_LOG}    play.py.out
 
 *** Keywords ***
 Start_BGP_Speaker
@@ -29,7 +33,14 @@ Start_BGP_Speaker
     ...    so it can be dumped into the logs later, when stopping it. This also avoids polluting the
     ...    output seen by "Read Until Prompt" with false propmpts so it won't stop prematurely
     ...    leading to a spurious test failure, messy log content or other misbehavior.
-    ${command}=    BuiltIn.Set_Variable    python play.py ${arguments} &> ${player_output_log}
+    ${command} =    BuiltIn.Set_Variable    python play.py ${arguments} &> ${BGPSpeaker__OUTPUT_LOG}
+    BuiltIn.Log    ${command}
+    ${output} =    SSHLibrary.Write    ${command}
+
+Start_BGP_Manager
+    [Arguments]    ${arguments}
+    [Documentation]    Start the BGP manager python utility. Redirect its error output to a log file.
+    ${command}=    BuiltIn.Set_Variable    python play.py ${arguments} &> ${BGPSpeaker__OUTPUT_LOG}
     BuiltIn.Log    ${command}
     ${output}=    SSHLibrary.Write    ${command}
 
@@ -38,15 +49,17 @@ Dump_BGP_Speaker_Logs
     ...    This needs to be called if your suite detects play.py crashing and bypasses
     ...    Kill_BGP_Speaker in that case otherwise the output of play.py (which most
     ...    likely contains clues about why it crashed) will be lost.
-    ${output_log}=    SSHLibrary.Execute_Command    cat ${player_output_log}
+    ${output_log} =    SSHLibrary.Execute_Command    cat ${BGPSpeaker__OUTPUT_LOG}
     BuiltIn.Log    ${output_log}
 
 Kill_BGP_Speaker
     [Documentation]    Interrupt play.py, fail if no prompt is seen within SSHLibrary timeout.
     ...    Also dump the logs with the output the program produced.
+    ...    This keyword is also suitable for stopping BGP manager.
     Utils.Write_Bare_Ctrl_C
-    ${status}    ${message}=    BuiltIn.Run_Keyword_And_Ignore_Error    SSHLibrary.Read_Until_Prompt
+    ${status}    ${message} =    BuiltIn.Run_Keyword_And_Ignore_Error    SSHLibrary.Read_Until_Prompt
     Dump_BGP_Speaker_Logs
+    # TODO: When Propagate_Failure is moved to better Resource, use it instead of the following.
     BuiltIn.Return_From_Keyword_If    '${status}' == 'PASS'
     BuiltIn.Log    ${message}
     BuiltIn.Fail    The prompt was not seen within timeout period.