Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation This suite is for testing syslog function of Open BMC. |
| 4 | |
| 5 | Resource ../lib/rest_client.robot |
| 6 | Resource ../lib/utils.robot |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 7 | Resource ../lib/connection_client.robot |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 8 | Resource ../lib/openbmc_ffdc.robot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 9 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 10 | Suite Setup Open Connection And Log In |
| 11 | Suite Teardown Close All Connections |
Gunnar Mills | eac1af2 | 2016-11-14 15:30:09 -0600 | [diff] [blame] | 12 | Test Teardown FFDC On Test Case Fail |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 13 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 14 | |
| 15 | *** Variables *** |
| 16 | ${INVALID_SYSLOG_IP_ADDRESS} a.ab.c.d |
| 17 | ${INVALID_SYSLOG_PORT} abc |
| 18 | ${SYSTEM_SHUTDOWN_TIME} 1min |
| 19 | ${WAIT_FOR_SERVICES_UP} 3min |
| 20 | |
| 21 | *** Test Cases *** |
| 22 | |
| 23 | Get all Syslog settings |
| 24 | [Documentation] ***GOOD PATH*** |
| 25 | ... This testcase is to get all syslog settings from |
| 26 | ... open bmc system.\n |
| 27 | |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 28 | ${ip_address}= Read Attribute |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 29 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog ipaddr |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 30 | Should Not Be Empty ${ip_address} |
| 31 | |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 32 | ${port}= Read Attribute |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 33 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog port |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 34 | Should Not Be Empty ${port} |
| 35 | |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 36 | ${status}= Read Attribute |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 37 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog status |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 38 | Should Not Be Empty ${status} |
| 39 | |
| 40 | Enable syslog with port number and IP address |
| 41 | [Documentation] ***GOOD PATH*** |
| 42 | ... This testcase is to enable syslog with both ip address |
| 43 | ... and port number of remote system.\n |
| 44 | |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 45 | ${resp}= Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${SYSLOG_PORT} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 46 | Should Be Equal ${resp} ok |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 47 | ${ip}= Read Attribute |
| 48 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog ipaddr |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 49 | Should Be Equal ${ip} ${SYSLOG_IP_ADDRESS} |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 50 | ${port}= Read Attribute |
| 51 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog port |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 52 | Should Be Equal ${port} ${SYSLOG_PORT} |
| 53 | |
| 54 | Enable syslog without IP address and port number |
| 55 | [Documentation] ***GOOD PATH*** |
| 56 | ... This testcase is to enable syslog without changing ip address |
| 57 | ... and port number.\n |
| 58 | |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 59 | ${resp}= Enable Syslog Setting ${EMPTY} ${EMPTY} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 60 | Should Be Equal ${resp} ok |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 61 | ${status}= Read Attribute |
| 62 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog status |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 63 | Should Be Equal ${status} Enabled |
| 64 | |
| 65 | Enable syslog with only IP address |
| 66 | [Documentation] ***GOOD PATH*** |
| 67 | ... This testcase is to enable syslog with only ip address.\n |
| 68 | |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 69 | ${resp}= Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${EMPTY} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 70 | Should Be Equal ${resp} ok |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 71 | ${ip}= Read Attribute |
| 72 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog ipaddr |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 73 | Should Be Equal ${ip} ${SYSLOG_IP_ADDRESS} |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 74 | ${status}= Read Attribute |
| 75 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog status |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 76 | Should Be Equal ${status} Enabled |
| 77 | |
| 78 | Enable Syslog with only port number |
| 79 | [Documentation] ***GOOD PATH*** |
| 80 | ... This testcase is to enable syslog with only port number.\n |
| 81 | |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 82 | ${status}= Read Attribute |
| 83 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog status |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 84 | Should Be Equal ${status} Enabled |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 85 | ${resp}= Enable Syslog Setting ${EMPTY} ${SYSLOG_PORT} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 86 | Should Be Equal ${resp} ok |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 87 | ${port}= Read Attribute |
| 88 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog port |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 89 | Should Be Equal ${port} ${SYSLOG_PORT} |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 90 | ${status}= Read Attribute |
| 91 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog status |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 92 | Should Be Equal ${status} Enabled |
| 93 | |
| 94 | Disable Syslog |
| 95 | [Documentation] ***GOOD PATH*** |
| 96 | ... This testcase is to verify disabling syslog.\n |
| 97 | |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 98 | ${resp}= Disable Syslog Setting ${EMPTY} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 99 | Should Be Equal ${resp} ok |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 100 | ${status}= Read Attribute |
| 101 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog status |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 102 | Should Be Equal Disable ${status} |
| 103 | |
| 104 | Enable invalid ip for Syslog remote server |
| 105 | [Documentation] ***BAD PATH*** |
| 106 | ... This testcase is to verify error while enabling syslog with |
| 107 | ... invalid ip address.\n |
| 108 | |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 109 | ${resp}= Enable Syslog Setting ${INVALID_SYSLOG_IP_ADDRESS} ${SYSLOG_PORT} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 110 | Should Be Equal ${resp} error |
| 111 | |
| 112 | Enable invalid port for Syslog remote server |
| 113 | [Documentation] ***BAD PATH*** |
| 114 | ... This testcase is to verify error while enabling syslog with |
| 115 | ... invalid port number.\n |
| 116 | |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 117 | ${resp}= Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${INVALID_SYSLOG_PORT} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 118 | Should Be Equal ${resp} error |
| 119 | |
| 120 | |
| 121 | Persistency check for syslog setting |
| 122 | [Documentation] This test case is to verify that syslog setting does not change |
| 123 | ... after service processor reboot. |
causten | 147f575 | 2016-08-11 16:24:45 -0500 | [diff] [blame] | 124 | [Tags] bmcreboot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 125 | |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 126 | ${old_ip}= Read Attribute |
| 127 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog ipaddr |
| 128 | ${old_port}= Read Attribute |
| 129 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog port |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 130 | ${old_status}= Read Attribute |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 131 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog status |
| 132 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 133 | ${output}= Execute Command /sbin/reboot |
| 134 | Sleep ${SYSTEM_SHUTDOWN_TIME} |
| 135 | Wait For Host To Ping ${OPENBMC_HOST} |
| 136 | Sleep ${WAIT_FOR_SERVICES_UP} |
| 137 | |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 138 | ${ip_address}= Read Attribute |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 139 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog ipaddr |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 140 | ${port}= Read Attribute |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 141 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog port |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 142 | ${status}= Read Attribute |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 143 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog status |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 144 | |
| 145 | Should Be Equal ${old_ip} ${ip_address} |
| 146 | Should Be Equal ${old_port} ${port} |
| 147 | Should Be Equal ${old_status} ${status} |
| 148 | |
| 149 | *** Keywords *** |
| 150 | |
| 151 | Enable Syslog Setting |
| 152 | [Arguments] ${ipaddr} ${port} |
| 153 | ${MYDICT}= create Dictionary ipaddr=${ipaddr} port=${port} |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 154 | @{rsyslog}= Create List ${MYDICT} |
| 155 | ${data}= create dictionary data=@{rsyslog} |
| 156 | ${resp}= openbmc post request |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 157 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog/action/Enable data=${data} |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 158 | ${jsondata}= to json ${resp.content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 159 | [return] ${jsondata['status']} |
| 160 | |
| 161 | Disable Syslog Setting |
| 162 | [Arguments] ${args} |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 163 | @{setting_list}= Create List ${args} |
| 164 | ${data}= create dictionary data=@{setting_list} |
| 165 | ${resp}= OpenBMC Post Request |
George Keishing | 0fd3b24 | 2016-11-24 09:01:41 -0600 | [diff] [blame] | 166 | ... ${OPENBMC_BASE_URI}LogManager/rsyslog/action/Disable data=${data} |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 167 | ${jsondata}= to json ${resp.content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 168 | [return] ${jsondata['status']} |