blob: d2004c77e421d61eeba5a6275c9ad0885bae462d [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
George Keishingd55a4be2016-08-26 03:28:17 -050012Test Teardown Log FFDC
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
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
37Enable 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
49Enable 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
59Enable 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
70Enable 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
83Disable 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
92Enable 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
100Enable 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
109Persistency check for syslog setting
110 [Documentation] This test case is to verify that syslog setting does not change
111 ... after service processor reboot.
causten147f5752016-08-11 16:24:45 -0500112 [Tags] bmcreboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500113
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 Austenb29d2e82016-06-07 12:25:35 -0500118 ${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
133Enable 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
142Disable 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']}