Verify PCEP sessions from multiple machines
[integration/test.git] / csit / suites / bgpcep / throughpcep / cases.robot
index ed5203719755d81c600523ea43e1a585b954ae61..4df50a7b1a6347f87e9bb8573d1970907f03b166 100644 (file)
@@ -110,7 +110,7 @@ Documentation     PCEP performance suite, uses restconf with configurable authen
 ...               UPDATERVM_ENABLE_TCP_RW_REUSE: Set to false if changing Linux configuration is not desired.
 ...               UPDATERVM_IP: Override TOOLS_SYSTEM for updater.py usage.
 ...               UPDATERVM_*: Override corresponding TOOLS_SYSTEM_* for updater.py usage.
-Suite Setup       FailFast.Do_Not_Fail_Fast_From_Now_On
+Suite Setup       Initial Setup
 Suite Teardown    Disconnect
 Test Setup        FailFast.Fail_This_Fast_On_Previous_Error
 Test Teardown     FailFast.Start_Failing_Fast_If_This_Failed
@@ -172,18 +172,6 @@ ${UPDATERVM_USER}    ${TOOLS_SYSTEM_USER}
 ${UPDATERVM_WORKSPACE}    ${TOOLS_SYSTEM_WORKSPACE}
 
 *** Test Cases ***
-Download_Pcc_Mock
-    [Documentation]    SSH login to pcc-mock VM, download latest pcc-mock executable from Nexus.
-    [Setup]    Select_MOCK_Machine
-    BuiltIn.Run_Keyword_If    ${PCCMOCK_COLOCATED}    Pccmock_From_Controller
-    NexusKeywords.Initialize_Artifact_Deployment_And_Usage    tools_system_connect=False
-    SSHLibrary.Open_Connection    ${PCCMOCKVM_IP}    alias=pccmock
-    SSHLibrary.Set_Client_Configuration    timeout=10s
-    SSHLibrary.Set_Client_Configuration    prompt=${PCCMOCKVM_PROMPT}
-    SSHKeywords.Flexible_SSH_Login    ${PCCMOCKVM_USER}    ${PCCMOCKVM_PASSWORD}    delay=4s
-    ${file_name} =    NexusKeywords.Deploy_Test_Tool    bgpcep    pcep-pcc-mock
-    BuiltIn.Set_Suite_Variable    ${mock_location}    ${file_name}
-
 Put_Updater
     [Documentation]    Open SSH session to updater VM, copy the utility there, including dependencies, also prepare direct http session.
     BuiltIn.Run_Keyword_If    ${UPDATER_COLOCATED}    Updater_From_Controller
@@ -347,6 +335,26 @@ Updater_with delegate
     Verify    10
     [Teardown]    Do_Not_Start_Failing_If_This_Failed
 
+PCEP_sessions_from_multiple_machines
+    [Documentation]    Download and start PCC Mock in tools vm and do updation
+    Download_Pcc_Mock    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_USER}    ${TOOLS_SYSTEM_PASSWORD}    ${TOOLS_SYSTEM_PROMPT}    pccmock_toolsvm
+    Set_Hop    0
+    Start_Pcc_Mock    pccmock_toolsvm    ${TOOLS_SYSTEM_IP}    ${PCCS}    ${LSPS}    throughpcep_tools.log
+    ${total_size} =    BuiltIn.Evaluate    int(${size})+int(${LSPS})
+    Builtin.Set_Suite_Variable    ${size}    ${total_size}
+    BuiltIn.Log    ${size}
+    Builtin.Wait_Until_Keyword_Succeeds    120s    1s    Pcep_On
+    ${second_pcc_lsp_size} =    BuiltIn.Evaluate    int(${LSPS})
+    Builtin.Set_Suite_Variable    ${size}    ${second_pcc_lsp_size}
+    Updater    10    1    ${TOOLS_SYSTEM_IP}
+    Builtin.Set_Suite_Variable    ${size}    ${total_size}
+    Verify    10
+    SSHLibrary.Switch_Connection    pccmock_toolsvm
+    SSHLibrary.Get_File    ${LOG_PATH}/throughpcep_tools.log    throughpcep_tools.log
+    BGPcliKeywords.Stop_Console_Tool_And_Wait_Until_Prompt
+    Kill all pcc mock simulator processes    pccmock_toolsvm
+    [Teardown]    Run Keywords    BGPcliKeywords.Stop_Console_Tool_And_Wait_Until_Prompt    AND    Kill all pcc mock simulator processes
+
 Stop_Pcc_Mock
     [Documentation]    Send ctrl+c to pcc-mock, see prompt again within timeout.
     [Setup]    Run_Even_When_Failing_Fast
@@ -374,8 +382,9 @@ PCEP Sessions Flapped alongside LSP updates
 Download_Pccmock_Log
     [Documentation]    Transfer pcc-mock output from pcc-mock VM to robot VM.
     [Setup]    Run_Even_When_Failing_Fast
-    SSHLibrary.Execute Command    zip ${LOG_PATH}/mock_log.zip /tmp/throughpcep*
-    SSHLibrary.Get_File    ${LOG_PATH}/mock_log.zip    mock_log.zip
+    SSHLibrary.Get_File    ${LOG_PATH}/${LOG_NAME}    ${LOG_NAME}
+    SSHLibrary.Get_File    ${LOG_PATH}/serial_execution.log    serial_execution.log
+    SSHLibrary.Get_File    ${LOG_PATH}/throughpcep_parallel_Execution.log
 
 Topology_Postcondition
     [Documentation]    Verify that within timeout, PCEP topology contains no PCCs again.
@@ -393,15 +402,35 @@ Restore_Tcp_Rw_Reuse
     BuiltIn.Should_Be_Equal    ${rc}    ${0}
 
 *** Keywords ***
+Initial Setup
+    FailFast.Do_Not_Fail_Fast_From_Now_On
+    Select_mock_machine_and_Download_PCC_Mock
+
+Select_mock_machine_and_Download_PCC_Mock
+    Select_MOCK_Machine
+    Download_Pcc_Mock
+
 Select_MOCK_Machine
     [Documentation]    Check the tools system variable and assigns the PCC Mock
     Run Keyword If    '${USE_TOOLS_SYSTEM}' == 'False'    Run Keywords    Pccmock_From_Odl_System    AND    Updater_From_Odl_System
     BuiltIn.Set_Suite_Variable    ${FIRST_PCC_IP}    ${PCCMOCKVM_IP}
 
+Download_Pcc_Mock
+    [Arguments]    ${pcc_ip}=${PCCMOCKVM_IP}    ${pcc_user}=${PCCMOCKVM_USER}    ${pcc_password}=${PCCMOCKVM_PASSWORD}    ${pcc_prompt}=${PCCMOCKVM_PROMPT}    ${ssh_alias}=pccmock
+    [Documentation]    SSH login to pcc-mock VM, download latest pcc-mock executable from Nexus.
+    BuiltIn.Run_Keyword_If    ${PCCMOCK_COLOCATED}    Pccmock_From_Controller
+    NexusKeywords.Initialize_Artifact_Deployment_And_Usage    tools_system_connect=False
+    SSHLibrary.Open_Connection    ${pcc_ip}    alias=${ssh_alias}
+    SSHLibrary.Set_Client_Configuration    timeout=10s
+    SSHLibrary.Set_Client_Configuration    prompt=${pcc_prompt}
+    SSHKeywords.Flexible_SSH_Login    ${pcc_user}    ${pcc_password}    delay=4s
+    ${file_name} =    NexusKeywords.Deploy_Test_Tool    bgpcep    pcep-pcc-mock
+    BuiltIn.Set_Suite_Variable    ${mock_location}    ${file_name}
+
 Start_Pcc_Mock
-    [Arguments]    ${mock-ip}=${FIRST_PCC_IP}    ${pccs}=${PCCS}    ${lsps}=${LSPS}    ${log_name}=${LOG_NAME}
+    [Arguments]    ${ssh_alias}=pccmock    ${mock-ip}=${FIRST_PCC_IP}    ${pccs}=${PCCS}    ${lsps}=${LSPS}    ${log_name}=${LOG_NAME}
     [Documentation]    Launch pcc-mock on background so simulated PCCs start connecting to controller.
-    SSHLibrary.Switch_Connection    pccmock
+    SSHLibrary.Switch_Connection    ${ssh_alias}
     ${command} =    NexusKeywords.Compose_Full_Java_Command    -jar ${mock_location} --local-address ${mock-ip} --remote-address ${ODL_SYSTEM_IP} --pcc ${pccs} --lsp ${lsps} &> ${LOG_PATH}/${log_name}
     BuiltIn.Log    ${command}
     SSHLibrary.Write    ${command}
@@ -510,7 +539,7 @@ Flap Pcc Mock sessions continuously with LSP updates
         ${workers} =    Evaluate    ${workers}*${workers}
         Set_Hop    0
         Builtin.Wait_Until_Keyword_Succeeds    ${PCEP_READY_VERIFY_TIMEOUT}    5s    Pcep_Off
-        Start_Pcc_Mock    ${mock-ip}    ${pccs}    ${lsps}    serial_execution.log
+        Start_Pcc_Mock    pccmock    ${mock-ip}    ${pccs}    ${lsps}    serial_execution.log
         Builtin.Wait_Until_Keyword_Succeeds    60s    5s    Pcep_On
         ${i} =    Evaluate    ${i}+1
         Updater    ${i}    ${workers}    127.1.0.0    ${pccs}    ${lsps}
@@ -550,7 +579,8 @@ Check PCEP is stable
     BGPcliKeywords.Stop_Console_Tool_And_Wait_Until_Prompt
 
 Kill all pcc mock simulator processes
-    SSHLibrary.Switch_Connection    pccmock
+    [Arguments]    ${ssh_alias}=pccmock
+    SSHLibrary.Switch_Connection    ${ssh_alias}
     ${mock_pid}    Get pid    /home/${ODL_SYSTEM_USER}/${mock_location}
     SSHLibrary.Execute_Command    kill -9 ${mock_pid}
     ${script_pid_1}    Get pid    bash -c sh /tmp/mock.sh