fix software image as downloaded

Expected and needed change according [VOL-4302] (BBSIM)

Change-Id: Ib6006b4fe4177b534bae2d0cec0350c251d2b416
diff --git a/libraries/voltctl.robot b/libraries/voltctl.robot
index c9f5ca3..b4bd8d2 100755
--- a/libraries/voltctl.robot
+++ b/libraries/voltctl.robot
@@ -457,8 +457,8 @@
     ...    --format '{{gosince .LastCommunication}}'
     ${rc}    ${output}=    Run and Return Rc and Output    ${cmd}
     Should Be Equal As Integers    ${rc}    0
-    ${lastcomm}= 	Convert Time 	${output}
-    ${validduration}= 	Convert Time 	${validation_duration}
+    ${lastcomm}=    Convert Time    ${output}
+    ${validduration}=    Convert Time    ${validation_duration}
     Should Be True    ${lastcomm}<=${validduration}
 
 Get Onu Image List
@@ -968,7 +968,7 @@
 
 Verify ONU Device Image List
     [Documentation]    Verfies the ONU device image list
-    [Arguments]    ${dev_id}    ${image_version}    ${committed}    ${activated}    ${valid}
+    [Arguments]    ${dev_id}    ${image_version}    ${committed}    ${activated}    ${valid}    ${image_should_not_in_list}=False
     ${rc}    ${output}=    Run and Return Rc and Output
     ...    voltctl -c ${VOLTCTL_CONFIG} device onuimage list ${dev_id} -o json
     Should Be Equal As Integers    ${rc}    0
@@ -985,13 +985,15 @@
         ${matched}=    Set Variable If    '${version}' == '${image_version}'    True    False
         Exit For Loop If    ${matched}
     END
-    Should Be True    ${matched}     No ONU Image found with Version ${image_version}
-    Should Be Equal    '${isCommited}'    '${committed}'    Device ${dev_id}: '${isCommited}' != '${committed}'
-    ...    values=False
-    Should Be Equal    '${isActive}'    '${activated}'    Device ${dev_id}: '${isActive}' != '${activated}'
-    ...    values=False
-    Should Be Equal    '${isValid}'    '${valid}'    Device ${dev_id}: '${isValid}' != '${valid}'
-    ...    values=False
+    Run Keyword If    ${image_should_not_in_list}
+    ...            Should Not Be True    ${matched}    ONU Image found unexpectedly with Version ${image_version}
+    ...    ELSE    Should Be True    ${matched}    No ONU Image found with Version ${image_version}
+    Run Keyword If    ${matched}    Should Be Equal    '${isCommited}'    '${committed}'
+    ...    Device ${dev_id}: '${isCommited}' != '${committed}'    values=False
+    Run Keyword If    ${matched}    Should Be Equal    '${isActive}'    '${activated}'
+    ...    Device ${dev_id}: '${isActive}' != '${activated}'    values=False
+    Run Keyword If    ${matched}    Should Be Equal    '${isValid}'    '${valid}'
+    ...    Device ${dev_id}: '${isValid}' != '${valid}'    values=False
 
 # pm-data relevant keywords
 Read Default Interval From Pmconfig
diff --git a/tests/software-upgrades/ONU_Upgrade.robot b/tests/software-upgrades/ONU_Upgrade.robot
index 0f98522..99be3ec 100755
--- a/tests/software-upgrades/ONU_Upgrade.robot
+++ b/tests/software-upgrades/ONU_Upgrade.robot
@@ -534,7 +534,7 @@
         ...    ${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
+        ...    ${image_version}    False    False    False    image_should_not_in_list=True
         Wait Until Keyword Succeeds    ${timeout}    5s    Perform Sanity Test     ${suppressaddsubscriber}
     END
 
@@ -556,7 +556,6 @@
         ...    DOWNLOAD_SUCCEEDED    CANCELLED_ON_REQUEST    IMAGE_INACTIVE
         Wait Until Keyword Succeeds    ${timeout}    2s    Verify ONU Device Image Status    ${image_version}
         ...    ${onu_device_id}    DOWNLOAD_SUCCEEDED    CANCELLED_ON_REQUEST    IMAGE_INACTIVE
-        #   !!!    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
         Wait Until Keyword Succeeds    ${timeout}    5s    Perform Sanity Test     ${suppressaddsubscriber}
@@ -581,7 +580,6 @@
         ...    DOWNLOAD_SUCCEEDED    CANCELLED_ON_REQUEST    IMAGE_ACTIVATING
         Wait Until Keyword Succeeds    ${timeout}    2s    Verify ONU Device Image Status    ${image_version}
         ...    ${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
         Wait Until Keyword Succeeds    ${timeout}    5s    Perform Sanity Test     ${suppressaddsubscriber}
@@ -608,7 +606,6 @@
         ...    DOWNLOAD_SUCCEEDED    CANCELLED_ON_REQUEST    IMAGE_ACTIVE
         Wait Until Keyword Succeeds    ${timeout}    2s    Verify ONU Device Image Status    ${image_version}
         ...    ${onu_device_id}    DOWNLOAD_SUCCEEDED    CANCELLED_ON_REQUEST    IMAGE_ACTIVE
-        #   !!!    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
         Wait Until Keyword Succeeds    ${timeout}    5s    Perform Sanity Test     ${suppressaddsubscriber}
@@ -648,7 +645,6 @@
         ...    DOWNLOAD_UNKNOWN    NO_ERROR    IMAGE_UNKNOWN
         Wait Until Keyword Succeeds    ${timeout}    2s    Verify ONU Device Image Status    ${image_version}
         ...    ${onu_device_id}    DOWNLOAD_UNKNOWN    NO_ERROR    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}    True    True    True
         Wait Until Keyword Succeeds    ${timeout}    5s    Perform Sanity Test     ${suppressaddsubscriber}