blob: 3b9a409ee554822274c2ffabce4d97e515919783 [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.
110
111 ${old_ip}= Read Attribute /org/openbmc/LogManager/rsyslog ipaddr
112 ${old_port}= Read Attribute /org/openbmc/LogManager/rsyslog port
113 ${old_status} = Read Attribute /org/openbmc/LogManager/rsyslog status
114
Chris Austenb29d2e82016-06-07 12:25:35 -0500115 ${output}= Execute Command /sbin/reboot
116 Sleep ${SYSTEM_SHUTDOWN_TIME}
117 Wait For Host To Ping ${OPENBMC_HOST}
118 Sleep ${WAIT_FOR_SERVICES_UP}
119
120 ${ip_address} = Read Attribute /org/openbmc/LogManager/rsyslog ipaddr
121 ${port} = Read Attribute /org/openbmc/LogManager/rsyslog port
122 ${status} = Read Attribute /org/openbmc/LogManager/rsyslog status
123
124 Should Be Equal ${old_ip} ${ip_address}
125 Should Be Equal ${old_port} ${port}
126 Should Be Equal ${old_status} ${status}
127
128*** Keywords ***
129
130Enable Syslog Setting
131 [Arguments] ${ipaddr} ${port}
132 ${MYDICT}= create Dictionary ipaddr=${ipaddr} port=${port}
133 @{rsyslog} = Create List ${MYDICT}
134 ${data} = create dictionary data=@{rsyslog}
135 ${resp} = openbmc post request /org/openbmc/LogManager/rsyslog/action/Enable data=${data}
136 ${jsondata} = to json ${resp.content}
137 [return] ${jsondata['status']}
138
139Disable Syslog Setting
140 [Arguments] ${args}
141 @{setting_list} = Create List ${args}
142 ${data} = create dictionary data=@{setting_list}
143 ${resp} = OpenBMC Post Request /org/openbmc/LogManager/rsyslog/action/Disable data=${data}
144 ${jsondata} = to json ${resp.content}
145 [return] ${jsondata['status']}