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