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