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