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 web UI and security scanning tool automation.
138
139`pldm/`: Contains test cases for platform management subsystem (base, bios, fru, platform, OEM).
140
141`snmp/`: Contains test cases for SNMP (Simple Network Management Protocol)
142         configuration testing.
143
144`openpower/ras/`: Contains test cases for RAS (Reliability, Availability and
145                  Serviceability) for an OpenPOWER system.
146
147`openpower/secureboot/`: Contains test cases for secure boot testing on a
148                         secure boot feature enabled OpenPOWER system only.
149
150`tools/`: Contains various tools.
151
152`templates/`: Contains sample code examples and setup testing.
153
154`test_list/`: Contains the argument files used for skipping test cases
155              (e.g "skip_test", "skip_test_extended", etc.) or
156              grouping them (e.g "HW_CI", "CT_basic_run", etc.).
157
158
159## Redfish Test Layout ##
160
161OpenBMC is moving steadily towards DTMF Redfish, which is an open industry standard
162specification and schema that meets the expectations of end users for simple,
163modern and secure management of scalable platform hardware.
164
165`redfish/`: Contains test cases for DMTF Redfish-related feature supported on OpenBMC.
166
167`redfish/extended/`: Contains test cases for combined legacy REST and DMTF Redfish-related
168                     feature supported on OpenBMC.
169
170Note: Work in progress test development parameter `-v REDFISH_SUPPORT_TRANS_STATE:1` to force
171      the test suites to execute in redfish mode only.
172
173
174## Quickstart ##
175To run openbmc-automation first you need to install the prerequisite Python
176packages which will help to invoke tests through tox (Note that tox
177version 2.3.1 or greater is required) or via Robot CLI command.
178
179**Robot Command Line**
180
181* Execute all test suites for `tests/`:
182    ```
183    $ robot -v OPENBMC_HOST:xx.xx.xx.xx  tests
184    ```
185
186* Execute a test suite:
187    ```
188    $ robot -v OPENBMC_HOST:xx.xx.xx.xx redfish/extended/test_basic_ci.robot
189    ```
190
191* Initialize the following test variables which will be used during test execution:
192
193    User can forward declare as environment variables:
194    ```
195    $ export OPENBMC_HOST=<openbmc machine IP address/hostname>
196    $ export OPENBMC_USERNAME=<openbmc username>
197    $ export OPENBMC_PASSWORD=<openbmc password>
198    $ export IPMI_COMMAND=<Dbus/External>
199    ```
200
201    or
202
203    User can input as robot variables as part of the CLI command:
204    ```
205    -v OPENBMC_HOST:<openbmc machine IP address/hostname>
206    -v OPENBMC_USERNAME:<openbmc username>
207    -v OPENBMC_PASSWORD:<openbmc password>
208    ```
209
210* For QEMU tests, set the following environment variables as well:
211    ```
212    $ export SSH_PORT=<ssh port number>
213    $ export HTTPS_PORT=<https port number>
214    ```
215
216* Run tests:
217    ```
218    $ tox tests
219    ```
220
221* How to run individual test:
222
223    One specific test:
224    ```
225    $ tox -e default -- --include Power_On_Test  tests/test_basic_poweron.robot
226    ```
227    No preset environment variables, default configuration for all supported
228    systems:
229    ```
230    $ OPENBMC_HOST=x.x.x.x tox -e default -- tests
231    ```
232    No preset environment variables, one test case from a test suite:
233    ```
234    $ OPENBMC_HOST=x.x.x.x tox -e default -- --include Power_On_Test tests/test_basic_poweron.robot
235    ```
236    No preset environment variables, the entire test suite:
237    ```
238    $ OPENBMC_HOST=x.x.x.x tox -e default -- tests
239    ```
240
241    No preset environment variables, the entire test suite excluding test
242    cases using argument file:
243    ```
244    $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/skip_test tests
245    ```
246
247    Exclude test list for supported systems:
248    ```
249    Palmetto:  test_lists/skip_test_palmetto
250    Witherspoon:  test_lists/skip_test_witherspoon
251    ```
252
253
254* Run IPMI tests:
255
256    Running only out-of-band IPMI tests:
257    ```
258    $ robot -v IPMI_COMMAND:External -v OPENBMC_HOST:x.x.x.x --argumentfile test_lists/witherspoon/skip_inband_ipmi tests/ipmi/
259    ```
260
261    Running only inband IPMI tests:
262    ```
263    $ 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/
264    ```
265
266
267* Run GUI tests:
268
269    By default, GUI runs with Firefox browser and headless mode. Example with chrome browser and header mode:
270    ```
271    $ robot -v OPENBMC_HOST:x.x.x.x -v GUI_BROWSER:gc -v GUI_MODE:header gui/test/
272    ```
273
274    Run GUI default CI test bucket:
275    ```
276    $ robot -v OPENBMC_HOST:x.x.x.x --argumentfile test_lists/BMC_WEB_CI gui/test/
277    ```
278
279* Run LDAP tests:
280
281    Before using LDAP test functions, be sure appropriate LDAP user(s) and group(s) have been created on your LDAP server.
282    Note: There are multiple ways to create LDAP users / groups and all depend on your LDAP server.
283    One common way for openldap is ldapadd / ldapmodify refer https://linux.die.net/man/1/ldapadd
284    For ldapsearch, refer to "https://linux.die.net/man/1/ldapsearch".
285    Microsoft ADS: refer to  https://searchwindowsserver.techtarget.com/definition/Microsoft-Active-Directory-Domain-Services-AD-DS
286
287   Note: Currently, LDAP test automation for Redfish API is in progress. The format to invoke LDAP test is as follows:
288    ```
289    $ cd redfish/account_service/
290    $ 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
291    ```
292
293* How to run CI and CT bucket test:
294
295    Default CI test bucket list:
296    ```
297    $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/HW_CI tests
298    ```
299
300    Default CI smoke test bucket list:
301    ```
302    $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/CT_basic_run tests
303    ```
304
305* Run extended tests:
306
307    For-loop test (default iteration is 10):
308    ```
309    $ 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
310    ```
311
312    Example using tox testing a test suite for 5 iterations "witherspoon":
313    ```
314    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
315    ```
316
317* Host CPU architecture
318
319    By default openbmc-test-automation framework assumes that host CPU is based on the POWER architecture.
320    If your host CPU is x86 add `-v PLATFORM_ARCH_TYPE:x86` variable setting to your CLI commands or set an environment variable:
321    ```
322    $ export PLATFORM_ARCH_TYPE=x86
323    ```
324
325**Jenkins jobs tox commands**
326* HW CI tox command:
327    ```
328    $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/HW_CI tests
329    ```
330