Add test cases for doing N, N-1, and N+1 code updates
Resolves openbmc/openbmc-test-automation#818
Change-Id: I4df01ecda6a20a9dc7ff07c59db4586e9bf8509a
Signed-off-by: Charles Paul Hofer <Charles.Hofer@ibm.com>
diff --git a/extended/code_update/host_multi_code_update.robot b/extended/code_update/host_multi_code_update.robot
new file mode 100644
index 0000000..5366265
--- /dev/null
+++ b/extended/code_update/host_multi_code_update.robot
@@ -0,0 +1,65 @@
+*** Settings ***
+Documentation Verify that the host boots between code updates of different
+... PNOR version. Verify with N, the current version, downgrade
+... and verify with N-1, update and verify N again, and finally
+... update and verify with N+1.
+
+Library ../../lib/code_update_utils.py
+Variables ../../data/variables.py
+Resource ../../lib/boot_utils.robot
+Resource ../../lib/code_update_utils.robot
+Resource ../../lib/openbmc_ffdc.robot
+
+Suite Setup Suite Setup Execution
+
+Test Teardown FFDC On Test Case Fail
+
+*** Variables ***
+
+${QUIET} ${1}
+${IMAGE_FILE_PATH} ${EMPTY}
+${N_MINUS_ONE_IMAGE_FILE_PATH} ${EMPTY}
+${N_PLUS_ONE_IMAGE_FILE_PATH} ${EMPTY}
+
+*** Test Cases ***
+
+Host_Multi Code Update
+ [Documentation] Do four code updates in a row. Update to N, N-1, N, and
+ ... then N+1.
+ [Tags] Host_Mult_Code_Update
+ [Template] Code Update And Power On Host
+
+ # Image File Path
+ ${IMAGE_FILE_PATH}
+ ${N_MINUS_ONE_IMAGE_FILE_PATH}
+ ${IMAGE_FILE_PATH}
+ ${N_PLUS_ONE_IMAGE_FILE_PATH}
+
+
+*** Keywords ***
+
+Suite Setup Execution
+ [Documentation] Do test suite setup tasks.
+
+ Should Not Be Empty ${IMAGE_FILE_PATH} msg=Must set IMAGE_FILE_PATH.
+ Should Not Be Empty ${N_MINUS_ONE_IMAGE_FILE_PATH}
+ ... msg=Must set N_MINUS_ONE_IMAGE_FILE_PATH.
+ Should Not Be Empty ${N_PLUS_ONE_IMAGE_FILE_PATH}
+ ... msg=N_PLUS_ONE_IMAGE_FILE_PATH.
+ Should Not Be Empty ${OS_HOST} msg=Must set OS_HOST.
+ Should Not Be Empty ${OS_USERNAME} msg=Must set OS_USERNAME.
+ Should Not Be Empty ${OS_PASSWORD} msg=Must set OS_PASSWORD.
+
+
+Code Update And Power On Host
+ [Documentation] Shutdown the host, update to the given image, and then
+ ... verify that the host is able to power on.
+ [Arguments] ${image_file_path}
+
+ # Description of argument(s):
+ # image_file_path Path to the host image file.
+
+ REST Power Off stack_mode=skip quiet=${1}
+ Delete All PNOR Images
+ Upload And Activate Image ${image_file_path}
+ REST Power On
diff --git a/lib/resource.txt b/lib/resource.txt
index 34db7a0..4dc06ea 100755
--- a/lib/resource.txt
+++ b/lib/resource.txt
@@ -58,6 +58,10 @@
${BAD_IMAGES_DIR_PATH} ${EMPTY}
${SKIP_UPDATE_IF_ACTIVE} false
+# Parameters for doing N-1 and N+1 code updates.
+${N_MINUS_ONE_IMAGE_FILE_PATH} ${EMPTY}
+${N_PLUS_ONE_IMAGE_FILE_PATH} ${EMPTY}
+
# The caller must set this to the string "true" in order to delete images. The
# code is picky.
${DELETE_OLD_PNOR_IMAGES} false
diff --git a/tools/generate_argumentfile.sh b/tools/generate_argumentfile.sh
index 81ac987..9b1f02c 100755
--- a/tools/generate_argumentfile.sh
+++ b/tools/generate_argumentfile.sh
@@ -30,6 +30,8 @@
echo "--variable PNOR_IMAGE_FILE_PATH:$PNOR_IMAGE_FILE_PATH" >> $ARG_FILE
echo "--variable BMC_IMAGE_FILE_PATH:$BMC_IMAGE_FILE_PATH" >> $ARG_FILE
echo "--variable BAD_IMAGES_DIR_PATH:$BAD_IMAGES_DIR_PATH" >> $ARG_FILE
+echo "--variable N_MINUS_ONE_IMAGE_FILE_PATH:$N_MINUS_ONE_IMAGE_FILE_PATH" >> $ARG_FILE
+echo "--variable N_PLUS_ONE_IMAGE_FILE_PATH:$N_PLUS_ONE_IMAGE_FILE_PATH" >> $ARG_FILE
echo "--variable SKIP_UPDATE_IF_ACTIVE:$SKIP_UPDATE_IF_ACTIVE" >> $ARG_FILE
echo "--variable DELETE_OLD_PNOR_IMAGES:$DELETE_OLD_PNOR_IMAGES" >> $ARG_FILE
echo "--variable DELETE_OLD_GUARD_FILE:$DELETE_OLD_GUARD_FILE" >> $ARG_FILE