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