blob: a98fd7fcbde9623f29e8fec0676ac48342d11494 [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
Chris Austenb29d2e82016-06-07 12:25:35 -05008
George Keishing4d6c1da2016-07-15 05:51:22 -05009Suite Setup Open Connection And Log In
10Suite Teardown Close All Connections
11
Chris Austenb29d2e82016-06-07 12:25:35 -050012
13*** Variables ***
14${INVALID_SYSLOG_IP_ADDRESS} a.ab.c.d
15${INVALID_SYSLOG_PORT} abc
16${SYSTEM_SHUTDOWN_TIME} 1min
17${WAIT_FOR_SERVICES_UP} 3min
18
19*** Test Cases ***
20
21Get all Syslog settings
22 [Documentation] ***GOOD PATH***
23 ... This testcase is to get all syslog settings from
24 ... open bmc system.\n
25
26 ${ip_address} = Read Attribute /org/openbmc/LogManager/rsyslog ipaddr
27 Should Not Be Empty ${ip_address}
28
29 ${port} = Read Attribute /org/openbmc/LogManager/rsyslog port
30 Should Not Be Empty ${port}
31
32 ${status} = Read Attribute /org/openbmc/LogManager/rsyslog status
33 Should Not Be Empty ${status}
34
35Enable syslog with port number and IP address
36 [Documentation] ***GOOD PATH***
37 ... This testcase is to enable syslog with both ip address
38 ... and port number of remote system.\n
39
40 ${resp} = Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${SYSLOG_PORT}
41 Should Be Equal ${resp} ok
42 ${ip}= Read Attribute /org/openbmc/LogManager/rsyslog ipaddr
43 Should Be Equal ${ip} ${SYSLOG_IP_ADDRESS}
44 ${port}= Read Attribute /org/openbmc/LogManager/rsyslog port
45 Should Be Equal ${port} ${SYSLOG_PORT}
46
47Enable syslog without IP address and port number
48 [Documentation] ***GOOD PATH***
49 ... This testcase is to enable syslog without changing ip address
50 ... and port number.\n
51
52 ${resp} = Enable Syslog Setting ${EMPTY} ${EMPTY}
53 Should Be Equal ${resp} ok
54 ${status}= Read Attribute /org/openbmc/LogManager/rsyslog status
55 Should Be Equal ${status} Enabled
56
57Enable syslog with only IP address
58 [Documentation] ***GOOD PATH***
59 ... This testcase is to enable syslog with only ip address.\n
60
61 ${resp} = Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${EMPTY}
62 Should Be Equal ${resp} ok
63 ${ip}= Read Attribute /org/openbmc/LogManager/rsyslog ipaddr
64 Should Be Equal ${ip} ${SYSLOG_IP_ADDRESS}
65 ${status}= Read Attribute /org/openbmc/LogManager/rsyslog status
66 Should Be Equal ${status} Enabled
67
68Enable Syslog with only port number
69 [Documentation] ***GOOD PATH***
70 ... This testcase is to enable syslog with only port number.\n
71
72 ${status}= Read Attribute /org/openbmc/LogManager/rsyslog status
73 Should Be Equal ${status} Enabled
74 ${resp} = Enable Syslog Setting ${EMPTY} ${SYSLOG_PORT}
75 Should Be Equal ${resp} ok
76 ${port}= Read Attribute /org/openbmc/LogManager/rsyslog port
77 Should Be Equal ${port} ${SYSLOG_PORT}
78 ${status}= Read Attribute /org/openbmc/LogManager/rsyslog status
79 Should Be Equal ${status} Enabled
80
81Disable Syslog
82 [Documentation] ***GOOD PATH***
83 ... This testcase is to verify disabling syslog.\n
84
85 ${resp} = Disable Syslog Setting ${EMPTY}
86 Should Be Equal ${resp} ok
87 ${status}= Read Attribute /org/openbmc/LogManager/rsyslog status
88 Should Be Equal Disable ${status}
89
90Enable invalid ip for Syslog remote server
91 [Documentation] ***BAD PATH***
92 ... This testcase is to verify error while enabling syslog with
93 ... invalid ip address.\n
94
95 ${resp} = Enable Syslog Setting ${INVALID_SYSLOG_IP_ADDRESS} ${SYSLOG_PORT}
96 Should Be Equal ${resp} error
97
98Enable invalid port for Syslog remote server
99 [Documentation] ***BAD PATH***
100 ... This testcase is to verify error while enabling syslog with
101 ... invalid port number.\n
102
103 ${resp} = Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${INVALID_SYSLOG_PORT}
104 Should Be Equal ${resp} error
105
106
107Persistency check for syslog setting
108 [Documentation] This test case is to verify that syslog setting does not change
109 ... after service processor reboot.
causten147f5752016-08-11 16:24:45 -0500110 [Tags] bmcreboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500111
112 ${old_ip}= Read Attribute /org/openbmc/LogManager/rsyslog ipaddr
113 ${old_port}= Read Attribute /org/openbmc/LogManager/rsyslog port
114 ${old_status} = Read Attribute /org/openbmc/LogManager/rsyslog status
115
Chris Austenb29d2e82016-06-07 12:25:35 -0500116 ${output}= Execute Command /sbin/reboot
117 Sleep ${SYSTEM_SHUTDOWN_TIME}
118 Wait For Host To Ping ${OPENBMC_HOST}
119 Sleep ${WAIT_FOR_SERVICES_UP}
120
121 ${ip_address} = Read Attribute /org/openbmc/LogManager/rsyslog ipaddr
122 ${port} = Read Attribute /org/openbmc/LogManager/rsyslog port
123 ${status} = Read Attribute /org/openbmc/LogManager/rsyslog status
124
125 Should Be Equal ${old_ip} ${ip_address}
126 Should Be Equal ${old_port} ${port}
127 Should Be Equal ${old_status} ${status}
128
129*** Keywords ***
130
131Enable Syslog Setting
132 [Arguments] ${ipaddr} ${port}
133 ${MYDICT}= create Dictionary ipaddr=${ipaddr} port=${port}
134 @{rsyslog} = Create List ${MYDICT}
135 ${data} = create dictionary data=@{rsyslog}
136 ${resp} = openbmc post request /org/openbmc/LogManager/rsyslog/action/Enable data=${data}
137 ${jsondata} = to json ${resp.content}
138 [return] ${jsondata['status']}
139
140Disable Syslog Setting
141 [Arguments] ${args}
142 @{setting_list} = Create List ${args}
143 ${data} = create dictionary data=@{setting_list}
144 ${resp} = OpenBMC Post Request /org/openbmc/LogManager/rsyslog/action/Disable data=${data}
145 ${jsondata} = to json ${resp.content}
146 [return] ${jsondata['status']}