blob: 92a52609a146436076e7786c207d5bfdfd223011 [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
7Resource ../lib/ipmi_client.robot
8
9Library OperatingSystem
10Library SSHLibrary
11
12*** Variables ***
13${INVALID_SYSLOG_IP_ADDRESS} a.ab.c.d
14${INVALID_SYSLOG_PORT} abc
15${SYSTEM_SHUTDOWN_TIME} 1min
16${WAIT_FOR_SERVICES_UP} 3min
17
18*** Test Cases ***
19
20Get all Syslog settings
21 [Documentation] ***GOOD PATH***
22 ... This testcase is to get all syslog settings from
23 ... open bmc system.\n
24
25 ${ip_address} = Read Attribute /org/openbmc/LogManager/rsyslog ipaddr
26 Should Not Be Empty ${ip_address}
27
28 ${port} = Read Attribute /org/openbmc/LogManager/rsyslog port
29 Should Not Be Empty ${port}
30
31 ${status} = Read Attribute /org/openbmc/LogManager/rsyslog status
32 Should Not Be Empty ${status}
33
34Enable syslog with port number and IP address
35 [Documentation] ***GOOD PATH***
36 ... This testcase is to enable syslog with both ip address
37 ... and port number of remote system.\n
38
39 ${resp} = Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${SYSLOG_PORT}
40 Should Be Equal ${resp} ok
41 ${ip}= Read Attribute /org/openbmc/LogManager/rsyslog ipaddr
42 Should Be Equal ${ip} ${SYSLOG_IP_ADDRESS}
43 ${port}= Read Attribute /org/openbmc/LogManager/rsyslog port
44 Should Be Equal ${port} ${SYSLOG_PORT}
45
46Enable syslog without IP address and port number
47 [Documentation] ***GOOD PATH***
48 ... This testcase is to enable syslog without changing ip address
49 ... and port number.\n
50
51 ${resp} = Enable Syslog Setting ${EMPTY} ${EMPTY}
52 Should Be Equal ${resp} ok
53 ${status}= Read Attribute /org/openbmc/LogManager/rsyslog status
54 Should Be Equal ${status} Enabled
55
56Enable syslog with only IP address
57 [Documentation] ***GOOD PATH***
58 ... This testcase is to enable syslog with only ip address.\n
59
60 ${resp} = Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${EMPTY}
61 Should Be Equal ${resp} ok
62 ${ip}= Read Attribute /org/openbmc/LogManager/rsyslog ipaddr
63 Should Be Equal ${ip} ${SYSLOG_IP_ADDRESS}
64 ${status}= Read Attribute /org/openbmc/LogManager/rsyslog status
65 Should Be Equal ${status} Enabled
66
67Enable Syslog with only port number
68 [Documentation] ***GOOD PATH***
69 ... This testcase is to enable syslog with only port number.\n
70
71 ${status}= Read Attribute /org/openbmc/LogManager/rsyslog status
72 Should Be Equal ${status} Enabled
73 ${resp} = Enable Syslog Setting ${EMPTY} ${SYSLOG_PORT}
74 Should Be Equal ${resp} ok
75 ${port}= Read Attribute /org/openbmc/LogManager/rsyslog port
76 Should Be Equal ${port} ${SYSLOG_PORT}
77 ${status}= Read Attribute /org/openbmc/LogManager/rsyslog status
78 Should Be Equal ${status} Enabled
79
80Disable Syslog
81 [Documentation] ***GOOD PATH***
82 ... This testcase is to verify disabling syslog.\n
83
84 ${resp} = Disable Syslog Setting ${EMPTY}
85 Should Be Equal ${resp} ok
86 ${status}= Read Attribute /org/openbmc/LogManager/rsyslog status
87 Should Be Equal Disable ${status}
88
89Enable invalid ip for Syslog remote server
90 [Documentation] ***BAD PATH***
91 ... This testcase is to verify error while enabling syslog with
92 ... invalid ip address.\n
93
94 ${resp} = Enable Syslog Setting ${INVALID_SYSLOG_IP_ADDRESS} ${SYSLOG_PORT}
95 Should Be Equal ${resp} error
96
97Enable invalid port for Syslog remote server
98 [Documentation] ***BAD PATH***
99 ... This testcase is to verify error while enabling syslog with
100 ... invalid port number.\n
101
102 ${resp} = Enable Syslog Setting ${SYSLOG_IP_ADDRESS} ${INVALID_SYSLOG_PORT}
103 Should Be Equal ${resp} error
104
105
106Persistency check for syslog setting
107 [Documentation] This test case is to verify that syslog setting does not change
108 ... after service processor reboot.
109
110 ${old_ip}= Read Attribute /org/openbmc/LogManager/rsyslog ipaddr
111 ${old_port}= Read Attribute /org/openbmc/LogManager/rsyslog port
112 ${old_status} = Read Attribute /org/openbmc/LogManager/rsyslog status
113
114 Open Connection And Log In
115 ${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']}