blob: e87c4750f40f0e1fe2744e7f231f37522f43f6c4 [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
2
3Documentation This suite is for testing syslog function of Open BMC.
4
5Resource ../lib/rest_client.robot
6Resource ../lib/utils.robot
George Keishing4d6c1da2016-07-15 05:51:22 -05007Resource ../lib/connection_client.robot
George Keishingd55a4be2016-08-26 03:28:17 -05008Resource ../lib/openbmc_ffdc.robot
Chris Austenb29d2e82016-06-07 12:25:35 -05009
George Keishing4d6c1da2016-07-15 05:51:22 -050010Suite Setup Open Connection And Log In
11Suite Teardown Close All Connections
Gunnar Millseac1af22016-11-14 15:30:09 -060012Test Teardown FFDC On Test Case Fail
George Keishing4d6c1da2016-07-15 05:51:22 -050013
Chris Austenb29d2e82016-06-07 12:25:35 -050014
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
23Get all Syslog settings
24 [Documentation] ***GOOD PATH***
25 ... This testcase is to get all syslog settings from
26 ... open bmc system.\n
27
Gunnar Mills597ffa02016-12-06 11:26:53 -060028 ${ip_address}= Read Attribute
George Keishing0fd3b242016-11-24 09:01:41 -060029 ... ${OPENBMC_BASE_URI}LogManager/rsyslog ipaddr
Chris Austenb29d2e82016-06-07 12:25:35 -050030 Should Not Be Empty ${ip_address}
31
Gunnar Mills597ffa02016-12-06 11:26:53 -060032 ${port}= Read Attribute
George Keishing0fd3b242016-11-24 09:01:41 -060033 ... ${OPENBMC_BASE_URI}LogManager/rsyslog port
Chris Austenb29d2e82016-06-07 12:25:35 -050034 Should Not Be Empty ${port}
35
Gunnar Mills597ffa02016-12-06 11:26:53 -060036 ${status}= Read Attribute
George Keishing0fd3b242016-11-24 09:01:41 -060037 ... ${OPENBMC_BASE_URI}LogManager/rsyslog status
Chris Austenb29d2e82016-06-07 12:25:35 -050038 Should Not Be Empty ${status}
39
40Enable 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 Mills597ffa02016-12-06 11:26:53 -060045 ${resp}= Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${SYSLOG_PORT}
Chris Austenb29d2e82016-06-07 12:25:35 -050046 Should Be Equal ${resp} ok
George Keishing0fd3b242016-11-24 09:01:41 -060047 ${ip}= Read Attribute
48 ... ${OPENBMC_BASE_URI}LogManager/rsyslog ipaddr
Chris Austenb29d2e82016-06-07 12:25:35 -050049 Should Be Equal ${ip} ${SYSLOG_IP_ADDRESS}
George Keishing0fd3b242016-11-24 09:01:41 -060050 ${port}= Read Attribute
51 ... ${OPENBMC_BASE_URI}LogManager/rsyslog port
Chris Austenb29d2e82016-06-07 12:25:35 -050052 Should Be Equal ${port} ${SYSLOG_PORT}
53
54Enable 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 Mills597ffa02016-12-06 11:26:53 -060059 ${resp}= Enable Syslog Setting ${EMPTY} ${EMPTY}
Chris Austenb29d2e82016-06-07 12:25:35 -050060 Should Be Equal ${resp} ok
George Keishing0fd3b242016-11-24 09:01:41 -060061 ${status}= Read Attribute
62 ... ${OPENBMC_BASE_URI}LogManager/rsyslog status
Chris Austenb29d2e82016-06-07 12:25:35 -050063 Should Be Equal ${status} Enabled
64
65Enable syslog with only IP address
66 [Documentation] ***GOOD PATH***
67 ... This testcase is to enable syslog with only ip address.\n
68
Gunnar Mills597ffa02016-12-06 11:26:53 -060069 ${resp}= Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${EMPTY}
Chris Austenb29d2e82016-06-07 12:25:35 -050070 Should Be Equal ${resp} ok
George Keishing0fd3b242016-11-24 09:01:41 -060071 ${ip}= Read Attribute
72 ... ${OPENBMC_BASE_URI}LogManager/rsyslog ipaddr
Chris Austenb29d2e82016-06-07 12:25:35 -050073 Should Be Equal ${ip} ${SYSLOG_IP_ADDRESS}
George Keishing0fd3b242016-11-24 09:01:41 -060074 ${status}= Read Attribute
75 ... ${OPENBMC_BASE_URI}LogManager/rsyslog status
Chris Austenb29d2e82016-06-07 12:25:35 -050076 Should Be Equal ${status} Enabled
77
78Enable Syslog with only port number
79 [Documentation] ***GOOD PATH***
80 ... This testcase is to enable syslog with only port number.\n
81
George Keishing0fd3b242016-11-24 09:01:41 -060082 ${status}= Read Attribute
83 ... ${OPENBMC_BASE_URI}LogManager/rsyslog status
Chris Austenb29d2e82016-06-07 12:25:35 -050084 Should Be Equal ${status} Enabled
Gunnar Mills597ffa02016-12-06 11:26:53 -060085 ${resp}= Enable Syslog Setting ${EMPTY} ${SYSLOG_PORT}
Chris Austenb29d2e82016-06-07 12:25:35 -050086 Should Be Equal ${resp} ok
George Keishing0fd3b242016-11-24 09:01:41 -060087 ${port}= Read Attribute
88 ... ${OPENBMC_BASE_URI}LogManager/rsyslog port
Chris Austenb29d2e82016-06-07 12:25:35 -050089 Should Be Equal ${port} ${SYSLOG_PORT}
George Keishing0fd3b242016-11-24 09:01:41 -060090 ${status}= Read Attribute
91 ... ${OPENBMC_BASE_URI}LogManager/rsyslog status
Chris Austenb29d2e82016-06-07 12:25:35 -050092 Should Be Equal ${status} Enabled
93
94Disable Syslog
95 [Documentation] ***GOOD PATH***
96 ... This testcase is to verify disabling syslog.\n
97
Gunnar Mills597ffa02016-12-06 11:26:53 -060098 ${resp}= Disable Syslog Setting ${EMPTY}
Chris Austenb29d2e82016-06-07 12:25:35 -050099 Should Be Equal ${resp} ok
George Keishing0fd3b242016-11-24 09:01:41 -0600100 ${status}= Read Attribute
101 ... ${OPENBMC_BASE_URI}LogManager/rsyslog status
Chris Austenb29d2e82016-06-07 12:25:35 -0500102 Should Be Equal Disable ${status}
103
104Enable 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 Mills597ffa02016-12-06 11:26:53 -0600109 ${resp}= Enable Syslog Setting ${INVALID_SYSLOG_IP_ADDRESS} ${SYSLOG_PORT}
Chris Austenb29d2e82016-06-07 12:25:35 -0500110 Should Be Equal ${resp} error
111
112Enable 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 Mills597ffa02016-12-06 11:26:53 -0600117 ${resp}= Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${INVALID_SYSLOG_PORT}
Chris Austenb29d2e82016-06-07 12:25:35 -0500118 Should Be Equal ${resp} error
119
120
121Persistency check for syslog setting
122 [Documentation] This test case is to verify that syslog setting does not change
123 ... after service processor reboot.
causten147f5752016-08-11 16:24:45 -0500124 [Tags] bmcreboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500125
George Keishing0fd3b242016-11-24 09:01:41 -0600126 ${old_ip}= Read Attribute
127 ... ${OPENBMC_BASE_URI}LogManager/rsyslog ipaddr
128 ${old_port}= Read Attribute
129 ... ${OPENBMC_BASE_URI}LogManager/rsyslog port
Gunnar Mills597ffa02016-12-06 11:26:53 -0600130 ${old_status}= Read Attribute
George Keishing0fd3b242016-11-24 09:01:41 -0600131 ... ${OPENBMC_BASE_URI}LogManager/rsyslog status
132
Chris Austenb29d2e82016-06-07 12:25:35 -0500133 ${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 Mills597ffa02016-12-06 11:26:53 -0600138 ${ip_address}= Read Attribute
George Keishing0fd3b242016-11-24 09:01:41 -0600139 ... ${OPENBMC_BASE_URI}LogManager/rsyslog ipaddr
Gunnar Mills597ffa02016-12-06 11:26:53 -0600140 ${port}= Read Attribute
George Keishing0fd3b242016-11-24 09:01:41 -0600141 ... ${OPENBMC_BASE_URI}LogManager/rsyslog port
Gunnar Mills597ffa02016-12-06 11:26:53 -0600142 ${status}= Read Attribute
George Keishing0fd3b242016-11-24 09:01:41 -0600143 ... ${OPENBMC_BASE_URI}LogManager/rsyslog status
Chris Austenb29d2e82016-06-07 12:25:35 -0500144
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
151Enable Syslog Setting
152 [Arguments] ${ipaddr} ${port}
153 ${MYDICT}= create Dictionary ipaddr=${ipaddr} port=${port}
Gunnar Mills597ffa02016-12-06 11:26:53 -0600154 @{rsyslog}= Create List ${MYDICT}
155 ${data}= create dictionary data=@{rsyslog}
156 ${resp}= openbmc post request
George Keishing0fd3b242016-11-24 09:01:41 -0600157 ... ${OPENBMC_BASE_URI}LogManager/rsyslog/action/Enable data=${data}
Gunnar Mills597ffa02016-12-06 11:26:53 -0600158 ${jsondata}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500159 [return] ${jsondata['status']}
160
161Disable Syslog Setting
162 [Arguments] ${args}
Gunnar Mills597ffa02016-12-06 11:26:53 -0600163 @{setting_list}= Create List ${args}
164 ${data}= create dictionary data=@{setting_list}
165 ${resp}= OpenBMC Post Request
George Keishing0fd3b242016-11-24 09:01:41 -0600166 ... ${OPENBMC_BASE_URI}LogManager/rsyslog/action/Disable data=${data}
Gunnar Mills597ffa02016-12-06 11:26:53 -0600167 ${jsondata}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500168 [return] ${jsondata['status']}