From: Alexandru Avadanii Date: Thu, 23 Apr 2020 17:45:39 +0000 (+0200) Subject: hardware: bios_version rework without dmidecode X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=7e118f63d265509f870cd4f29abc24d11a3d722b;p=validation.git hardware: bios_version rework without dmidecode Instead of relying on `dmidecode` for reading and parsing various machine information that we test using the `hardware` layer testcases, read and parse the same information directly from sysfs: - product name by simply dumping: /sys/class/dmi/id/product_name - BIOS revision number (not to be confused with BIOS version number which is already available via sysfs /sys/class/dmi/...) by parsing /sys/firmware/dmi/tables/DMI according to the SMBIOS Reference Specification [1]; This mechanism assumes the target nodes support SMBIOS. While at it, relax the matching condition for disk device names in `lsblk` output, as well as the number of processors expected in `lscpu` output; make the block device name regexp configurable via a new variable named `blk_dev_regexp` in tests/variables.yaml. JIRA: VAL-76 JIRA: VAL-110 [1] https://www.dmtf.org/sites/default/files/standards/documents/ DSP0134_2.7.1.pdf Change-Id: Iaa3be16e7f56aa672304861c57c659f3cfb19f4e Signed-off-by: Alexandru Avadanii --- diff --git a/tests/hardware/bios_version/bios_version_dell.robot b/tests/hardware/bios_version/bios_version_dell.robot index 682e596..acbb5bc 100644 --- a/tests/hardware/bios_version/bios_version_dell.robot +++ b/tests/hardware/bios_version/bios_version_dell.robot @@ -27,21 +27,22 @@ Suite Teardown Close All Connections #${HOST} localhost #${USERNAME} localadmin #${SYSINFO} PowerEdge R740xd -#${BIOS_REVISION} 1.3 +#${BIOS_REVISION} 1.3 +#${BLK_DEV_REGEXP} ([sh]d[a-z]+|nvme)[0-9]+ ${SSH_KEYFILE} /root/.ssh/id_rsa ${LOG} ${LOG_PATH}${/}${SUITE_NAME.replace(' ','_')}.log *** Test Cases *** Get HW Details [Documentation] Verify HW details - Start Command dmidecode | grep -A3 '^System Information' sudo=True + Start Command cat /sys/class/dmi/id/product_name ${stdout}= Read Command Output Append To File ${LOG} ${stdout}${\n} Should Contain ${stdout} ${SYSINFO} Verify BIOS Revision [Documentation] Verify BIOS Revision - Start Command dmidecode | more | grep 'BIOS Revision' sudo=True + Start Command printf "BIOS Revision: %u.%u" $(sudo od -t u1 -j 20 -N 2 -A none /sys/firmware/dmi/tables/DMI) ${stdout}= Read Command Output Append To File ${LOG} ${stdout}${\n} Should Contain ${stdout} BIOS Revision: ${BIOS_REVISION} @@ -50,16 +51,15 @@ Check NUMA and CPU [Documentation] NUMAs and CPU components ${output}= Execute Command lscpu Append To File ${LOG} ${output}${\n} - Should Contain ${output} CPU(s): 88 + Should Match Regexp ${output} CPU\\(s\\):\\s+\\d+ Verify Block Devices [Documentation] Reads the sysfs filesystem ${output}= Execute Command lsblk Append To File ${LOG} ${output}${\n} - Should Contain ${output} sdg4 + Should Match Regexp ${output} ${BLK_DEV_REGEXP} *** Keywords *** Open Connection And Log In - Open Connection ${HOST} - Login With Public Key ${USERNAME} ${SSH_KEYFILE} - + Open Connection ${HOST} + Login With Public Key ${USERNAME} ${SSH_KEYFILE} diff --git a/tests/variables.yaml b/tests/variables.yaml index 4a68a51..7e10871 100644 --- a/tests/variables.yaml +++ b/tests/variables.yaml @@ -40,6 +40,7 @@ ssh_keyfile: /root/.ssh/id_rsa # Identity file for authentication ### Input variables for bios_version_dell.robot sysinfo: PowerEdge R740xd bios_revision: 1.3 +blk_dev_regexp: ([sh]d[a-z]+|nvme)[0-9]+ ### Input variables for bare metal hardware test dell or hp base_uri: https://192.168.XX.XX/redfish/v1/ # OOB Redfish link address