xref: /openbmc/openbmc-test-automation/README.md (revision bfa16ee4f68964bd5dd20618cb3b293584b78c69)
1## Features of OpenBMC Test Automation ##
2
3**Interface Feature List**
4* REST
5* Out-of-band IPMI
6* SSH to BMC and Host OS
7
8**Key Feature List**
9* Power on/off
10* Reboot Host
11* Reset BMC
12* Code update BMC and host
13* Power management
14* Fan controller
15* HTX bootme
16* XCAT execution
17* Network
18* IPMI support (generic and DCMI compliant)
19* Factory reset
20* RAS (Reliability, availability and serviceability)
21* Web UI testing
22* IO storage and EEH (Enhanced Error Handling) testing
23
24**Debugging Supported List**
25* SOL collection
26* FFDC collection
27* Error injection from host
28
29## Installation Setup Guide ##
30* [Robot Framework Install Instruction](https://github.com/robotframework/robotframework/blob/master/INSTALL.rst)
31
32* Miscelleneous
33Packages required to be installed for OpenBmc Automation.
34Install the packages and it's dependencies via `pip`
35
36    REST base packages:
37    ```
38    $ pip install -U requests
39    $ pip install -U robotframework-requests
40    ```
41    SSH and SCP base packages:
42    For more detailed installation instructions see [robotframework-sshlibrary](https://pypi.python.org/pypi/robotframework-sshlibrary)
43    ```
44    $ pip install robotframework-sshlibrary
45    $ pip install robotframework-scplibrary
46    ```
47
48## OpenBMC Test Development ##
49
50These documents contain details on developing OpenBMC test code and debugging.
51
52 - [CONTRIBUTING.md](CONTRIBUTING.md): Coding guidelines.
53 - [REST-cheatsheet.md](https://github.com/openbmc/docs/blob/master/REST-cheatsheet.md): Quick reference for some common
54   curl commands required for testing.
55 - [README.md](https://github.com/openbmc/phosphor-webui/blob/master/README.md): Web UI setup reference.
56 - [Tools.md](Tools.md): Reference information for helper tools.
57
58## Testing Setup Steps ##
59
60To verify the installation setup is completed and ready to execute.
61
62* Download the openbmc-test-automation repository:
63    ```
64    $ git clone https://github.com/openbmc/openbmc-test-automation
65    $ cd openbmc-test-automation
66    ```
67* Execute basic setup test run:
68    ```
69    $ robot -v OPENBMC_HOST:xx.xx.xx.xx templates/test_openbmc_setup.robot
70    ```
71    where xx.xx.xx.xx is the BMC hostname or IP.
72
73## Test Layout ##
74
75There are several sub-directories within the openbmc-test-automation base which
76contain test suites, tools, templates, etc. These sub-directories are
77classified as follows:
78
79`tests/`: Contains the general test cases for OpenBMC stack functional
80          verification.
81
82`extended/`: Contains test cases for boot testing, network testing,
83             code update testing etc.
84
85`systest/`: Contains test cases for HTX bootme, IO storage and EEH testing.
86
87`xcat/`: Contains test cases for XCAT automation.
88
89`ras/`: Contains test cases for RAS (Reliability, availability and
90        serviceability).
91
92`gui/`: Contains test cases for web UI and security scanning tool automation.
93
94`mnfg/`: Contains test cases for factory reset (DHCP mode) and PGOOD testing.
95
96`tools/`: Contains various tools.
97
98`templates/`: Contains sample code examples and setup testing.
99`
100
101## Quickstart ##
102To run openbmc-automation first you need to install the prerequisite Python
103packages which will help to invoke tests through tox (Note that tox
104version 2.3.1 or greater is required) or via Robot CLI command.
105
106**Robot Command Line**
107
108* Execute all test suites for `tests/`:
109    ```
110    $ robot -v OPENBMC_HOST:xx.xx.xx.xx  tests
111    ```
112* Execute a test suite:
113    ```
114    $ robot -v OPENBMC_HOST:xx.xx.xx.xx  tests/test_basic_poweron.robot
115    ```
116**Tox Command Line**
117
118* Install the python dependencies for tox:
119    ```
120    $ easy_install tox
121    $ easy_install pip
122    ```
123
124* Initialize the following environment variables which will be used during testing:
125    ```
126    $ export OPENBMC_HOST=<openbmc machine ip address>
127    $ export OPENBMC_PASSWORD=<openbmc password>
128    $ export OPENBMC_USERNAME=<openbmc username>
129    $ export OPENBMC_MODEL=[./data/Barreleye.py, ./data/Palmetto.py, etc]
130    $ export IPMI_COMMAND=<Dbus/External>
131    $ export IPMI_PASSWORD=<External IPMI password>
132    ```
133* For tests requiring PDU, set the following environment variables as well:
134    ```
135    $ export PDU_IP=<PDU IP address>
136    $ export PDU_USERNAME=<PDU username>
137    $ export PDU_PASSWORD=<PDU password>
138    $ export PDU_TYPE=<PDU type>
139    $ export PDU_SLOT_NO=<SLOT number>
140    ```
141    Note: For PDU_TYPE we support only synaccess at the moment.
142
143* For QEMU tests, set the following environment variables as well:
144    ```
145    $ export SSH_PORT=<ssh port number>
146    $ export HTTPS_PORT=<https port number>
147    ```
148* For BIOS tests, set the following environment variables as well:
149    ```
150    $ export PNOR_IMAGE_PATH=<path to>/<machine>.pnor
151    ```
152
153* Run tests:
154    ```
155    $ tox -e tests
156    ```
157
158* How to run individual test:
159
160    One specific test:
161    ```
162    $ tox -e default -- --include Power_On_Test  tests/test_basic_poweron.robot
163    ```
164    No preset environment variables, default configuration for all supported
165    systems:
166    ```
167    $ OPENBMC_HOST=x.x.x.x tox -e default -- tests
168    ```
169    No preset environment variables, one test case from a test suite:
170    ```
171    $ OPENBMC_HOST=x.x.x.x tox -e default -- --include Power_On_Test tests/test_basic_poweron.robot
172    ```
173    No preset environment variables, the entire test suite:
174    ```
175    $ OPENBMC_HOST=x.x.x.x tox -e default -- tests
176    ```
177
178    No preset environment variables, the entire test suite excluding test
179    cases using argument file:
180    ```
181    $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/skip_test tests
182    ```
183
184    Exclude test list for supported systems:
185    ```
186    Barrleye:  test_lists/skip_test_barreleye
187    Palmetto:  test_lists/skip_test_palmetto
188    Witherspoon:  test_lists/skip_test_witherspoon
189    ```
190
191* How to run CI and CT bucket test:
192
193    Default CI test bucket list:
194    ```
195    $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/HW_CI tests
196    ```
197
198    Default CI smoke test bucket list:
199    ```
200    $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/CT_basic_run tests
201    ```
202
203* Code update test:
204
205    For BMC code update, download the system type *.ubi.mdt.tar image from
206    https://openpower.xyz/job/openbmc-build/ and run as follows:
207
208    For Witherspoon system:
209    ```
210    $ cd extended/code_update/
211    $ robot -v OPENBMC_HOST:x.x.x.x -v IMAGE_FILE_PATH:<image path>/obmc-phosphor-image-witherspoon.ubi.mtd.tar --include REST_BMC_Code_Update  bmc_code_update.robot
212    ```
213
214    For host code update, download the system type *.pnor.squashfs.tar image
215    from https://openpower.xyz/job/openpower-op-build/ and run as follows:
216
217    For Witherspoon system:
218    ```
219    $ cd extended/code_update/
220    $ robot -v OPENBMC_HOST:x.x.x.x -v IMAGE_FILE_PATH:<image path>/witherspoon.pnor.squashfs.tar --include REST_Host_Code_Update  host_code_update.robot
221    ```
222
223    For manual code update information please refer to [code-update.md](https://github.com/openbmc/docs/blob/master/code-update/code-update.md)
224
225* Run extended tests:
226
227    For loop test (default iteration is 10):
228    ```
229    $ robot -v OPENBMC_HOST:x.x.x.x -v OPENBMC_SYSTEMMODEL:xxxxxx -v ITERATION:n -v LOOP_TEST_COMMAND:xxxxxx extended/full_suite_regression.robot
230    ```
231    Example using tox testing a test suite for 5 times:
232    ```
233    OPENBMC_HOST=x.x.x.x  LOOP_TEST_COMMAND="--argumentfile test_lists/skip_test tests/test_fw_version.robot" ITERATION=5  OPENBMC_SYSTEMMODEL=barreleye tox -e barreleye -- ./extended/full_suite_regression.robot
234    ```
235
236**Jenkins jobs tox commands**
237* HW CI tox command:
238    ```
239    $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/HW_CI tests
240    ```
241