blob: df14de6a9cc9bc0d9a00dd9e21c22707b0202be3 [file] [log] [blame]
Joy Onyerikwu0c87b9e2018-04-25 10:15:06 -05001*** Settings ***
2
3Documentation Verify that the uCode can be updated on supported
4... Non-Volatile Memory Express (NVMe) adapters on RedHat.
5
6# TEST PARAMETERS:
7# OPENBMC_HOST The BMC host name or IP address.
8# OPENBMC_USERNAME The BMC user name.
9# OPENBMC_PASSWORD The BMC password.
10# OS_HOST The OS host name or IP address.
11# OS_USERNAME The OS user name.
12# OS_PASSWORD The OS Host password.
13# ADAPTER_UCODE_URL The url for the microcode file to be
14# loaded.
15# DEVICE NAMES A comma-seperated list containing the
16# names of devices to be upgraded
17# (e.g "nvme0n1,nvme1n1").
18#
19# Example:
20# robot -v ADAPTER_UCODE_URL:http://someurl.com/ucode/file.img
21# -v DEVICE_NAMES:nvme0n1,nvme1n1 adapter_ucode_update.robot
22
23Resource ../syslib/utils_install.robot
24
25Suite Setup Suite Setup Execution
26Test Teardown FFDC On Test Case Fail
27
28*** Variables ***
29
30
31*** Test Cases ***
32
33Load And Activate uCode On Adapters
34 [Documentation] Load and activate firmware on the given adapters.
35 [Tags] Load_And_Activate_uCode_On_Adapters
36
37 Rprintn
38 # Format parms.
39 # Ensure that nvme (pci-e storage utility) tool exists.
40 ${device_names}= Split String ${DEVICE_NAMES} ,
41 OS Execute Command yes | yum install nvme-cli
42 Tool Exist nvme
43 # Load and activate firmware on the devices.
44 :FOR ${device_name} in @{device_names}
45 \ Load And Activate Firmware On Device ${device_name}
46
47
48Reboot And Verify Code Update
49 [Documentation] Reboot the OS and verify that the firmware update
50 ... was successful.
51 [Tags] Reboot_And_Verify_Code_Update
52
53 Host Reboot
54 # Reboot and verify success
55 ${stdout} ${stderr} ${rc} OS Execute Command
56 ... nvme list | grep nvme0 | awk '{print $NF'}
57 Should Contain ${image_file_name} ${stdout}
58 ... msg=The code update was not successful.
59
60
61*** Keywords ***
62
63Load And Activate Firmware On Device
64 [Documentation] Load and activate firmware on device specified.
65 [Arguments] ${device_name} ${image_file_name}=${image_file_name}
66
67 # Description of argument(s):
68 # device_name The name of the NVMe device to be loaded
69 # and activated (e.g. "nvme0n1").
70 # image_file_name The name of the firmware image file.
71
72 :FOR ${slot_id} IN RANGE 1 4
73 \ Execute Commands On Slot
74 \ ... ${device_name} ${slot_id} ${image_file_name}
75
76
77Execute Commands On Slot
78 [Documentation] Execute load and activate commands on given slot.
79 [Arguments] ${device_name} ${slot_id}
80 ... ${image_file_name}=${image_file_name}
81
82 # Description of argument(s):
83 # device_name The name of the NVMe device to be loaded
84 # and activated (e.g. "nvme0n1").
85 # slot_id The NVMe device slot id to be activated
86 # (e.g. "0","1", etc.).
87 # image_file_name The name of the firmware image file.
88
89 ${stdout} ${stderr} ${rc} OS Execute Command
90 ... nvme fw-download /dev/${device_name} --fw=${image_file_name}
91 Should Contain ${stdout} Firmware download success
92 ... msg=${image_file_name} could not be loaded on slot:${slot}
93 ${stdout} ${stderr} ${rc} OS Execute Command
94 ... nvme fw-activate /dev/${device_name} -a 0 -s ${slot_id}
95 Should Contain ${stdout} Success activating firmware
96 ... msg=Could not activate slot:${slot_id} on ${device_name}.
97
98
99Suite Setup Execution
100 [Documentation] Setup parms used in suite and download ucode file.
101
102 ${stdout} ${stderr} ${rc}= OS Execute Command
103 ... wget ${ADAPTER_UCODE_URL}
104 ${image_dir_path_url} ${image_file_name}=
105 ... Split Path ${ADAPTER_UCODE_URL}
106 Set Global Variable ${image_file_name}