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* HTX bootme 15* XCAT execution 16* Network 17 18**Debugging Supported List** 19* SOL collection 20* FFDC collection 21* Error injection from host 22 23## Installation Setup Guide ## 24* [Robot Framework Install Instruction](https://github.com/robotframework/robotframework/blob/master/INSTALL.rst) 25 26* Miscelleneous 27Packages required to be installed for OpenBmc Automation. 28Install the packages and it's dependencies via `pip` 29 30 REST base packages: 31 ``` 32 $ pip install -U requests 33 $ pip install -U robotframework-requests 34 ``` 35 SSH and SCP base packages: 36 For more detailed installation instructions see [robotframework-sshlibrary](https://pypi.python.org/pypi/robotframework-sshlibrary) 37 ``` 38 $ pip install robotframework-sshlibrary 39 $ pip install robotframework-scplibrary 40 ``` 41## Testing Setup Steps ## 42 43To verify the installation setup is completed and ready to execute. 44 45* Download the openbmc-test-automation repository: 46 ``` 47 $ git clone https://github.com/openbmc/openbmc-test-automation 48 $ cd openbmc-test-automation 49 ``` 50* Execute basic setup test run: 51 ``` 52 $ robot -v OPENBMC_HOST:xx.xx.xx.xx templates/test_openbmc_setup.robot 53 ``` 54 where xx.xx.xx.xx is the BMC hostname or IP. 55 56## Test Layout ## 57 58There are several sub-directories within the openbmc-test-automation base which 59contain test suites, tools, templates, etc. These sub-directories are 60classified as follows: 61 62`tests/`: Contains the general test cases for OpenBMC stack functional 63 verification. 64 65`extended/`: Contains test cases for boot testing, network testing, 66 code update, RAS (Reliability, availability and serviceability) 67 testing, etc. 68 69`systest/`: Contains test cases for HTX bootme. 70 71`xcat/`: Contains test cases for XCAT automation. 72 73`tools/`: Contains various tools. 74 75`templates/`: Contains sample code examples and setup testing. 76` 77 78## Quickstart ## 79To run openbmc-automation first you need to install the prerequisite Python 80packages which will help to invoke tests through tox (Note that tox 81version 2.3.1 or greater is required) or via Robot CLI command. 82 83**Robot Command Line** 84 85* Execute all test suites for `tests/`: 86 ``` 87 $ robot -v OPENBMC_HOST:xx.xx.xx.xx tests 88 ``` 89* Execute a test suite: 90 ``` 91 $ robot -v OPENBMC_HOST:xx.xx.xx.xx tests/test_basic_poweron.robot 92 ``` 93**Tox Command Line** 94 95* Install the python dependencies for tox: 96 ``` 97 $ easy_install tox 98 $ easy_install pip 99 ``` 100 101* Initialize the following environment variables which will be used during testing: 102 ``` 103 $ export OPENBMC_HOST=<openbmc machine ip address> 104 $ export OPENBMC_PASSWORD=<openbmc password> 105 $ export OPENBMC_USERNAME=<openbmc username> 106 $ export OPENBMC_MODEL=[./data/Barreleye.py, ./data/Palmetto.py, etc] 107 $ export IPMI_COMMAND=<Dbus/External> 108 $ export IPMI_PASSWORD=<External IPMI password> 109 ``` 110* For tests requiring PDU, set the following environment variables as well: 111 ``` 112 $ export PDU_IP=<PDU IP address> 113 $ export PDU_USERNAME=<PDU username> 114 $ export PDU_PASSWORD=<PDU password> 115 $ export PDU_TYPE=<PDU type> 116 $ export PDU_SLOT_NO=<SLOT number> 117 ``` 118 Note: For PDU_TYPE we support only synaccess at the moment. 119 120* For QEMU tests, set the following environment variables as well: 121 ``` 122 $ export SSH_PORT=<ssh port number> 123 $ export HTTPS_PORT=<https port number> 124 ``` 125* For BIOS tests, set the following environment variables as well: 126 ``` 127 $ export PNOR_IMAGE_PATH=<path to>/<machine>.pnor 128 ``` 129 130* Run tests: 131 ``` 132 $ tox -e tests 133 ``` 134 135* How to run individual test: 136 137 One specific test: 138 ``` 139 $ tox -e default -- --include Power_On_Test tests/test_basic_poweron.robot 140 ``` 141 No preset environment variables, default configuration for all supported 142 systems: 143 ``` 144 $ OPENBMC_HOST=x.x.x.x tox -e default -- tests 145 ``` 146 No preset environment variables, one test case from a test suite: 147 ``` 148 $ OPENBMC_HOST=x.x.x.x tox -e default -- --include Power_On_Test tests/test_basic_poweron.robot 149 ``` 150 No preset environment variables, the entire test suite: 151 ``` 152 $ OPENBMC_HOST=x.x.x.x tox -e default -- tests 153 ``` 154 Default CI test bucket list: 155 156 No preset environment variables, the entire test suite excluding test 157 cases using argument file: 158 ``` 159 $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/skip_test tests 160 ``` 161 162 Exclude test list for supported systems: 163 ``` 164 Barrleye: test_lists/skip_test_barreleye 165 Palmetto: test_lists/skip_test_palmetto 166 Witherspoon: test_lists/skip_test_witherspoon 167 ``` 168 169* Run extended tests: 170 171 For BMC code update, download the system type *.all.tar image from https://openpower.xyz 172 and run as follows: 173 174 For Barreleye system: 175 ``` 176 $ robot -v OPENBMC_HOST:x.x.x.x -v FILE_PATH:downloaded_path/barreleye-xxxx.all.tar extended/code_update/update_bmc.robot 177 ``` 178 For loop test (default iteration is 10): 179 ``` 180 $ 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 181 ``` 182 Example using tox testing a test suite for 5 times: 183 ``` 184 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 185 ``` 186 187**Jenkins jobs tox commands** 188* HW CI tox command: 189 ``` 190 $ OPENBMC_HOST=x.x.x.x tox -e default -- --argumentfile test_lists/HW_CI tests 191 ``` 192 193**Tools** 194 195* Github script: 196 197 Command to get GitHub issues (any GitHub repository) report in CSV format: 198 199 Note: On Prompt "Enter your GitHub Password:" enter your GitHub password. 200 201 Usage: 202 ``` 203 $ cd tools/ 204 $ python github_issues_to_csv <github user> <github repo> 205 ``` 206 Example for getting openbmc issues: 207 ``` 208 $ python github_issues_to_csv <github user> openbmc/openbmc 209 ``` 210 Example for getting openbmc-test-automation issues: 211 ``` 212 $ python github_issues_to_csv <github user> openbmc/openbmc-test-automation 213 ``` 214 215* Generate Robot test cases documentation: 216 217 Usage: 218 ``` 219 $ ./generate_test_document <Robot test directory path> <test case document file path> 220 ``` 221 222 Example for generating tests cases documentation for tests directory: 223 ``` 224 $ ./generate_test_document tests testsdirectoryTCdocs.html 225 ``` 226 227 Example for generating tests cases documentation (tests, gui, extended TCs): 228 Note: Invoke the tool without argument: 229 ``` 230 $ ./generate_test_document 231 ``` 232