Adapt sw upgrade status in tests

Change-Id: I884b042fae357cb15c7dbb472bce6fc389ae97b0
diff --git a/libraries/voltctl.robot b/libraries/voltctl.robot
index 629259b..f0e873a 100755
--- a/libraries/voltctl.robot
+++ b/libraries/voltctl.robot
@@ -871,7 +871,7 @@
     ...    voltctl -c ${VOLTCTL_CONFIG} device onuimage activate ${ver} ${commit} ${id} -o json
     Log    ${output}
     Should Be Equal As Integers    ${rc}    0
-    Validate ONU Device Image    ${output}    ${ver}    ${id}    DOWNLOAD_STARTED    NO_ERROR    IMAGE_ACTIVATING
+    Validate ONU Device Image    ${output}    ${ver}    ${id}    DOWNLOAD_SUCCEEDED    NO_ERROR    IMAGE_ACTIVATING
 
 Commit ONU Device Image
     [Documentation]    Commits the given ONU software image
@@ -880,7 +880,7 @@
     ...    voltctl -c ${VOLTCTL_CONFIG} device onuimage commit ${ver} ${id} -o json
     Log    ${output}
     Should Be Equal As Integers    ${rc}    0
-    Validate ONU Device Image    ${output}    ${ver}    ${id}    DOWNLOAD_STARTED    NO_ERROR    IMAGE_COMMITTING
+    Validate ONU Device Image    ${output}    ${ver}    ${id}    DOWNLOAD_SUCCEEDED    NO_ERROR    IMAGE_COMMITTING
 
 Abort ONU Device Image
     [Documentation]    Aborts the given ONU software image
@@ -891,6 +891,13 @@
     Should Be Equal As Integers    ${rc}    0
     Validate ONU Device Image    ${output}    ${ver}    ${id}    ${download_state}    ${expected_reason}    ${image_state}
 
+Remove Adapter Image
+    [Documentation]    Aborts the upgrade processing for a given ONU software image and thus removes the image from adapter
+    [Arguments]    ${ver}    ${id}
+    ${rc}    ${output}=    Run and Return Rc and Output
+    ...    voltctl -c ${VOLTCTL_CONFIG} device onuimage abort ${ver} ${id} -o json
+    Log    ${output}
+
 Verify ONU Device Image Status
     [Documentation]    Verfies the ONU device image state
     [Arguments]    ${image_version}    ${dev_id}    ${download_state}    ${expected_reason}    ${image_state}
diff --git a/tests/software-upgrades/ONU_Upgrade.robot b/tests/software-upgrades/ONU_Upgrade.robot
index 39c952e..28d5a0b 100755
--- a/tests/software-upgrades/ONU_Upgrade.robot
+++ b/tests/software-upgrades/ONU_Upgrade.robot
@@ -303,6 +303,8 @@
         Wait Until Keyword Succeeds    ${timeout}    2s    Verify ONU Device Image On BBSim    ${NAMESPACE}    ${bbsim_pod}
         ...    ${src['onu']}    software_image_committed
         Wait Until Keyword Succeeds    ${timeout}    5s    Perform Sanity Test     ${suppressaddsubscriber}
+        # to remove the image again from adapter, Multi-Onu tests could be restructured - not yet in focus
+        Remove Adapter Image    ${image_version}    ${onu_device_id}
     END
 
 Test ONU Upgrade Download Failure Per OLT
@@ -322,6 +324,8 @@
         Wait Until Keyword Succeeds    ${timeout}    2s    Verify ONU Device Image Status    INVALID_IMAGE
         ...    ${onu_device_id}    ${dwlstate}    ${reason}    ${imgstate}
         Wait Until Keyword Succeeds    ${timeout}    5s    Perform Sanity Test     ${suppressaddsubscriber}
+        # to remove the image again from adapter, Multi-Onu tests could be restructured - not yet in focus
+        Remove Adapter Image    INVALID_IMAGE    ${onu_device_id}
     END
 
 Test ONU Upgrade Download Abort Per OLT
@@ -336,9 +340,9 @@
         Download ONU Device Image    ${image_version}    ${url}    ${image_vendor}
         ...    ${image_activate_on_success}    ${image_commit_on_success}    ${image_crc}    ${onu_device_id}
         Abort ONU Device Image    ${image_version}    ${onu_device_id}
-        ...    DOWNLOAD_CANCELLED    CANCELLED_ON_REQUEST    IMAGE_DOWNLOADING
+        ...    DOWNLOAD_STARTED    CANCELLED_ON_REQUEST    IMAGE_DOWNLOADING
         Wait Until Keyword Succeeds    ${timeout}    2s    Verify ONU Device Image Status    ${image_version}
-        ...    ${onu_device_id}    DOWNLOAD_CANCELLED    CANCELLED_ON_REQUEST    IMAGE_DOWNLOADING
+        ...    ${onu_device_id}    DOWNLOAD_CANCELLED    CANCELLED_ON_REQUEST    IMAGE_UNKNOWN
         #   !!!    Expected is image is not visible in list   !!!
         Wait Until Keyword Succeeds    ${timeout}    2s    Verify ONU Device Image List    ${onu_device_id}
         ...    ${image_version}    False    False    True
@@ -360,9 +364,9 @@
         ...    ${onu_device_id}    DOWNLOAD_SUCCEEDED    NO_ERROR    IMAGE_INACTIVE
         Activate ONU Device Image    ${image_version}    true    ${onu_device_id}
         Abort ONU Device Image    ${image_version}    ${onu_device_id}
-        ...    DOWNLOAD_CANCELLED    CANCELLED_ON_REQUEST    IMAGE_ACTIVATING
+        ...    DOWNLOAD_SUCCEEDED    CANCELLED_ON_REQUEST    IMAGE_ACTIVATING
         Wait Until Keyword Succeeds    ${timeout}    2s    Verify ONU Device Image Status    ${image_version}
-        ...    ${onu_device_id}    DOWNLOAD_CANCELLED    CANCELLED_ON_REQUEST    IMAGE_ACTIVATING
+        ...    ${onu_device_id}    DOWNLOAD_SUCCEEDED    CANCELLED_ON_REQUEST    IMAGE_ACTIVATION_ABORTED
         #   !!!    Expected is image is not visible in list   !!!
         Wait Until Keyword Succeeds    ${timeout}    2s    Verify ONU Device Image List    ${onu_device_id}
         ...    ${image_version}    False    True    True