Add test case for DeleteAll method in software

Resolves openbmc/openbmc-test-automation#995

Change-Id: I7b0df8d24b9361088be8fd26343e9de24f0240f4
Signed-off-by: Charles Paul Hofer <Charles.Hofer@ibm.com>
diff --git a/extended/code_update/bmc_code_update.robot b/extended/code_update/bmc_code_update.robot
index 40ed966..4fb77db 100644
--- a/extended/code_update/bmc_code_update.robot
+++ b/extended/code_update/bmc_code_update.robot
@@ -78,6 +78,18 @@
     Priority          ${255}
 
 
+Delete All Non Running BMC Images
+    [Documentation]  Delete all non running BMC images.
+    [Tags]  Delete_All_Non_Running_BMC_Images
+
+    ${version_id}=  Upload And Activate Image  ${ALTERNATE_IMAGE_FILE_PATH}
+    Delete All Non Running BMC Images
+
+    ${software_ids}=  Get Software Objects Id
+    ...  version_type=${VERSION_PURPOSE_BMC}
+    Should Not Contain  ${software_ids}  ${version_id}
+
+
 *** Keywords ***
 
 Temporarily Set BMC Attribute
diff --git a/lib/code_update_utils.robot b/lib/code_update_utils.robot
index 2815b65..e3682cf 100644
--- a/lib/code_update_utils.robot
+++ b/lib/code_update_utils.robot
@@ -323,6 +323,14 @@
     ...  [ ! -d "/tmp/images/${image_id}" ]
 
 
+Delete All Non Running BMC Images
+    [Documentation]  Delete all BMC images that are not running on the BMC.
+
+    @{datalist}=  Create List
+    ${data}=  Create Dictionary  data=@{datalist}
+    Call Method  ${SOFTWARE_VERSION_URI}  DeleteAll  data=${data}
+
+
 Check Error And Collect FFDC
     [Documentation]  Collect FFDC if error log exists.