[VOL-4320] OpenOnuAdapter sw-upgrade extend test suite by further (abort) tests
Change-Id: I23a78bc66bcfeb3b5d1c194ca117c2b1192a3c40
diff --git a/libraries/voltctl.robot b/libraries/voltctl.robot
index 2814990..c9f5ca3 100755
--- a/libraries/voltctl.robot
+++ b/libraries/voltctl.robot
@@ -741,6 +741,18 @@
... Append To List ${serial_numbers} ${onu_sn}
END
+Build ONU Device Id List
+ [Arguments] ${device_ids} ${olt_serial_number}=${EMPTY} ${num_onus}=${num_all_onus}
+ [Documentation] Appends all ONU Device IDs for the given OLT to the ${serial_numbers} list
+ FOR ${INDEX} IN RANGE 0 ${num_onus}
+ ${onu_device_id}= Get Device ID From SN ${hosts.src[${INDEX}]['onu']}
+ # skip if we have already append this ONU
+ ${onu_id}= Get Index From List ${device_ids} ${onu_device_id}
+ Continue For Loop If -1 != ${onu_id}
+ Run Keyword IF "${olt_serial_number}"=="${hosts.src[${INDEX}].olt}" or "${olt_serial_number}"=="${EMPTY}"
+ ... Append To List ${device_ids} ${onu_device_id}
+ END
+
Get SN From Device ID
[Arguments] ${device_id}
[Documentation] Gets the device id by matching for ${device_id}
@@ -871,25 +883,26 @@
[Arguments] ${data} ${image_version} ${dev_id} ${download_state} ${expected_reason} ${image_status}
${jsondata}= To Json ${data}
${length}= Get Length ${jsondata}
- Should Be Equal As Integers ${length} 1 No record found for ${dev_id} to validate device image
- ${value}= Get From List ${jsondata} 0
- Log ${value}
- ${deviceId}= Get From Dictionary ${value} deviceId
- Should Be Equal '${deviceId}' '${dev_id}' No match found for ${dev_id} to validate device image
- ... values=False
- ${imageState}= Get From Dictionary ${value} imageState
- ${version}= Get From Dictionary ${imageState} version
- ${dwlState}= Get From Dictionary ${imageState} downloadState
- ${reason}= Get From Dictionary ${imageState} reason
- ${imgStatus}= Get From Dictionary ${imageState} imageState
- Should Be Equal '${version}' '${image_version}' Device ${dev_id}: '${version}' != '${image_version}'
- ... values=False
- Should Be Equal '${dwlState}' '${download_state}' Device ${dev_id}: '${dwlState}' != '${download_state}'
- ... values=False
- Should Be Equal '${reason}' '${expected_reason}' Device ${dev_id}: '${reason}' != '${expected_reason}'
- ... values=False
- Should Be Equal '${imgStatus}' '${image_status}' Device ${dev_id}: '${imgStatus}' != '${image_status}'
- ... values=False
+ Should Not Be Equal As Integers ${length} 0 No record to validate device image
+ FOR ${J} IN RANGE 0 ${length}
+ ${value}= Get From List ${jsondata} ${J}
+ Log ${value}
+ ${deviceId}= Get From Dictionary ${value} deviceId
+ Should Contain ${dev_id} ${deviceId} No match found for ${deviceId} to validate device image!
+ ${imageState}= Get From Dictionary ${value} imageState
+ ${version}= Get From Dictionary ${imageState} version
+ ${dwlState}= Get From Dictionary ${imageState} downloadState
+ ${reason}= Get From Dictionary ${imageState} reason
+ ${imgStatus}= Get From Dictionary ${imageState} imageState
+ Should Be Equal '${version}' '${image_version}' Device ${dev_id}: '${version}' != '${image_version}'
+ ... values=False
+ Should Be Equal '${dwlState}' '${download_state}' Device ${dev_id}: '${dwlState}' != '${download_state}'
+ ... values=False
+ Should Be Equal '${reason}' '${expected_reason}' Device ${dev_id}: '${reason}' != '${expected_reason}'
+ ... values=False
+ Should Be Equal '${imgStatus}' '${image_status}' Device ${dev_id}: '${imgStatus}' != '${image_status}'
+ ... values=False
+ END
Download ONU Device Image
[Documentation] Downloads the given ONU software image
@@ -935,6 +948,14 @@
... voltctl -c ${VOLTCTL_CONFIG} device onuimage abort ${ver} ${id} -o json
Log ${output}
+Remove Adapter Image from ONUs
+ [Documentation] Aborts the upgrade processing for a given ONU software image and thus removes the image from adapter
+ ... for the passed ONUs
+ [Arguments] ${ver} ${onu_id_list}
+ FOR ${onu_device_id} IN @{onu_id_list}
+ Remove Adapter Image ${ver} ${onu_device_id}
+ END
+
Verify ONU Device Image Status
[Documentation] Verfies the ONU device image state
[Arguments] ${image_version} ${dev_id} ${download_state} ${expected_reason} ${image_state}