| Joy Onyerikwu | 268ed4e | 2018-02-07 12:33:39 -0600 | [diff] [blame] | 1 | *** Settings *** | 
|  | 2 | Documentation  Update internal storage devices uCode for solid-state drives | 
|  | 3 | ...  (SSDs) and hard disk drives (HDDs). | 
|  | 4 | # TEST REQUIREMENTS: | 
|  | 5 | # 1. Firmware file must be suffixed with an underscore, followed by the size | 
|  | 6 | # range it supports in terabytes, e.g: if IBM_5100_MJ06.bin supports 960 GB to | 
|  | 7 | # 1.92TB then change the file name to IBM_5100_MJ06_.96-1.92T.bin | 
|  | 8 | # 2. uCode files on OS should be in root/SSD_HDDucode and | 
|  | 9 | # supported extensions are ".lod" (for HDDs) and ".bin" (for SSDS). | 
|  | 10 |  | 
|  | 11 | # TEST PARAMETERS: | 
|  | 12 | #   OPENBMC_HOST                The BMC host name or IP address. | 
|  | 13 | #   OPENBMC_PASSWORD            The BMC password. | 
|  | 14 | #   OPENBMC_USERNAME            The BMC user name. | 
|  | 15 | #   OS_HOST                     The OS host name or IP address. | 
|  | 16 | #   OS_USERNAME        .        The OS Host user name. | 
|  | 17 | #   OS_PASSWORD        .        The OS Host password. | 
|  | 18 |  | 
|  | 19 | Resource            ../syslib/utils_os.robot | 
|  | 20 | Library             ../lib/utils_files.py | 
|  | 21 | Library             ../lib/firmware_utils.py | 
|  | 22 | Library             ../lib/bmc_ssh_utils.py | 
|  | 23 |  | 
|  | 24 | Test Setup          Test Setup Execution | 
|  | 25 | Test Teardown       FFDC On Test Case Fail | 
|  | 26 |  | 
|  | 27 |  | 
|  | 28 | *** Variables *** | 
|  | 29 |  | 
|  | 30 |  | 
|  | 31 | *** Test Cases *** | 
|  | 32 |  | 
|  | 33 | Perform Update On Hard Disks | 
|  | 34 | [Documentation]  Perform update on hard disks. | 
|  | 35 | [Tags]  Perform_Update_On_Hard_Disks | 
|  | 36 | Update Hard Disk  ${sdb_info}  sdb | 
|  | 37 | Update Hard Disk  ${sda_info}  sda | 
|  | 38 |  | 
|  | 39 |  | 
|  | 40 | Reboot OS And Verify uCode Update | 
|  | 41 | [Documentation]  Reboot the OS and verify that the update was successful. | 
|  | 42 | [Tags]  Reboot_OS_And_Verify_uCode_Update | 
|  | 43 | Host Reboot | 
|  | 44 | &{sdb_post_update}=  Get Hard Disk Info  /dev/sdb | 
|  | 45 | &{sda_post_update}=  Get Hard Disk Info  /dev/sda | 
|  | 46 | Should Not Be Equal  ${sda_info['firmware_revision']}  ${sda_post_update['firmware_revision']} | 
|  | 47 | ...  msg=Failed sda uCode update - firmware revision values was unchanged. | 
|  | 48 | Log  sda uCode update complete. | 
|  | 49 | Should Not Be Equal  ${sdb_info['firmware_revision']}  ${sdb_post_update['firmware_revision']} | 
|  | 50 | ...  msg=Failed sdb uCode update - firmware revision values was unchanged. | 
|  | 51 | Log  sdb uCode update complete. | 
|  | 52 |  | 
|  | 53 |  | 
|  | 54 | *** Keywords *** | 
|  | 55 |  | 
|  | 56 | Test Setup Execution | 
|  | 57 | [Documentation]  Get info for hard disks and set suite variables. | 
|  | 58 | &{sdb_info}=  Get Hard Disk Info  /dev/sdb | 
|  | 59 | &{sda_info}=  Get Hard Disk Info  /dev/sda | 
|  | 60 | Log  ${sdb_info} | 
|  | 61 | Log  ${sda_info} | 
|  | 62 | Set Suite Variable  &{sdb_info} | 
|  | 63 | Set Suite Variable  &{sda_info} | 
|  | 64 |  | 
|  | 65 |  | 
|  | 66 | Update Hard Disk | 
|  | 67 | [Documentation]  Update hard disk. | 
|  | 68 | [Arguments]  ${hard_disk_info}  ${device_name} | 
|  | 69 |  | 
|  | 70 | # Description of argument(s): | 
|  | 71 | # hard_disk_info  A dictionary of firwmare information for the device | 
|  | 72 | #                 which can be obtained via a call to | 
|  | 73 | #                 'Get Hard Disk Info'. | 
|  | 74 |  | 
|  | 75 | # name            The name of the hard disk, e.g: sdb, sda. | 
|  | 76 |  | 
|  | 77 | ${ucode_dir_name}=  Set Variable  SSD_HDDucode | 
|  | 78 | ${ext}=  Set Variable If | 
|  | 79 | ...  "${hard_disk_info['ro']}" == "0"  bin | 
|  | 80 | ...  "${hard_disk_info['ro']}" == "1"  lod | 
|  | 81 | ${file_names}  ${stderr}  ${rc}=  OS Execute Command | 
|  | 82 | ...  cd /${OS_USERNAME}/${ucode_dir_name}/ && ls *.${ext} | 
|  | 83 | ${file_list}=  Split String  ${file_names} | 
|  | 84 | ${ucode_file}=  Find uCode File | 
|  | 85 | ...  ${file_list}  ${hard_disk_info['size'][:-1]} | 
|  | 86 | ${disk_update}=  Catenate  hdparm --yes-i-know-what-i-am-doing | 
|  | 87 | ...  --please-destroy-my-drive --fwdownload | 
|  | 88 | ...  /${OS_USERNAME}/${ucode_dir_name}/${ucode_file} /dev/${device_name} | 
|  | 89 | OS Execute Command  ${disk_update} | 
|  | 90 |  | 
|  | 91 | Find uCode File | 
|  | 92 | [Documentation]  Return uCode file that corresponds to device size. | 
|  | 93 | [Arguments]  ${file_names}  ${device_size} | 
|  | 94 |  | 
|  | 95 | # Description of argument(s): | 
|  | 96 | # file_list          A list of available ucode file. | 
|  | 97 | # size               The size of the hard disk. | 
|  | 98 | # For example, given the following input: | 
|  | 99 | # | 
|  | 100 | # file_list: | 
|  | 101 | #  file_list[0]:   IBM_5100_MJ06_.96-1.92T.bin | 
|  | 102 | #  file_list[1]:   IBM_5100_MK06_2-3.84T.bin | 
|  | 103 | # device_size:     1.8T | 
|  | 104 | # This keyword will return "IBM_5100_MJ06_.96-1.92T.bin". | 
|  | 105 |  | 
|  | 106 | :FOR  ${file_name}  IN  @{file_names} | 
|  | 107 | \  ${range_string}=  Remove String Using Regexp  ${file_name}  .*_  T.* | 
|  | 108 | \  ${range}=  Split String  ${range_string}  - | 
|  | 109 | \  Return From Keyword If | 
|  | 110 | ...  "${device_size}" >= "${range[0]}" and "${device_size}" <= "${range[1]}" | 
|  | 111 | ...  ${file_name} | 
|  | 112 |  | 
|  | 113 | Fail  msg=Failed to find uCode file in list: ${file_names}. | 
|  | 114 | [Return]  ${file_name} |