-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_sensors_dbus.robot
182 lines (163 loc) · 7.98 KB
/
test_sensors_dbus.robot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
*** Settings ***
Documentation This example demonstrates executing dbus-send commands on
... a remote machine to test its sensors and getting their
... output and the return code.
...
... Notice how connections are handled as part of the suite setup and
... teardown. This saves some time when executing several test cases.
Library ../data/model.py
Library OperatingSystem
Library SSHLibrary
Library String
Resource ../lib/rest_client.robot
Suite Setup Open Connection And Log In
Suite Teardown Close All Connections
*** Variables ***
${model} = ${OPENBMC_MODEL}
${interface} = org.openbmc.SensorValue.
${method} = getValue
${dbuspart1cmd} = dbus-send --system --print-reply=literal --dest=org.openbmc.Sensors
*** Test Cases ***
Dbusway Execute Set Sensor boot count
${obj} = Set Variable /org/openbmc/sensors/host/BootCount
${valuetoset} = Set Variable int32:${5}
${method} = Set Variable setValue
${output} = Dbus Send Set Command ${obj} ${method} ${valuetoset}
Log to Console \n ${output}
${prevaluetocompare} ${postvaluetocompare} = Split String ${valuetoset} :
${listtocompare} = Catenate ${prevaluetocompare} ${postvaluetocompare}
${method} = Set Variable getValue
${output} = Dbus Send Get Command ${obj} ${method}
${output} = Remove String ${output} variant
Log to Console \n ${output}
Should Be String ${output}
Should Contain ${output} ${listtocompare}
Dbusway Set Sensor Boot progress
${obj} = Set Variable /org/openbmc/sensors/host/BootProgress
${valuetoset} = Set Variable string:"FW Progress, Baseboard Init"
${method} = Set Variable setValue
${output} = Dbus Send Set Command ${obj} ${method} ${valuetoset}
Log to Console \n ${output}
${valuetocompare} = Get Substring ${valuetoset} 8 34
Log to Console \n ${valuetocompare}
${method} = Set Variable getValue
${output} = Dbus Send Get Command ${obj} ${method}
Should Be String ${output}
Should Contain ${output} ${valuetocompare}
Dbusway Set Sensor Boot progress Longest string
${obj} = Set Variable /org/openbmc/sensors/host/BootProgress
${valuetoset} = Set Variable string:"FW Progress, Docking station attachment"
${method} = Set Variable setValue
${output} = Dbus Send Set Command ${obj} ${method} ${valuetoset}
Log to Console \n ${output}
${valuetocompare} = Get Substring ${valuetoset} 8 42
Log to Console \n ${valuetocompare}
${method} = Set Variable getValue
${output} = Dbus Send Get Command ${obj} ${method}
Should Be String ${output}
Should Contain ${output} ${valuetocompare}
Dbusway Bootprogress Sensor FW Hang Unspecified Error
${obj} = Set Variable /org/openbmc/sensors/host/BootProgress
${valuetoset} = Set Variable string:"FW Hang, Unspecified"
${method} = Set Variable setValue
${output} = Dbus Send Set Command ${obj} ${method} ${valuetoset}
Log to Console \n ${output}
${valuetocompare} = Get Substring ${valuetoset} 8 27
Log to Console \n ${valuetocompare}
${method} = Set Variable getValue
${output} = Dbus Send Get Command ${obj} ${method}
Should Be String ${output}
Should Contain ${output} ${valuetocompare}
Dbusway Bootprogress FW Hang State
${obj} = Set Variable /org/openbmc/sensors/host/BootProgress
${valuetoset} = Set Variable string:"POST Error, unknown"
${method} = Set Variable setValue
${output} = Dbus Send Set Command ${obj} ${method} ${valuetoset}
Log to Console \n ${output}
${valuetocompare} = Get Substring ${valuetoset} 8 27
Log to Console \n ${valuetocompare}
${method} = Set Variable getValue
${output} = Dbus Send Get Command ${obj} ${method}
Should Be String ${output}
Should Contain ${output} ${valuetocompare}
Dbusway OperatingSystemStatus Sensor boot completed progress
${obj} = Set Variable /org/openbmc/sensors/host/OperatingSystemStatus
${valuetoset} = Set Variable string:"Boot completed (00)"
${method} = Set Variable setValue
${output} = Dbus Send Set Command ${obj} ${method} ${valuetoset}
Log to Console \n ${output}
${valuetocompare} = Get Substring ${valuetoset} 8 27
Log to Console \n ${valuetocompare}
${method} = Set Variable getValue
${output} = Dbus Send Get Command ${obj} ${method}
Should Be String ${output}
Should Contain ${output} ${valuetocompare}
Dbusway OperatingSystemStatus Sensor progress
${obj} = Set Variable /org/openbmc/sensors/host/OperatingSystemStatus
${valuetoset} = Set Variable string:"PXE boot completed"
${method} = Set Variable setValue
${output} = Dbus Send Set Command ${obj} ${method} ${valuetoset}
Log to Console \n ${output}
${valuetocompare} = Get Substring ${valuetoset} 8 26
Log to Console \n ${valuetocompare}
${method} = Set Variable getValue
${output} = Dbus Send Get Command ${obj} ${method}
Should Be String ${output}
Should Contain ${output} ${valuetocompare}
Dbusway OCC Active Sensor on Disabled
${obj} = Set Variable /org/openbmc/sensors/host/cpu0/OccStatus
${valuetoset} = Set Variable string:"Disabled"
${method} = Set Variable setValue
${output} = Dbus Send Set Command ${obj} ${method} ${valuetoset}
Log to Console \n ${output}
${valuetocompare} = Get Substring ${valuetoset} 8 16
Log to Console \n ${valuetocompare}
${method} = Set Variable getValue
${output} = Dbus Send Get Command ${obj} ${method}
Should Be String ${output}
Should Contain ${output} ${valuetocompare}
Dbusway OCC Active Sensor on Enabled
${obj} = Set Variable /org/openbmc/sensors/host/cpu0/OccStatus
${valuetoset} = Set Variable string:"Enabled"
${method} = Set Variable setValue
${output} = Dbus Send Set Command ${obj} ${method} ${valuetoset}
Log to Console \n ${output}
${valuetocompare} = Get Substring ${valuetoset} 8 16
Log to Console \n ${valuetocompare}
${method} = Set Variable getValue
${output} = Dbus Send Get Command ${obj} ${method}
Should Be String ${output}
Should Contain ${output} ${valuetocompare}
Dbusway Powercap Set Value
${obj} = Set Variable /org/openbmc/sensors/host/cpu0/OccStatus
${valuetoset} = Set Variable int32:5
${method} = Set Variable setValue
${output} = Dbus Send Set Command ${obj} ${method} ${valuetoset}
Log to Console \n ${output}
${valuetocompare} = Get Substring ${valuetoset} 8 16
Log to Console \n ${valuetocompare}
${method} = Set Variable getValue
${output} = Dbus Send Get Command ${obj} ${method}
Should Be String ${output}
Should Contain ${output} ${valuetocompare}
*** Keywords ***
Dbus Send Set Command
[Arguments] ${l_obj} ${l_method} ${l_valuetoset}
Log to Console \n ValuetoSet:
Log to Console \n ${l_valuetoset}
${dbuspart2cmd} = Catenate SEPARATOR= ${interface}${l_method}
${dbuspart3cmd} = Catenate ${l_obj} ${SPACE} ${dbuspart2cmd}
${dbuspart4cmd} = Catenate ${dbuspart3cmd} ${SPACE}${l_valuetoset}
Log to Console \n ${dbuspart1cmd}
Log to Console \n ${dbuspart4cmd}
${output} = Execute Command ${dbuspart1cmd} ${dbuspart4cmd}
[return] ${output}
Dbus Send Get Command
[Arguments] ${l_obj} ${l_method}
${dbuspart2cmd} = Catenate SEPARATOR= ${interface}${l_method}
${output} = Execute Command ${dbuspart1cmd} ${l_obj} ${dbuspart2cmd}
${output} = Remove String ${output} variant
[return] ${output}
Open Connection And Log In
Open connection ${OPENBMC_HOST}
Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}