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 | |
| 28 | ${ip_address} = Read Attribute /org/openbmc/LogManager/rsyslog ipaddr |
| 29 | Should Not Be Empty ${ip_address} |
| 30 | |
| 31 | ${port} = Read Attribute /org/openbmc/LogManager/rsyslog port |
| 32 | Should Not Be Empty ${port} |
| 33 | |
| 34 | ${status} = Read Attribute /org/openbmc/LogManager/rsyslog status |
| 35 | Should Not Be Empty ${status} |
| 36 | |
| 37 | Enable syslog with port number and IP address |
| 38 | [Documentation] ***GOOD PATH*** |
| 39 | ... This testcase is to enable syslog with both ip address |
| 40 | ... and port number of remote system.\n |
| 41 | |
| 42 | ${resp} = Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${SYSLOG_PORT} |
| 43 | Should Be Equal ${resp} ok |
| 44 | ${ip}= Read Attribute /org/openbmc/LogManager/rsyslog ipaddr |
| 45 | Should Be Equal ${ip} ${SYSLOG_IP_ADDRESS} |
| 46 | ${port}= Read Attribute /org/openbmc/LogManager/rsyslog port |
| 47 | Should Be Equal ${port} ${SYSLOG_PORT} |
| 48 | |
| 49 | Enable syslog without IP address and port number |
| 50 | [Documentation] ***GOOD PATH*** |
| 51 | ... This testcase is to enable syslog without changing ip address |
| 52 | ... and port number.\n |
| 53 | |
| 54 | ${resp} = Enable Syslog Setting ${EMPTY} ${EMPTY} |
| 55 | Should Be Equal ${resp} ok |
| 56 | ${status}= Read Attribute /org/openbmc/LogManager/rsyslog status |
| 57 | Should Be Equal ${status} Enabled |
| 58 | |
| 59 | Enable syslog with only IP address |
| 60 | [Documentation] ***GOOD PATH*** |
| 61 | ... This testcase is to enable syslog with only ip address.\n |
| 62 | |
| 63 | ${resp} = Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${EMPTY} |
| 64 | Should Be Equal ${resp} ok |
| 65 | ${ip}= Read Attribute /org/openbmc/LogManager/rsyslog ipaddr |
| 66 | Should Be Equal ${ip} ${SYSLOG_IP_ADDRESS} |
| 67 | ${status}= Read Attribute /org/openbmc/LogManager/rsyslog status |
| 68 | Should Be Equal ${status} Enabled |
| 69 | |
| 70 | Enable Syslog with only port number |
| 71 | [Documentation] ***GOOD PATH*** |
| 72 | ... This testcase is to enable syslog with only port number.\n |
| 73 | |
| 74 | ${status}= Read Attribute /org/openbmc/LogManager/rsyslog status |
| 75 | Should Be Equal ${status} Enabled |
| 76 | ${resp} = Enable Syslog Setting ${EMPTY} ${SYSLOG_PORT} |
| 77 | Should Be Equal ${resp} ok |
| 78 | ${port}= Read Attribute /org/openbmc/LogManager/rsyslog port |
| 79 | Should Be Equal ${port} ${SYSLOG_PORT} |
| 80 | ${status}= Read Attribute /org/openbmc/LogManager/rsyslog status |
| 81 | Should Be Equal ${status} Enabled |
| 82 | |
| 83 | Disable Syslog |
| 84 | [Documentation] ***GOOD PATH*** |
| 85 | ... This testcase is to verify disabling syslog.\n |
| 86 | |
| 87 | ${resp} = Disable Syslog Setting ${EMPTY} |
| 88 | Should Be Equal ${resp} ok |
| 89 | ${status}= Read Attribute /org/openbmc/LogManager/rsyslog status |
| 90 | Should Be Equal Disable ${status} |
| 91 | |
| 92 | Enable invalid ip for Syslog remote server |
| 93 | [Documentation] ***BAD PATH*** |
| 94 | ... This testcase is to verify error while enabling syslog with |
| 95 | ... invalid ip address.\n |
| 96 | |
| 97 | ${resp} = Enable Syslog Setting ${INVALID_SYSLOG_IP_ADDRESS} ${SYSLOG_PORT} |
| 98 | Should Be Equal ${resp} error |
| 99 | |
| 100 | Enable invalid port for Syslog remote server |
| 101 | [Documentation] ***BAD PATH*** |
| 102 | ... This testcase is to verify error while enabling syslog with |
| 103 | ... invalid port number.\n |
| 104 | |
| 105 | ${resp} = Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${INVALID_SYSLOG_PORT} |
| 106 | Should Be Equal ${resp} error |
| 107 | |
| 108 | |
| 109 | Persistency check for syslog setting |
| 110 | [Documentation] This test case is to verify that syslog setting does not change |
| 111 | ... after service processor reboot. |
causten | 147f575 | 2016-08-11 16:24:45 -0500 | [diff] [blame] | 112 | [Tags] bmcreboot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 113 | |
| 114 | ${old_ip}= Read Attribute /org/openbmc/LogManager/rsyslog ipaddr |
| 115 | ${old_port}= Read Attribute /org/openbmc/LogManager/rsyslog port |
| 116 | ${old_status} = Read Attribute /org/openbmc/LogManager/rsyslog status |
| 117 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 118 | ${output}= Execute Command /sbin/reboot |
| 119 | Sleep ${SYSTEM_SHUTDOWN_TIME} |
| 120 | Wait For Host To Ping ${OPENBMC_HOST} |
| 121 | Sleep ${WAIT_FOR_SERVICES_UP} |
| 122 | |
| 123 | ${ip_address} = Read Attribute /org/openbmc/LogManager/rsyslog ipaddr |
| 124 | ${port} = Read Attribute /org/openbmc/LogManager/rsyslog port |
| 125 | ${status} = Read Attribute /org/openbmc/LogManager/rsyslog status |
| 126 | |
| 127 | Should Be Equal ${old_ip} ${ip_address} |
| 128 | Should Be Equal ${old_port} ${port} |
| 129 | Should Be Equal ${old_status} ${status} |
| 130 | |
| 131 | *** Keywords *** |
| 132 | |
| 133 | Enable Syslog Setting |
| 134 | [Arguments] ${ipaddr} ${port} |
| 135 | ${MYDICT}= create Dictionary ipaddr=${ipaddr} port=${port} |
| 136 | @{rsyslog} = Create List ${MYDICT} |
| 137 | ${data} = create dictionary data=@{rsyslog} |
| 138 | ${resp} = openbmc post request /org/openbmc/LogManager/rsyslog/action/Enable data=${data} |
| 139 | ${jsondata} = to json ${resp.content} |
| 140 | [return] ${jsondata['status']} |
| 141 | |
| 142 | Disable Syslog Setting |
| 143 | [Arguments] ${args} |
| 144 | @{setting_list} = Create List ${args} |
| 145 | ${data} = create dictionary data=@{setting_list} |
| 146 | ${resp} = OpenBMC Post Request /org/openbmc/LogManager/rsyslog/action/Disable data=${data} |
| 147 | ${jsondata} = to json ${resp.content} |
| 148 | [return] ${jsondata['status']} |