xref: /openbmc/openbmc-test-automation/README.md (revision c7272651cf866aadeed130dd5c3a197a2f6c269a)
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* Secure boot
24* SNMP (Simple Network Management Protocol)
25* Remote Logging via Rsyslog
26* LDAP (Lightweight Directory Access Protocol)
27* Certificate
28
29**Debugging Supported List**
30* SOL collection
31* FFDC collection
32* Error injection from host
33
34## Installation Setup Guide ##
35* [Robot Framework Install Instruction](https://github.com/robotframework/robotframework/blob/master/INSTALL.rst)
36
37* Miscellaneous
38Packages required to be installed for OpenBmc Automation.
39Install the packages and it's dependencies via `pip`
40
41    REST base packages:
42    ```
43    $ pip install -U requests
44    $ pip install -U robotframework-requests
45    $ pip install -U robotframework-httplibrary
46    ```
47
48    Python redfish library packages:
49    For more detailed intstructions see [python-redfish-library](https://github.com/DMTF/python-redfish-library)
50    ```
51    $ pip install redfish
52    ```
53
54    SSH and SCP base packages:
55    For more detailed installation instructions see [robotframework-sshlibrary](https://pypi.python.org/pypi/robotframework-sshlibrary)
56    ```
57    $ pip install robotframework-sshlibrary
58    $ pip install robotframework-scplibrary
59    ```
60
61    Installing tox:
62    ```
63    $ pip install -U tox
64    ```
65
66If using Python 3.x, use the corresponding `pip3` to install packages.
67
68## OpenBMC Test Development ##
69
70These documents contain details on developing OpenBMC test code and debugging.
71
72 - [MAINTAINERS](https://github.com/openbmc/docs/blob/master/MAINTAINERS): OpenBMC code maintainers information.
73 - [CONTRIBUTING.md](CONTRIBUTING.md): Coding guidelines.
74 - [REST-cheatsheet.md](https://github.com/openbmc/docs/blob/master/REST-cheatsheet.md): Quick reference for some common
75   curl commands required for testing.
76 - [README.md](https://github.com/openbmc/phosphor-webui/blob/master/README.md): Web UI setup reference.
77 - [Tools.md](https://github.com/openbmc/openbmc-test-automation/blob/master/docs/openbmc_test_tools.md): Reference information for helper tools.
78 - [Corporate CLA and Individual CLA](https://github.com/openbmc/docs/blob/master/CONTRIBUTING.md#submitting-changes-via-gerrit-server): Submitting changes via Gerrit server
79
80## Testing Setup Steps ##
81
82To verify the installation setup is completed and ready to execute.
83
84* Download the openbmc-test-automation repository:
85    ```
86    $ git clone https://github.com/openbmc/openbmc-test-automation
87    $ cd openbmc-test-automation
88    ```
89* Execute basic setup test run:
90    ```
91    $ robot -v OPENBMC_HOST:xx.xx.xx.xx templates/test_openbmc_setup.robot
92    ```
93    where xx.xx.xx.xx is the BMC hostname or IP.
94
95## Test Layout ##
96
97There are several sub-directories within the openbmc-test-automation base which
98contain test suites, tools, templates, etc. These sub-directories are
99classified as follows:
100
101`tests/`: Contains the general test cases for OpenBMC stack functional
102          verification. The "tests" subdirectory uses legacy REST and will be
103          deprecated at some point and therefore no longer supported.
104
105`extended/`: Contains test cases for boot testing, code update testing, etc.
106
107`systest/`: Contains test cases for HTX bootme testing.
108
109`xcat/`: Contains test cases for XCAT automation.
110
111`gui/`: Contains test cases for web UI and security scanning tool automation.
112
113`network/`: Contains test cases for network testing. It covers IPv4 in static mode
114            and in DHCP mode.
115
116`snmp/`: Contains test cases for SNMP (Simple Network Management Protocol)
117         configuration testing.
118
119`remote_logging`: Contains test cases for remote logging via rsyslog.
120
121`openpower/ras/`: Contains test cases for RAS (Reliability, Availability and
122                  Serviceability) for an OpenPOWER system.
123
124`openpower/secureboot/`: Contains test cases for secure boot testing on a
125                         secure boot feature enabled OpenPOWER system only.
126
127`tools/`: Contains various tools.
128
129`templates/`: Contains sample code examples and setup testing.
130
131`test_list/`: Contains the argument files used for skipping test cases
132              (e.g "skip_test", "skip_test_extended", etc.) or
133              grouping them (e.g "HW_CI", "CT_basic_run", etc.).
134
135
136## Redfish Test Layout ##
137
138OpenBMC is moving steadily towards DTMF Redfish, which is an open industry standard
139specification and schema that meets the expectations of end users for simple,
140modern and secure management of scalable platform hardware.
141
142`redfish`: Contains test cases for DMTF Redfish-related feature supported on OpenBMC.
143
144
145## Quickstart ##
146To run openbmc-automation first you need to install the prerequisite Python
147packages which will help to invoke tests through tox (Note that tox
148version 2.3.1 or greater is required) or via Robot CLI command.
149
150**Robot Command Line**
151
152* Execute all test suites for `tests/`:
153    ```
154    $ robot -v OPENBMC_HOST:xx.xx.xx.xx  tests
155    ```
156
157* Execute a test suite:
158    ```
159    $ robot -v OPENBMC_HOST:xx.xx.xx.xx  tests/test_basic_poweron.robot
160    ```
161
162* Initialize the following environment variables which will be used during testing:
163    ```
164    $ export OPENBMC_HOST=<openbmc machine ip address>
165    $ export OPENBMC_PASSWORD=<openbmc password>
166    $ export OPENBMC_USERNAME=<openbmc username>
167    $ export OPENBMC_MODEL=[./data/Witherspoon.py, ./data/Palmetto.py, etc]
168    $ export IPMI_COMMAND=<Dbus/External>
169    $ export IPMI_PASSWORD=<External IPMI password>
170    ```
171
172* For QEMU tests, set the following environment variables as well:
173    ```
174    $ export SSH_PORT=<ssh port number>
175    $ export HTTPS_PORT=<https port number>
176    ```
177
178* Run tests:
179    ```
180    $ tox -e tests
181    ```
182
183* How to run individual test:
184
185    One specific test:
186    ```
187    $ tox -e default -- --include Power_On_Test  tests/test_basic_poweron.robot
188    ```
189    No preset environment variables, default configuration for all supported
190    systems:
191    ```
192    $ OPENBMC_HOST=x.x.x.x tox -e default -- tests
193    ```
194    No preset environment variables, one test case from a test suite:
195    ```
196    $ OPENBMC_HOST=x.x.x.x tox -e default -- --include Power_On_Test tests/test_basic_poweron.robot
197    ```
198    No preset environment variables, the entire test suite:
199    ```
200    $ OPENBMC_HOST=x.x.x.x tox -e default -- tests
201    ```
202
203    No preset environment variables, the entire test suite excluding test
204    cases using argument file:
205    ```
206    $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/skip_test tests
207    ```
208
209    Exclude test list for supported systems:
210    ```
211    Palmetto:  test_lists/skip_test_palmetto
212    Witherspoon:  test_lists/skip_test_witherspoon
213    ```
214
215
216* Run IPMI tests:
217
218    Running only out-of-band IPMI tests:
219    ```
220    $ robot -v IPMI_COMMAND:External -v OPENBMC_HOST:x.x.x.x --argumentfile test_lists/witherspoon/skip_inband_ipmi tests/ipmi/
221    ```
222
223    Running only inband IPMI tests:
224    ```
225    $ robot -v IPMI_COMMAND:Inband -v OPENBMC_HOST:x.x.x.x -v OS_HOST:x.x.x.x -v OS_USERNAME:xxxx -v OS_PASSWORD:xxxx --argumentfile test_lists/witherspoon/skip_oob_ipmi tests/ipmi/
226    ```
227
228
229* Run GUI tests:
230
231    By default, GUI runs with Firefox browser and headless mode. Example with chrome browser and header mode:
232    ```
233    $ robot -v OPENBMC_HOST:x.x.x.x -v GUI_BROWSER:gc -v GUI_MODE:header gui/obmc_gui/test/
234    ```
235
236    Run GUI default CI test bucket:
237    ```
238    $ robot -v OPENBMC_HOST:x.x.x.x --argumentfile test_lists/BMC_WEB_CI gui/obmc_gui/test/
239    ```
240
241* Run LDAP tests:
242
243    Before using LDAP test functions, be sure appropriate LDAP user(s) and group(s) have been created on your LDAP server.
244    Note: There are multiple ways to create LDAP users / groups and all depend on your LDAP server.
245    One common way for openldap is ldapadd / ldapmodify refer https://linux.die.net/man/1/ldapadd
246    For ldapsearch, refer to "https://linux.die.net/man/1/ldapsearch".
247    Microsoft ADS: refer to  https://searchwindowsserver.techtarget.com/definition/Microsoft-Active-Directory-Domain-Services-AD-DS
248    ```
249    $ cd tests_ldap/
250    $ robot -v OPENBMC_HOST:x.x.x.x -v LDAP_SERVER_URI:<ldap(s)//LDAP Hostname / IP> -v LDAP_BIND_DN:<LDAP Bind DN> -v LDAP_BASE_DN:<LDAP Base DN> -v LDAP_BIND_DN_PASSWORD:<LDAP Bind password> -v LDAP_SEARCH_SCOPE:<LDAP search scope> -v LDAP_SERVER_TYPE:<LDAP server type> -v LDAP_USER:<LDAP user-id> -v LDAP_USER_PASSWORD:<LDAP PASSWORD> -v GROUP_NAME:<Group Name> -v GROUP_PRIVILEGE:<Privilege>  test_user_ldap_management.robot
251    ```
252
253* How to run CI and CT bucket test:
254
255    Default CI test bucket list:
256    ```
257    $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/HW_CI tests
258    ```
259
260    Default CI smoke test bucket list:
261    ```
262    $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/CT_basic_run tests
263    ```
264
265* Run extended tests:
266
267    For-loop test (default iteration is 10):
268    ```
269    $ 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
270    ```
271
272    Example using tox testing a test suite for 5 iterations "witherspoon":
273    ```
274    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
275    ```
276
277**Jenkins jobs tox commands**
278* HW CI tox command:
279    ```
280    $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/HW_CI tests
281    ```
282
283## Code Update ##
284
285Currently supported BMC and PNOR update formats are UBI and non-UBI.
286For code update information, please refer to [code-update.md](https://github.com/openbmc/docs/blob/master/code-update/code-update.md)
287
288
289* UBI Format *
290
291    For BMC code update, download the system type *.ubi.mdt.tar image from
292    https://openpower.xyz/job/openbmc-build/ and run as follows:
293
294    For Witherspoon system:
295    ```
296    $ cd extended/code_update/
297    $ 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
298    ```
299
300    For host code update, download the system type *.pnor.squashfs.tar image
301    from https://openpower.xyz/job/openpower-op-build/ and run as follows:
302
303    For Witherspoon system:
304    ```
305    $ cd extended/code_update/
306    $ 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
307    ```
308
309* Non-UBI Format *
310
311    For BMC code update, download the system type *all.tar image from
312    https://openpower.xyz/job/openbmc-build/ and run as follows:
313
314    For a Zaius system:
315    ```
316    $ cd extended/code_update/
317    $ 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
318    ```
319
320    For host code update, download the system type *.pnor from
321    https://openpower.xyz/job/openpower-op-build/ and run as follows:
322
323    For a Zaius system:
324    ```
325    $ cd extended/
326    $ robot -v OPENBMC_HOST:x.x.x.x -v PNOR_IMAGE_PATH:<image path>/zaius.pnor test_bios_update.robot
327    ```
328