Move OS conig and install reosurce files to lib
Changes:
- Rename the resource file and moved to lib
- Update the import path where changes is required.
Tested:
- Ran -dryrun robot from sandbox to esnure linking is
not broken
Change-Id: Ibf9df37a150c62812f0e2046baa98b03fdf0278e
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/os_utils_config.robot b/lib/os_utils_config.robot
new file mode 100755
index 0000000..15ea017
--- /dev/null
+++ b/lib/os_utils_config.robot
@@ -0,0 +1,77 @@
+*** Settings ***
+Documentation Keywords for system data information.
+
+Resource ../syslib/utils_os.robot
+
+*** Variables ***
+
+*** Keywords ***
+Get PNOR Info
+ [Documentation] Get PNOR information.
+ ${version} ${stderr}= Execute Command pflash -r /dev/stdout -P VERSION
+ ... return_stderr=True
+ Should Be Empty ${stderr}
+ Log ${\n}version: ${version} console=yes
+ [Return] ${version}
+
+Get Inventory
+ [Documentation] Get system inventory.
+ ${inventory} ${stderr}= Execute Command lshw -short return_stderr=True
+ Should Be Empty ${stderr}
+ Log ${\n}inventory: ${inventory} console=yes
+ [Return] ${inventory}
+
+Get Memory Count
+ [Documentation] Get Memory Count.
+ ${memory_count} ${stderr}=
+ ... Execute Command lshw -short | grep memory | wc -l return_stderr=True
+ Should Be Empty ${stderr}
+ Log ${\n}memory count: ${memory_count} console=yes
+ [Return] ${memory_count}
+
+Verify Memory Count
+ [Documentation] Verify memory count.
+ [Arguments] ${expected_memory_count}
+ ${memory_count}= Get Memory Count
+ Log ${\n}memory count: ${memory_count} console=yes
+ Should Be Equal As Integers ${memory_count} ${expected_memory_count}
+ ... Error: memory count doesn't match expected count.
+
+Get Dimm Count
+ [Documentation] Get DIMM count.
+ ${dimm_count} ${stderr}= Execute Command lshw -short | grep DIMM | wc -l
+ ... return_stderr=True
+ Should Be Empty ${stderr}
+ Log ${\n}dimm_count: ${dimm_count} console=yes
+ [Return] ${dimm_count}
+
+Verify Dimm Count
+ [Documentation] Verify DIMM count.
+ [Arguments] ${expected_dimm_count}
+ ${dimm_count}= Get Dimm Count
+ Log ${\n}dimm_count: ${dimm_count} console=yes
+ Should Be Equal As Integers ${dimm_count} ${expected_dimm_count}
+ ... msg=Error: dimm count doesn't match expected count.
+
+Verify Opal-Prd Installed
+ [Documentation] Check whether opal-prd.service is running on OS.
+ ${output} ${stderr}= Execute Command systemctl status opal-prd.service
+ ... return_stderr=True
+ Should Be Empty ${stderr}
+ Log ${\n}${output} console=yes
+ Should Not Contain ${output} could not be found
+ ... msg=Error: opal-prd.service is not installed.
+
+Verify No Gard Records
+ [Documentation] Verify no gard records are present on OS.
+ ${output} ${stderr}= Execute Command opal-gard list
+ ... return_stderr=True
+ Should Be Empty ${stderr}
+ Should Contain ${output} No GARD entries to display
+
+Verify No Error Logs
+ [Documentation] Verify no error logs.
+ ${output} ${stderr}= Execute Command dmesg -xT -l emerg,alert,crit,err
+ ... return_stderr=True
+ Should Be Empty ${stderr}
+ Should Be Empty ${output}
diff --git a/lib/os_utils_install.robot b/lib/os_utils_install.robot
new file mode 100755
index 0000000..f0afe44
--- /dev/null
+++ b/lib/os_utils_install.robot
@@ -0,0 +1,105 @@
+***Settings***
+Documentation Keywords for system related tools installation.
+... For HTX refer to https://github.com/open-power/HTX
+
+
+Resource ../lib/boot_utils.robot
+Resource ../syslib/utils_os.robot
+
+***Keywords***
+
+Prep OS For HTX Installation
+ [Documentation] Prepare OS for HTX tool installation.
+
+ Boot To OS
+ ${status}= Run Keyword And Return Status Tool Exist htxcmdline
+
+ Return From Keyword If '${status}' == 'True'
+ ... HTX tool already installed.
+
+ # Downloads the package lists from the repositories and "update"
+ # them to get information on the newest versions of packages and
+ # their dependencies.
+ Log To Console \n Update package list.
+ OS Execute Command sudo apt-get update
+
+ # Download and install Git.
+ Log To Console \n Install Git.
+ OS Execute Command sudo apt-get -y install git
+
+
+Prep OS For OPAL PRD Installation
+ [Documentation] Prepare OS for OPAL PRD tool installation.
+
+ Boot To OS
+ ${status}= Run Keyword And Return Status Tool Exist opal-gard
+
+ Return From Keyword If '${status}' == 'True' ${False}
+
+
+ # Downloads the package lists from the repositories and "updates"
+ # them to get information on the newest versions of packages and
+ # their dependencies.
+ Log To Console \n Update package list.
+ OS Execute Command sudo apt-get update
+
+
+Setup HTX On OS
+ [Documentation] Download and install HTX exerciser tool from github.
+
+ # Download HTX source code from github.
+ Log To Console \n Download HTX source code from github.
+ OS Execute Command sudo git clone https://www.github.com/open-power/HTX
+
+ # Download and install pre-requisite packages before compiling HTX.
+ Log To Console \n Download pre-requisite packages before compiling HTX.
+ OS Execute Command
+ ... sudo apt-get -y install gcc make libncurses5 g++ libdapl-dev
+
+ # To fix ncurse compile warning and errors.
+ OS Execute Command
+ ... sudo apt-get -y install libncurses5-dev libncursesw5-dev
+
+ OS Execute Command
+ ... sudo apt-get -y install libibverbs-dev librdmacm-dev
+
+ # Compile HTX source code and install.
+ Log To Console \n Compile HTX source code.
+ OS Execute Command cd HTX && sudo make all
+
+ Log To Console \n Installed compiled HTX binaries.
+ OS Execute Command sudo make install
+
+
+Install HTX On RedHat
+ [Documentation] Download and install HTX on Red Hat.
+ [Arguments] ${htx_rpm}
+ # Description of argument(s):
+ # htx_rpm The url of the rqm file for htx
+ # (e.g. http://server.com/projects/htx_package.rpm )
+
+
+ ${stdout} ${stderr} ${rc} OS Execute Command
+ ... wget ${htx_rpm} ignore_err=1
+ Should Not Contain ${stderr} ERROR
+ @{str}= Split String From Right ${htx_rpm} / 1
+
+ # Remove the old version.
+ OS Execute Command rpm -e `rpm -qa | grep htx` ignore_err=1
+ OS Execute Command rpm -Uvh ${str[1]}
+ Tool Exist htxcmdline
+
+
+Setup Opal Prd On OS
+ [Documentation] Download and install opal prd tool.
+
+ # Download and install PRD packages.
+ OS Execute Command sudo apt-get install opal-prd
+ OS Execute Command sudo apt-get install opal-utils
+
+ # Reboot OS to activate installation.
+ Host Reboot
+
+ # Verify opal prd installation working.
+ ${out} ${stderr} ${rc}= OS Execute Command opal-gard list
+ Should Contain ${out} No GARD entries to display