blob: c8dab97ece0976e514b17e8c43c25da315273b54 [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
George Keishing0fd3b242016-11-24 09:01:41 -060028 ${ip_address} = Read Attribute
29 ... ${OPENBMC_BASE_URI}LogManager/rsyslog ipaddr
Chris Austenb29d2e82016-06-07 12:25:35 -050030 Should Not Be Empty ${ip_address}
31
George Keishing0fd3b242016-11-24 09:01:41 -060032 ${port} = Read Attribute
33 ... ${OPENBMC_BASE_URI}LogManager/rsyslog port
Chris Austenb29d2e82016-06-07 12:25:35 -050034 Should Not Be Empty ${port}
35
George Keishing0fd3b242016-11-24 09:01:41 -060036 ${status} = Read Attribute
37 ... ${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
45 ${resp} = Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${SYSLOG_PORT}
46 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
59 ${resp} = Enable Syslog Setting ${EMPTY} ${EMPTY}
60 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
69 ${resp} = Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${EMPTY}
70 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
85 ${resp} = Enable Syslog Setting ${EMPTY} ${SYSLOG_PORT}
86 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
98 ${resp} = Disable Syslog Setting ${EMPTY}
99 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
109 ${resp} = Enable Syslog Setting ${INVALID_SYSLOG_IP_ADDRESS} ${SYSLOG_PORT}
110 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
117 ${resp} = Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${INVALID_SYSLOG_PORT}
118 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
130 ${old_status} = Read Attribute
131 ... ${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
George Keishing0fd3b242016-11-24 09:01:41 -0600138 ${ip_address} = Read Attribute
139 ... ${OPENBMC_BASE_URI}LogManager/rsyslog ipaddr
140 ${port} = Read Attribute
141 ... ${OPENBMC_BASE_URI}LogManager/rsyslog port
142 ${status} = Read Attribute
143 ... ${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}
154 @{rsyslog} = Create List ${MYDICT}
155 ${data} = create dictionary data=@{rsyslog}
George Keishing0fd3b242016-11-24 09:01:41 -0600156 ${resp} = openbmc post request
157 ... ${OPENBMC_BASE_URI}LogManager/rsyslog/action/Enable data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -0500158 ${jsondata} = to json ${resp.content}
159 [return] ${jsondata['status']}
160
161Disable Syslog Setting
162 [Arguments] ${args}
163 @{setting_list} = Create List ${args}
164 ${data} = create dictionary data=@{setting_list}
George Keishing0fd3b242016-11-24 09:01:41 -0600165 ${resp} = OpenBMC Post Request
166 ... ${OPENBMC_BASE_URI}LogManager/rsyslog/action/Disable data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -0500167 ${jsondata} = to json ${resp.content}
168 [return] ${jsondata['status']}