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