1## Features of OpenBMC Test Automation ##
2
3**Interface Feature List**
4* REST
5* DMTF Redfish
6* Out-of-band IPMI
7* SSH to BMC and Host OS
8
9**Key Feature List**
10* Power on/off
11* Reboot Host
12* Reset BMC
13* Code update BMC and host
14* Power management
15* Fan controller
16* HTX bootme
17* XCAT execution
18* Network
19* IPMI support (generic and DCMI compliant)
20* Factory reset
21* RAS (Reliability, availability and serviceability)
22* Web UI testing
23* IO storage and EEH (Enhanced Error Handling) testing
24* Secure boot
25* SNMP (Simple Network Management Protocol)
26* Remote Logging via Rsyslog
27
28**Debugging Supported List**
29* SOL collection
30* FFDC collection
31* Error injection from host
32
33## Installation Setup Guide ##
34* [Robot Framework Install Instruction](https://github.com/robotframework/robotframework/blob/master/INSTALL.rst)
35
36* Miscellaneous
37Packages required to be installed for OpenBmc Automation.
38Install the packages and it's dependencies via `pip`
39
40    REST base packages:
41    ```
42    $ pip install -U requests
43    $ pip install -U robotframework-requests
44    $ pip install -U robotframework-httplibrary
45    ```
46
47    SSH and SCP base packages:
48    For more detailed installation instructions see [robotframework-sshlibrary](https://pypi.python.org/pypi/robotframework-sshlibrary)
49    ```
50    $ pip install robotframework-sshlibrary
51    $ pip install robotframework-scplibrary
52    ```
53
54    Installing tox:
55    ```
56    $ pip install -U tox
57    ```
58
59If using Python 3.x, use the corresponding `pip3` to install packages.
60
61## OpenBMC Test Development ##
62
63These documents contain details on developing OpenBMC test code and debugging.
64
65 - [MAINTAINERS](https://github.com/openbmc/docs/blob/master/MAINTAINERS): OpenBMC code maintainers information.
66 - [CONTRIBUTING.md](CONTRIBUTING.md): Coding guidelines.
67 - [REST-cheatsheet.md](https://github.com/openbmc/docs/blob/master/REST-cheatsheet.md): Quick reference for some common
68   curl commands required for testing.
69 - [README.md](https://github.com/openbmc/phosphor-webui/blob/master/README.md): Web UI setup reference.
70 - [Tools.md](Tools.md): Reference information for helper tools.
71
72## Testing Setup Steps ##
73
74To verify the installation setup is completed and ready to execute.
75
76* Download the openbmc-test-automation repository:
77    ```
78    $ git clone https://github.com/openbmc/openbmc-test-automation
79    $ cd openbmc-test-automation
80    ```
81* Execute basic setup test run:
82    ```
83    $ robot -v OPENBMC_HOST:xx.xx.xx.xx templates/test_openbmc_setup.robot
84    ```
85    where xx.xx.xx.xx is the BMC hostname or IP.
86
87## Test Layout ##
88
89There are several sub-directories within the openbmc-test-automation base which
90contain test suites, tools, templates, etc. These sub-directories are
91classified as follows:
92
93`tests/`: Contains the general test cases for OpenBMC stack functional
94          verification.
95
96`extended/`: Contains test cases for boot testing, network testing,
97             code update testing etc.
98
99`systest/`: Contains test cases for HTX bootme, IO storage and EEH testing.
100
101`xcat/`: Contains test cases for XCAT automation.
102
103`gui/`: Contains test cases for web UI and security scanning tool automation.
104
105`mnfg/`: Contains test cases for factory reset (DHCP mode) and PGOOD testing.
106
107`network/`: Contains test cases for network testing. It covers IPv4 in static mode
108            and in DHCP mode.
109
110`snmp/`: Contains test cases for SNMP (Simple Network Management Protocol)
111         configuration testing.
112
113`remote_logging`: Contains test cases for remote logging via rsyslog.
114
115`openpower/ras/`: Contains test cases for RAS (Reliability, Availability and
116                  Serviceability) for an OpenPOWER system.
117
118`openpower/secureboot/`: Contains test cases for secure boot testing on a
119                         secure boot feature enabled OpenPOWER system only.
120
121`tools/`: Contains various tools.
122
123`templates/`: Contains sample code examples and setup testing.
124
125`test_list/`: Contains the argument files used for skipping test cases
126              (e.g "skip_test", "skip_test_extended", etc.) or
127              grouping them (e.g "HW_CI", "CT_basic_run", etc.).
128
129
130## Redfish Test Layout ##
131
132OpenBMC is moving steadily towards DTMF Redfish, which is an open industry standard
133specification and schema that meets the expectations of end users for simple,
134modern and secure management of scalable platform hardware.
135
136`redfish_test`: Contains test cases for DMTF Redfish-related feature supported
137                on OpenBMC.
138
139
140## Quickstart ##
141To run openbmc-automation first you need to install the prerequisite Python
142packages which will help to invoke tests through tox (Note that tox
143version 2.3.1 or greater is required) or via Robot CLI command.
144
145**Robot Command Line**
146
147* Execute all test suites for `tests/`:
148    ```
149    $ robot -v OPENBMC_HOST:xx.xx.xx.xx  tests
150    ```
151
152* Execute a test suite:
153    ```
154    $ robot -v OPENBMC_HOST:xx.xx.xx.xx  tests/test_basic_poweron.robot
155    ```
156
157* Initialize the following environment variables which will be used during testing:
158    ```
159    $ export OPENBMC_HOST=<openbmc machine ip address>
160    $ export OPENBMC_PASSWORD=<openbmc password>
161    $ export OPENBMC_USERNAME=<openbmc username>
162    $ export OPENBMC_MODEL=[./data/Witherspoon.py, ./data/Palmetto.py, etc]
163    $ export IPMI_COMMAND=<Dbus/External>
164    $ export IPMI_PASSWORD=<External IPMI password>
165    ```
166
167* For QEMU tests, set the following environment variables as well:
168    ```
169    $ export SSH_PORT=<ssh port number>
170    $ export HTTPS_PORT=<https port number>
171    ```
172
173* Run tests:
174    ```
175    $ tox -e tests
176    ```
177
178* How to run individual test:
179
180    One specific test:
181    ```
182    $ tox -e default -- --include Power_On_Test  tests/test_basic_poweron.robot
183    ```
184    No preset environment variables, default configuration for all supported
185    systems:
186    ```
187    $ OPENBMC_HOST=x.x.x.x tox -e default -- tests
188    ```
189    No preset environment variables, one test case from a test suite:
190    ```
191    $ OPENBMC_HOST=x.x.x.x tox -e default -- --include Power_On_Test tests/test_basic_poweron.robot
192    ```
193    No preset environment variables, the entire test suite:
194    ```
195    $ OPENBMC_HOST=x.x.x.x tox -e default -- tests
196    ```
197
198    No preset environment variables, the entire test suite excluding test
199    cases using argument file:
200    ```
201    $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/skip_test tests
202    ```
203
204    Exclude test list for supported systems:
205    ```
206    Palmetto:  test_lists/skip_test_palmetto
207    Witherspoon:  test_lists/skip_test_witherspoon
208    ```
209
210* How to run CI and CT bucket test:
211
212    Default CI test bucket list:
213    ```
214    $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/HW_CI tests
215    ```
216
217    Default CI smoke test bucket list:
218    ```
219    $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/CT_basic_run tests
220    ```
221
222* Run extended tests:
223
224    For-loop test (default iteration is 10):
225    ```
226    $ 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
227    ```
228
229    Example using tox testing a test suite for 5 iterations "witherspoon":
230    ```
231    OPENBMC_HOST=x.x.x.x  LOOP_TEST_COMMAND="tests/test_fw_version.robot" ITERATION=5 OPENBMC_SYSTEMMODEL=witherspoon tox -e witherspoon -- ./extended/full_suite_regression.robot
232    ```
233
234**Jenkins jobs tox commands**
235* HW CI tox command:
236    ```
237    $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/HW_CI tests
238    ```
239
240## Code Update ##
241
242Currently supported BMC and PNOR update formats are UBI and non-UBI.
243For code update information, please refer to [code-update.md](https://github.com/openbmc/docs/blob/master/code-update/code-update.md)
244
245
246* UBI Format *
247
248    For BMC code update, download the system type *.ubi.mdt.tar image from
249    https://openpower.xyz/job/openbmc-build/ and run as follows:
250
251    For Witherspoon system:
252    ```
253    $ cd extended/code_update/
254    $ 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
255    ```
256
257    For host code update, download the system type *.pnor.squashfs.tar image
258    from https://openpower.xyz/job/openpower-op-build/ and run as follows:
259
260    For Witherspoon system:
261    ```
262    $ cd extended/code_update/
263    $ 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
264    ```
265
266* Non-UBI Format *
267
268    For BMC code update, download the system type *all.tar image from
269    https://openpower.xyz/job/openbmc-build/ and run as follows:
270
271    For a Zaius system:
272    ```
273    $ cd extended/code_update/
274    $ robot -v OPENBMC_HOST:x.x.x.x -v FILE_PATH:<image path>/zaius-<date time>.all.tar --include Initiate_Code_Update_BMC update_bmc.robot
275    ```
276
277    For host code update, download the system type *.pnor from
278    https://openpower.xyz/job/openpower-op-build/ and run as follows:
279
280    For a Zaius system:
281    ```
282    $ cd extended/
283    $ robot -v OPENBMC_HOST:x.x.x.x -v PNOR_IMAGE_PATH:<image path>/zaius.pnor test_bios_update.robot
284    ```
285