Fix bug 2332 in heal_02 to add loop to check presence of remote file after healing
[osm/tests.git] / robot-systest / testsuite / heal_02-scale_vdu_healing.robot
index ffdcb85..328274d 100644 (file)
@@ -67,6 +67,10 @@ ${SUCCESS_RETURN_CODE}   0
 @{VIM_VDUS}   @{EMPTY}
 @{VIM_VOLUMES}   @{EMPTY}
 
+# Variables to control time for healing and polling
+${VNF_MAX_TIME_TO_BE_READY}   120sec
+${VNF_POL_TIME}   30sec
+
 
 *** Test Cases ***
 Create VNF Descriptors
@@ -149,6 +153,19 @@ Get Manual Scale VNF Info
     Log   ${VDU_MANUALSCALE_IDS}[1]
     @{manualscale_ip_list}=   Get Vnf Vdur IPs   ${VNF_MANUALSCALE_ID}
     Set Suite Variable   @{MANUALSCALE_IP_LIST}   @{manualscale_ip_list}
+    ${ip}=   Get Vdu Attribute   ${VNF_MANUALSCALE_ID}   ip-address   1
+    Set Suite Variable   ${HEALED_VDU_MGMT_IP}   ${ip}
+
+Check Day0 And Day1 In VDU Before Halting VM
+    [Documentation]   Check that the VDU is accessible via SSH in its mgmt IP address.
+    ...               It also checks if day-0 worked and a remote file has been created in the VDU.
+    ...               It also checks if day-1 worked and a remote file has been created in the VDU.
+    ${ip}=   Get Vdu Attribute   ${VNF_MANUALSCALE_ID}   ip-address   1
+    Variable Should Exist   ${HEALED_VDU_MGMT_IP}   msg=IP address of the healed VDU is not available
+    Wait Until Keyword Succeeds   ${VNF_MAX_TIME_TO_BE_READY}   ${VNF_POL_TIME}   Test SSH Connection   ${HEALED_VDU_MGMT_IP}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}
+    ${stdout}=   Execute Remote Command Check Rc Return Output   ${ip}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}   sudo ls ${VNF_MANUALSCALE_CLOUDINIT_FILE}
+    Log   ${stdout}
+    # Check If Remote File Exists   ${HEALED_VDU_MGMT_IP}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}   ${VNF_MANUALSCALE_DAY1_FILE}
 
 Halt Manual Scale VDU
     [Documentation]   Halt one of the VM of the Manual Scale VNF.
@@ -171,12 +188,20 @@ Check VNF After Healing
     Should Be Equal   ${VDU_MANUALSCALE_IDS}[0]   ${ids}[0]   VDU[0] id has changed after healing
     Should Not Be Equal   ${VDU_MANUALSCALE_IDS}[1]   ${ids}[1]   VDU[1] id has not changed after healing
     Should Be Equal   ${VDU_MANUALSCALE_IDS}[2]   ${ids}[2]   VDU[2] id has changed after healing
-    ${ip}=   Get Vdu Attribute   ${VNF_MANUALSCALE_ID}   ip-address   1
-    ${stdout}=   Execute Remote Command Check Rc Return Output   ${ip}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}   sudo ls ${VNF_MANUALSCALE_CLOUDINIT_FILE}
-    Log   ${stdout}
-    Check If Remote File Exists   ${ip}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}   ${VNF_MANUALSCALE_DAY1_FILE}
     ${vim_info}=   Get Vdu Attribute   ${VNF_MANUALSCALE_ID}   vim_info   1
     Should Contain   ${vim_info}   id: ${FLAVOR_ID}   msg=Flavor ID is incorrect
+    ${ip}=   Get Vdu Attribute   ${VNF_MANUALSCALE_ID}   ip-address   1
+    Should Be Equal   ${HEALED_VDU_MGMT_IP}   ${ip}
+
+Check Day0 And Day1 In VDU After Healing
+    [Documentation]   Check that the healed VDU is accessible via SSH in its mgmt IP address.
+    ...               It also checks if day-0 worked after healing and a remote file has been created in the VDU.
+    ...               It also checks if day-1 worked after healing and a remote file has been created in the VDU.
+    Variable Should Exist   ${HEALED_VDU_MGMT_IP}   msg=IP address of the healed VDU is not available
+    Wait Until Keyword Succeeds   ${VNF_MAX_TIME_TO_BE_READY}   ${VNF_POL_TIME}   Test SSH Connection   ${HEALED_VDU_MGMT_IP}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}
+    ${stdout}=   Execute Remote Command Check Rc Return Output   ${HEALED_VDU_MGMT_IP}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}   sudo ls ${VNF_MANUALSCALE_CLOUDINIT_FILE}
+    Log   ${stdout}
+    # Check If Remote File Exists   ${HEALED_VDU_MGMT_IP}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}   ${VNF_MANUALSCALE_DAY1_FILE}
 
 Update VIM Objects
     [Documentation]   Retrieve all VMs and volumes from the NS and stores them in VIM_VDUS and VIM_VOLUMES lists.