1***Settings***
2Documentation      Keywords for system related tools installation.
3...                For HTX refer to https://github.com/open-power/HTX
4
5
6Resource     ../lib/boot_utils.robot
7Resource     ../lib/os_utilities.robot
8
9***Keywords***
10
11Prep OS For HTX Installation
12    [Documentation]  Prepare OS for HTX tool installation.
13
14    Boot To OS
15    ${status}=  Run Keyword And Return Status  Tool Exist  htxcmdline
16
17    Return From Keyword If  '${status}' == 'True'
18    ...  HTX tool already installed.
19
20    # Downloads the package lists from the repositories and "update"
21    # them to get information on the newest versions of packages and
22    # their dependencies.
23    Log To Console  \n Update package list.
24    OS Execute Command  sudo apt-get update
25
26    # Download and install Git.
27    Log To Console  \n Install Git.
28    OS Execute Command  sudo apt-get -y install git
29
30
31Prep OS For OPAL PRD Installation
32    [Documentation]  Prepare OS for OPAL PRD tool installation.
33
34    Boot To OS
35    ${status}=  Run Keyword And Return Status  Tool Exist  opal-gard
36
37    Return From Keyword If  '${status}' == 'True'  ${False}
38
39
40    # Downloads the package lists from the repositories and "updates"
41    # them to get information on the newest versions of packages and
42    # their dependencies.
43    Log To Console  \n Update package list.
44    OS Execute Command  sudo apt-get update
45
46
47Setup HTX On OS
48    [Documentation]  Download and install HTX exerciser tool from github.
49
50    # Download HTX source code from github.
51    Log To Console  \n Download HTX source code from github.
52    OS Execute Command  sudo git clone https://www.github.com/open-power/HTX
53
54    # Download and install pre-requisite packages before compiling HTX.
55    Log To Console  \n Download pre-requisite packages before compiling HTX.
56    OS Execute Command
57    ...  sudo apt-get -y install gcc make libncurses5 g++ libdapl-dev
58
59    # To fix ncurse compile warning and errors.
60    OS Execute Command
61    ...  sudo apt-get -y install libncurses5-dev libncursesw5-dev
62
63    OS Execute Command
64    ...  sudo apt-get -y install libibverbs-dev librdmacm-dev
65
66    # Compile HTX source code and install.
67    Log To Console  \n Compile HTX source code.
68    OS Execute Command  cd HTX && sudo make all
69
70    Log To Console  \n Installed compiled HTX binaries.
71    OS Execute Command  sudo make install
72
73
74Install HTX On RedHat
75    [Documentation]  Download and install HTX on Red Hat.
76    [Arguments]  ${htx_rpm}
77    # Description of argument(s):
78    # htx_rpm    The url of the rqm file for htx
79    #            (e.g. http://server.com/projects/htx_package.rpm )
80
81
82    ${stdout}  ${stderr}  ${rc}  OS Execute Command
83    ...  wget ${htx_rpm}  ignore_err=1
84    Should Not Contain  ${stderr}  ERROR
85    @{str}=  Split String From Right  ${htx_rpm}  /  1
86
87    # Remove the old version.
88    OS Execute Command  rpm -e `rpm -qa | grep htx`  ignore_err=1
89    OS Execute Command  rpm -Uvh ${str[1]}
90    Tool Exist  htxcmdline
91
92
93Setup Opal Prd On OS
94    [Documentation]  Download and install opal prd tool.
95
96    # Download and install PRD packages.
97    OS Execute Command  sudo apt-get install opal-prd
98    OS Execute Command  sudo apt-get install opal-utils
99
100    # Reboot OS to activate installation.
101    Host Reboot
102
103    # Verify opal prd installation working.
104    ${out}  ${stderr}  ${rc}=  OS Execute Command  opal-gard list
105    Should Contain  ${out}  No GARD entries to display
106