| George Keishing | beec26d | 2016-11-09 06:57:28 -0600 | [diff] [blame] | 1 | *** Settings *** | 
|  | 2 | Documentation     Module for capturing BMC serial output | 
|  | 3 |  | 
|  | 4 | Library           Telnet  newline=LF | 
|  | 5 | Library           OperatingSystem | 
|  | 6 | Library           Collections | 
| Charles Paul Hofer | e0e1780 | 2017-09-21 09:19:33 -0500 | [diff] [blame] | 7 | Library           String | 
| George Keishing | beec26d | 2016-11-09 06:57:28 -0600 | [diff] [blame] | 8 |  | 
| George Keishing | beec26d | 2016-11-09 06:57:28 -0600 | [diff] [blame] | 9 |  | 
|  | 10 | *** Keywords *** | 
|  | 11 |  | 
| Charles Paul Hofer | e0e1780 | 2017-09-21 09:19:33 -0500 | [diff] [blame] | 12 | Open Telnet Connection To BMC Serial Console | 
| George Keishing | beec26d | 2016-11-09 06:57:28 -0600 | [diff] [blame] | 13 | [Documentation]   Open telnet connection session to BMC serial console | 
| George Keishing | be3cdfd | 2018-08-28 00:00:06 -0500 | [diff] [blame] | 14 | ...               The login prompt expected, for example, for Witherspoon | 
|  | 15 | ...               is "Witherspoon login:". | 
| George Keishing | beec26d | 2016-11-09 06:57:28 -0600 | [diff] [blame] | 16 | [Arguments]   ${i_host}=${OPENBMC_SERIAL_HOST} | 
| George Keishing | bfae2ff | 2016-11-28 04:16:10 -0600 | [diff] [blame] | 17 | ...           ${i_port}=${OPENBMC_SERIAL_PORT} | 
| George Keishing | beec26d | 2016-11-09 06:57:28 -0600 | [diff] [blame] | 18 | ...           ${i_model}=${OPENBMC_MODEL} | 
|  | 19 |  | 
| Charles Paul Hofer | e0e1780 | 2017-09-21 09:19:33 -0500 | [diff] [blame] | 20 | # Description of argument(s): | 
|  | 21 | # i_host    The host name or IP of the serial console. | 
|  | 22 | # i_port    The port of the serial console. | 
|  | 23 | # i_model   The path to the system data, i.e. "./data/Witherspoon.py". | 
| George Keishing | beec26d | 2016-11-09 06:57:28 -0600 | [diff] [blame] | 24 |  | 
| George Keishing | d54591a | 2018-07-10 13:05:14 -0500 | [diff] [blame] | 25 | ${prompt_string}=  Convert To Lowercase  ${OPENBMC_MODEL} login: | 
| George Keishing | bfae2ff | 2016-11-28 04:16:10 -0600 | [diff] [blame] | 26 | Telnet.Open Connection | 
| Charles Paul Hofer | e0e1780 | 2017-09-21 09:19:33 -0500 | [diff] [blame] | 27 | ...  ${i_host}  port=${i_port}  prompt=# | 
| Charles Paul Hofer | 62fc3f0 | 2018-09-05 11:54:19 -0500 | [diff] [blame] | 28 | Telnet.Set Timeout  30 seconds | 
| Charles Paul Hofer | e0e1780 | 2017-09-21 09:19:33 -0500 | [diff] [blame] | 29 | Telnet.Set Newline  \n | 
|  | 30 | Telnet.Set Newline  CRLF | 
|  | 31 | Telnet.Write  \n | 
| Charles Paul Hofer | 62fc3f0 | 2018-09-05 11:54:19 -0500 | [diff] [blame] | 32 | Telnet.Write  exit | 
|  | 33 | Telnet.Write  \n | 
|  | 34 | Telnet.Read Until Regexp  (Password:|logout) | 
|  | 35 | Telnet.Write  \n | 
|  | 36 | Telnet.Read Until  ${prompt_string} | 
|  | 37 | Telnet.Write  ${OPENBMC_USERNAME} | 
|  | 38 | Telnet.Write  \n | 
|  | 39 | Telnet.Read Until  Password: | 
|  | 40 | Telnet.Write  ${OPENBMC_PASSWORD} | 
|  | 41 | Telnet.Write  \n | 
|  | 42 | Telnet.Read Until Prompt | 
| Charles Paul Hofer | e0e1780 | 2017-09-21 09:19:33 -0500 | [diff] [blame] | 43 | Telnet.Set Timeout  30 minute 30 seconds | 
| George Keishing | beec26d | 2016-11-09 06:57:28 -0600 | [diff] [blame] | 44 |  | 
|  | 45 |  | 
| Charles Paul Hofer | 6cd4d89 | 2017-10-12 15:13:36 -0500 | [diff] [blame] | 46 | Read And Log BMC Serial Console Output | 
| George Keishing | beec26d | 2016-11-09 06:57:28 -0600 | [diff] [blame] | 47 | [Documentation]    Reads everything that is currently available | 
|  | 48 | ...                in the output. | 
| Charles Paul Hofer | e0e1780 | 2017-09-21 09:19:33 -0500 | [diff] [blame] | 49 |  | 
| George Keishing | beec26d | 2016-11-09 06:57:28 -0600 | [diff] [blame] | 50 | ${bmc_serial_log}=   Telnet.Read | 
|  | 51 | Log   ${bmc_serial_log} | 
| Charles Paul Hofer | e0e1780 | 2017-09-21 09:19:33 -0500 | [diff] [blame] | 52 |  | 
|  | 53 |  | 
|  | 54 | Execute Command On Serial Console | 
|  | 55 | [Documentation]  Execute a command on the BMC serial console. | 
|  | 56 | [Arguments]  ${command_string} | 
|  | 57 |  | 
|  | 58 | # Description of argument(s): | 
|  | 59 | # command   The command to execute on the BMC. | 
|  | 60 |  | 
|  | 61 | Open Telnet Connection To BMC Serial Console | 
|  | 62 | Telnet.Write  \n | 
| Charles Paul Hofer | ac11247 | 2018-08-03 15:04:35 -0500 | [diff] [blame] | 63 | Telnet.Write  \n | 
| Charles Paul Hofer | e0e1780 | 2017-09-21 09:19:33 -0500 | [diff] [blame] | 64 | Telnet.Execute Command  ${command_string} | 
| Charles Paul Hofer | 6cd4d89 | 2017-10-12 15:13:36 -0500 | [diff] [blame] | 65 | Read And Log BMC Serial Console Output | 
| Charles Paul Hofer | e0e1780 | 2017-09-21 09:19:33 -0500 | [diff] [blame] | 66 | Close Serial Console Connection | 
|  | 67 |  | 
|  | 68 |  | 
|  | 69 | Close Serial Console Connection | 
|  | 70 | [Documentation]  Log out of the BMC and close telnet. | 
|  | 71 |  | 
| Charles Paul Hofer | 6cd4d89 | 2017-10-12 15:13:36 -0500 | [diff] [blame] | 72 | Telnet.Write  \n | 
|  | 73 | Telnet.Write  exit | 
| George Keishing | d54591a | 2018-07-10 13:05:14 -0500 | [diff] [blame] | 74 | Telnet.Close Connection |