blob: 95c3b91965848b0d5d1acf72387b3c955ee940ec [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
2Resource ../lib/resource.txt
3Resource ../lib/rest_client.robot
George Keishing5e870cd2016-08-24 10:05:47 -05004Resource ../lib/connection_client.robot
George Keishing30c12ff2016-09-02 10:25:29 -05005Library DateTime
6Library Process
Chris Austenb29d2e82016-06-07 12:25:35 -05007Library OperatingSystem
Michael Walsha6723f22016-11-22 11:12:01 -06008Library gen_print.py
9Library gen_robot_print.py
Chris Austenb29d2e82016-06-07 12:25:35 -050010
11*** Variables ***
12${SYSTEM_SHUTDOWN_TIME} ${5}
Michael Walsha6723f22016-11-22 11:12:01 -060013${dbuscmdBase}
George Keishing85ca05e2016-11-30 09:47:18 -060014... dbus-send --system --print-reply --dest=${OPENBMC_BASE_DBUS}.settings.Host
Michael Walsha6723f22016-11-22 11:12:01 -060015${dbuscmdGet}
George Keishing85ca05e2016-11-30 09:47:18 -060016... ${OPENBMC_BASE_URI}settings/host0 org.freedesktop.DBus.Properties.Get
17# Enable when ready with openbmc/openbmc-test-automation#203
18#${dbuscmdString}= string:"xyz.openbmc_project.settings.Host" string:
Michael Walsha6723f22016-11-22 11:12:01 -060019${dbuscmdString}= string:"org.openbmc.settings.Host" string:
20
George Keishing85ca05e2016-11-30 09:47:18 -060021
Michael Walsha6723f22016-11-22 11:12:01 -060022# Assign default value to QUIET for programs which may not define it.
23${QUIET} ${0}
Chris Austenb29d2e82016-06-07 12:25:35 -050024
25*** Keywords ***
Chris Austenb29d2e82016-06-07 12:25:35 -050026Wait For Host To Ping
root442f0ef2016-08-04 20:23:05 +000027 [Arguments] ${host} ${timeout}=${OPENBMC_REBOOT_TIMEOUT}min
28 ... ${interval}=5 sec
29
30 # host The DNS name or IP of the host to ping.
31 # timeout The amount of time after which attempts to ping cease.
32 # interval The amount of time in between attempts to ping.
33
34 Wait Until Keyword Succeeds ${timeout} ${interval} Ping Host ${host}
Chris Austenb29d2e82016-06-07 12:25:35 -050035
36Ping Host
37 [Arguments] ${host}
George Keishing8a84f952016-08-25 04:54:53 -050038 Should Not Be Empty ${host} msg=No host provided
Michael Walsha6723f22016-11-22 11:12:01 -060039 ${RC} ${output}= Run and return RC and Output ping -c 4 ${host}
Chris Austenb29d2e82016-06-07 12:25:35 -050040 Log RC: ${RC}\nOutput:\n${output}
41 Should be equal ${RC} ${0}
42
43Get Boot Progress
Michael Walsha6723f22016-11-22 11:12:01 -060044 [Arguments] ${quiet}=${QUIET}
45
George Keishing85ca05e2016-11-30 09:47:18 -060046 ${state}= Read Attribute ${OPENBMC_BASE_URI}sensors/host/BootProgress
Michael Walsha6723f22016-11-22 11:12:01 -060047 ... value quiet=${quiet}
Chris Austenb29d2e82016-06-07 12:25:35 -050048 [return] ${state}
49
50Is Power On
root442f0ef2016-08-04 20:23:05 +000051 ${state}= Get Power State
52 Should be equal ${state} ${1}
Chris Austenb29d2e82016-06-07 12:25:35 -050053
54Is Power Off
root442f0ef2016-08-04 20:23:05 +000055 ${state}= Get Power State
56 Should be equal ${state} ${0}
Chris Austenb29d2e82016-06-07 12:25:35 -050057
root442f0ef2016-08-04 20:23:05 +000058Initiate Power On
59 [Documentation] Initiates the power on and waits until the Is Power On
60 ... keyword returns that the power state has switched to on.
Michael Walsha6723f22016-11-22 11:12:01 -060061 [Arguments] ${wait}=${1}
62
Chris Austenb29d2e82016-06-07 12:25:35 -050063 @{arglist}= Create List
64 ${args}= Create Dictionary data=@{arglist}
George Keishing85ca05e2016-11-30 09:47:18 -060065 ${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ powerOn
Michael Walsha6723f22016-11-22 11:12:01 -060066 ... data=${args}
Chris Austenb29d2e82016-06-07 12:25:35 -050067 should be equal as strings ${resp.status_code} ${HTTP_OK}
Chris Austenb29d2e82016-06-07 12:25:35 -050068
Michael Walsha6723f22016-11-22 11:12:01 -060069 # Does caller want to wait for power on status?
70 Run Keyword If '${wait}' == '${0}' Return From Keyword
71 Wait Until Keyword Succeeds 3 min 10 sec Is Power On
Rahul Maheshwarif684ba72016-10-25 07:24:41 -050072
root442f0ef2016-08-04 20:23:05 +000073Initiate Power Off
74 [Documentation] Initiates the power off and waits until the Is Power Off
75 ... keyword returns that the power state has switched to off.
Chris Austenb29d2e82016-06-07 12:25:35 -050076 @{arglist}= Create List
77 ${args}= Create Dictionary data=@{arglist}
George Keishing85ca05e2016-11-30 09:47:18 -060078 ${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ powerOff
Michael Walsha6723f22016-11-22 11:12:01 -060079 ... data=${args}
Chris Austenb29d2e82016-06-07 12:25:35 -050080 should be equal as strings ${resp.status_code} ${HTTP_OK}
Michael Walsha6723f22016-11-22 11:12:01 -060081 Wait Until Keyword Succeeds 1 min 10 sec Is Power Off
Chris Austenb29d2e82016-06-07 12:25:35 -050082
83Trigger Warm Reset
84 log to console "Triggering warm reset"
Michael Walsha6723f22016-11-22 11:12:01 -060085 ${data}= create dictionary data=@{EMPTY}
George Keishing85ca05e2016-11-30 09:47:18 -060086 ${resp}= openbmc post request
87 ... ${OPENBMC_BASE_URI}control/bmc0/action/warmReset data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -050088 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
George Keishingb3700812016-08-31 03:03:30 -050089 ${session_active}= Check If warmReset is Initiated
90 Run Keyword If '${session_active}' == '${True}'
91 ... Fail msg=warm reset didn't occur
92
Chris Austenb29d2e82016-06-07 12:25:35 -050093 Sleep ${SYSTEM_SHUTDOWN_TIME}min
94 Wait For Host To Ping ${OPENBMC_HOST}
Michael Walsh49ab0f42016-07-20 11:44:33 -050095
96Check OS
root442f0ef2016-08-04 20:23:05 +000097 [Documentation] Attempts to ping the host OS and then checks that the host
98 ... OS is up by running an SSH command.
Michael Walsh49ab0f42016-07-20 11:44:33 -050099
100 [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME}
Michael Walsha6723f22016-11-22 11:12:01 -0600101 ... ${os_password}=${OS_PASSWORD} ${quiet}=${QUIET}
102 ... ${print_string}=${EMPTY}
Michael Walsh49ab0f42016-07-20 11:44:33 -0500103 [Teardown] Close Connection
104
105 # os_host The DNS name/IP of the OS host associated with our BMC.
106 # os_username The username to be used to sign on to the OS host.
107 # os_password The password to be used to sign on to the OS host.
Michael Walsha6723f22016-11-22 11:12:01 -0600108 # quiet Indicates whether this keyword should write to console.
109 # print_string A string to be printed before checking the OS.
110
111 rprint ${print_string}
Michael Walsh49ab0f42016-07-20 11:44:33 -0500112
root442f0ef2016-08-04 20:23:05 +0000113 # Attempt to ping the OS. Store the return code to check later.
114 ${ping_rc}= Run Keyword and Return Status Ping Host ${os_host}
115
Michael Walsh49ab0f42016-07-20 11:44:33 -0500116 Open connection ${os_host}
Michael Walsh49ab0f42016-07-20 11:44:33 -0500117
Michael Walsha6723f22016-11-22 11:12:01 -0600118 ${status} ${msg}= Run Keyword And Ignore Error Login ${os_username}
119 ... ${os_password}
120 ${err_msg1}= Sprint Error ${msg}
121 ${err_msg}= Catenate SEPARATOR= \n ${err_msg1}
122 Run Keyword If '${status}' == 'FAIL' Fail msg=${err_msg}
Michael Walsh49ab0f42016-07-20 11:44:33 -0500123 ${output} ${stderr} ${rc}= Execute Command uptime return_stderr=True
124 ... return_rc=True
125
Michael Walsha6723f22016-11-22 11:12:01 -0600126 ${temp_msg}= Catenate Could not execute a command on the operating
127 ... system.\n
128 ${err_msg1}= Sprint Error ${temp_msg}
129 ${err_msg}= Catenate SEPARATOR= \n ${err_msg1}
130
131 # If the return code returned by "Execute Command" is non-zero, this
132 # keyword will fail.
133 Should Be Equal ${rc} ${0} msg=${err_msg}
Michael Walsh49ab0f42016-07-20 11:44:33 -0500134 # We will likewise fail if there is any stderr data.
135 Should Be Empty ${stderr}
136
Michael Walsha6723f22016-11-22 11:12:01 -0600137 ${temp_msg}= Set Variable Could not ping the operating system.\n
138 ${err_msg1}= Sprint Error ${temp_msg}
139 ${err_msg}= Catenate SEPARATOR= \n ${err_msg1}
140 # We will likewise fail if the OS did not ping, as we could SSH but not
141 # ping
142 Should Be Equal As Strings ${ping_rc} ${TRUE} msg=${err_msg}
root442f0ef2016-08-04 20:23:05 +0000143
Michael Walsh49ab0f42016-07-20 11:44:33 -0500144Wait for OS
145 [Documentation] Waits for the host OS to come up via calls to "Check OS".
146 [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME}
147 ... ${os_password}=${OS_PASSWORD} ${timeout}=${OS_WAIT_TIMEOUT}
Michael Walsha6723f22016-11-22 11:12:01 -0600148 ... ${quiet}=${0}
149 [Teardown] rprintn
Michael Walsh49ab0f42016-07-20 11:44:33 -0500150
151 # os_host The DNS name or IP of the OS host associated with our
152 # BMC.
153 # os_username The username to be used to sign on to the OS host.
154 # os_password The password to be used to sign on to the OS host.
155 # timeout The timeout in seconds indicating how long you're
156 # willing to wait for the OS to respond.
Michael Walsha6723f22016-11-22 11:12:01 -0600157 # quiet Indicates whether this keyword should write to console.
Michael Walsh49ab0f42016-07-20 11:44:33 -0500158
159 # The interval to be used between calls to "Check OS".
160 ${interval}= Set Variable 5
161
Michael Walsha6723f22016-11-22 11:12:01 -0600162 ${message}= Catenate Checking every ${interval} seconds for up to
163 ... ${timeout} seconds for the operating system to communicate.
164 rqprint_timen ${message}
165
Michael Walsh49ab0f42016-07-20 11:44:33 -0500166 Wait Until Keyword Succeeds ${timeout} sec ${interval} Check OS
167 ... ${os_host} ${os_username} ${os_password}
Michael Walsha6723f22016-11-22 11:12:01 -0600168 ... print_string=\#
169
170 rqprintn
171
172 rqprint_timen The operating system is now communicating.
root442f0ef2016-08-04 20:23:05 +0000173
174Get BMC State
175 [Documentation] Returns the state of the BMC as a string. (i.e: BMC_READY)
Michael Walsha6723f22016-11-22 11:12:01 -0600176 [Arguments] ${quiet}=${QUIET}
177
root442f0ef2016-08-04 20:23:05 +0000178 @{arglist}= Create List
179 ${args}= Create Dictionary data=@{arglist}
George Keishing85ca05e2016-11-30 09:47:18 -0600180 ${resp}= Call Method ${OPENBMC_BASE_URI}managers/System/ getSystemState
Michael Walsha6723f22016-11-22 11:12:01 -0600181 ... data=${args} quiet=${quiet}
root442f0ef2016-08-04 20:23:05 +0000182 Should be equal as strings ${resp.status_code} ${HTTP_OK}
183 ${content}= to json ${resp.content}
184 [return] ${content["data"]}
185
186Get Power State
187 [Documentation] Returns the power state as an integer. Either 0 or 1.
Michael Walsha6723f22016-11-22 11:12:01 -0600188 [Arguments] ${quiet}=${QUIET}
189
root442f0ef2016-08-04 20:23:05 +0000190 @{arglist}= Create List
191 ${args}= Create Dictionary data=@{arglist}
Michael Walsha6723f22016-11-22 11:12:01 -0600192
George Keishing85ca05e2016-11-30 09:47:18 -0600193 ${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ getPowerState
Michael Walsha6723f22016-11-22 11:12:01 -0600194 ... data=${args} quiet=${quiet}
root442f0ef2016-08-04 20:23:05 +0000195 Should be equal as strings ${resp.status_code} ${HTTP_OK}
196 ${content}= to json ${resp.content}
197 [return] ${content["data"]}
Jay Azurine4c52eb2016-08-16 20:51:10 -0500198
199Clear BMC Record Log
200 [Documentation] Clears all the event logs on the BMC. This would be
201 ... equivalent to ipmitool sel clear.
202 @{arglist}= Create List
203 ${args}= Create Dictionary data=@{arglist}
George Keishing85ca05e2016-11-30 09:47:18 -0600204 ${resp}= Call Method
205 ... ${OPENBMC_BASE_URI}records/events/ clear data=${args}
Jay Azurine4c52eb2016-08-16 20:51:10 -0500206 should be equal as strings ${resp.status_code} ${HTTP_OK}
207
208Copy PNOR to BMC
209 Import Library SCPLibrary WITH NAME scp
210 Open Connection for SCP
211 Log Copying ${PNOR_IMAGE_PATH} to /tmp
212 scp.Put File ${PNOR_IMAGE_PATH} /tmp
213
214Flash PNOR
215 [Documentation] Calls flash bios update method to flash PNOR image
216 [arguments] ${pnor_image}
217 @{arglist}= Create List ${pnor_image}
218 ${args}= Create Dictionary data=@{arglist}
George Keishing85ca05e2016-11-30 09:47:18 -0600219 ${resp}= Call Method ${OPENBMC_BASE_URI}control/flash/bios/ update
Michael Walsha6723f22016-11-22 11:12:01 -0600220 ... data=${args}
Jay Azurine4c52eb2016-08-16 20:51:10 -0500221 should be equal as strings ${resp.status_code} ${HTTP_OK}
222 Wait Until Keyword Succeeds 2 min 10 sec Is PNOR Flashing
223
224Get Flash BIOS Status
225 [Documentation] Returns the status of the flash BIOS API as a string. For
226 ... example 'Flashing', 'Flash Done', etc
George Keishing85ca05e2016-11-30 09:47:18 -0600227 ${data}= Read Properties ${OPENBMC_BASE_URI}control/flash/bios
Jay Azurine4c52eb2016-08-16 20:51:10 -0500228 [return] ${data['status']}
229
230Is PNOR Flashing
231 [Documentation] Get BIOS 'Flashing' status. This indicates that PNOR
232 ... flashing has started.
233 ${status}= Get Flash BIOS Status
234 should be equal as strings ${status} Flashing
235
236Is PNOR Flash Done
237 [Documentation] Get BIOS 'Flash Done' status. This indicates that the
238 ... PNOR flashing has completed.
Leah McNutt9ba32272016-11-17 15:48:39 +0000239 ${status}= Get Flash BIOS Status
Jay Azurine4c52eb2016-08-16 20:51:10 -0500240 should be equal as strings ${status} Flash Done
241
242Is System State Host Booted
243 [Documentation] Checks whether system state is HOST_BOOTED.
244 ${state}= Get BMC State
245 should be equal as strings ${state} HOST_BOOTED
George Keishing5e870cd2016-08-24 10:05:47 -0500246
247Verify Ping and REST Authentication
Michael Walsha6723f22016-11-22 11:12:01 -0600248 ${l_ping}= Run Keyword And Return Status
George Keishing5e870cd2016-08-24 10:05:47 -0500249 ... Ping Host ${OPENBMC_HOST}
George Keishingc4d3dc02016-09-19 03:45:55 -0500250 Run Keyword If '${l_ping}' == '${False}'
251 ... Fail msg=Ping Failed
George Keishing5e870cd2016-08-24 10:05:47 -0500252
Michael Walsha6723f22016-11-22 11:12:01 -0600253 ${l_rest}= Run Keyword And Return Status
George Keishing5e870cd2016-08-24 10:05:47 -0500254 ... Initialize OpenBMC
George Keishingc4d3dc02016-09-19 03:45:55 -0500255 Run Keyword If '${l_rest}' == '${False}'
256 ... Fail msg=REST Authentication Failed
George Keishing5e870cd2016-08-24 10:05:47 -0500257
258 # Just to make sure the SSH is working for SCP
259 Open Connection And Log In
260 ${system} ${stderr}= Execute Command hostname return_stderr=True
261 Should Be Empty ${stderr}
262
George Keishingc4d3dc02016-09-19 03:45:55 -0500263Check If BMC is Up
264 [Documentation] Wait for Host to be online. Checks every X seconds
265 ... interval for Y minutes and fails if timed out.
266 ... Default MAX timedout is 10 min, interval 10 seconds.
Leah McNuttf9689502016-11-03 15:38:08 +0000267 [arguments] ${max_timeout}=${OPENBMC_REBOOT_TIMEOUT} min
George Keishingc4d3dc02016-09-19 03:45:55 -0500268 ... ${interval}=10 sec
269
270 Wait Until Keyword Succeeds
271 ... ${max_timeout} ${interval} Verify Ping and REST Authentication
272
George Keishingb3700812016-08-31 03:03:30 -0500273
274Check If warmReset is Initiated
275 [Documentation] Ping would be still alive, so try SSH to connect
276 ... if fails the ports are down indicating reboot
277 ... is in progress
278 ${alive}= Run Keyword and Return Status
279 ... Open Connection And Log In
280 Return From Keyword If '${alive}' == '${False}' ${False}
281 [return] ${True}
282
George Keishing06ae4aa2016-08-30 01:41:28 -0500283Flush REST Sessions
284 [Documentation] Removes all the active session objects
285 Delete All Sessions
George Keishingb3700812016-08-31 03:03:30 -0500286
Sivas SRRe1143ae2016-08-26 22:31:02 -0500287Initialize DBUS cmd
288 [Documentation] Initialize dbus string with property string to extract
289 [arguments] ${boot_property}
Michael Walsha6723f22016-11-22 11:12:01 -0600290 ${cmd}= Catenate ${dbuscmdBase} ${dbuscmdGet} ${dbuscmdString}
291 ${cmd}= Catenate ${cmd}${boot_property}
Sivas SRRe1143ae2016-08-26 22:31:02 -0500292 Set Global Variable ${dbuscmd} ${cmd}
293
George Keishing30c12ff2016-09-02 10:25:29 -0500294
295Start SOL Console Logging
296 [Documentation] Start logging to a file in /tmp so that it can
297 ... be read by any other test cases. Stop existing
298 ... running client processes if there is any.
299 ... By default logging at /tmp/obmc-console.log else
300 ... user input location.
301 ... The File is appended with datetime and pid of
302 ... process which created this log file.
303 [Arguments] ${file_path}=/tmp/obmc-console.log
304
305 Open Connection And Log In
306
307 ${cur_time}= Get Time Stamp
308 Set Global Variable ${LOG_TIME} ${cur_time}
309 Start Command
310 ... obmc-console-client > ${file_path}-${LOG_TIME}_$$
311
312
313Stop SOL Console Logging
314 [Documentation] Login to BMC and Stop the obmc-console-client process.
315 ... Find the pids from the log to filter the one started by
316 ... specific test datetime and stop that process only.
317 ... Ignore if there is no process running and return message
318 ... "No obmc-console-client process running"
319 ... By default retrieving log from /tmp/obmc-console.log else
320 ... user input location.
321 [Arguments] ${file_path}=/tmp/obmc-console.log
322
323 Open Connection And Log In
324
Michael Walsha6723f22016-11-22 11:12:01 -0600325 ${pid} ${stderr}=
George Keishing30c12ff2016-09-02 10:25:29 -0500326 ... Execute Command
327 ... ls ${file_path}-${LOG_TIME}_* | cut -d'_' -f 2
328 ... return_stderr=True
George Keishing30c12ff2016-09-02 10:25:29 -0500329 Should Be Empty ${stderr}
330
George Keishingd4678952016-10-12 04:29:28 -0500331 ${rc}=
332 ... Execute Command
333 ... ps ax | grep ${pid} | grep -v grep
334 ... return_stdout=False return_rc=True
335
336 Return From Keyword If '${rc}' == '${1}'
337 ... No obmc-console-client process running
338
George Keishing30c12ff2016-09-02 10:25:29 -0500339 ${console} ${stderr}=
340 ... Execute Command kill -s KILL ${pid}
341 ... return_stderr=True
342 Should Be Empty ${stderr}
George Keishingd4678952016-10-12 04:29:28 -0500343 Log Current Client PID:${pid}
George Keishing30c12ff2016-09-02 10:25:29 -0500344
345 ${console} ${stderr}=
346 ... Execute Command
347 ... cat ${file_path}-${LOG_TIME}_${pid}
348 ... return_stderr=True
349 Should Be Empty ${stderr}
350
351 [Return] ${console}
352
353
354Get Time Stamp
355 [Documentation] Get the current time stamp data
356 ${cur_time}= Get Current Date result_format=%Y%m%d%H%M%S%f
357 [return] ${cur_time}
358
George Keishing1b150202016-09-29 08:51:58 -0500359
360Verify BMC State
361 [Documentation] Get the BMC state and verify if the current
362 ... BMC state is as expected.
363 [Arguments] ${expected}
364
365 ${current}= Get BMC State
George Keishing8db0e1b2016-10-20 13:46:54 -0500366 Should Contain ${expected} ${current}
George Keishing1b150202016-09-29 08:51:58 -0500367
Rahul Maheshwarif684ba72016-10-25 07:24:41 -0500368Start Journal Log
369 [Documentation] Start capturing journal log to a file in /tmp using
370 ... journalctl command. By default journal log is collected
371 ... at /tmp/journal_log else user input location.
372 ... The File is appended with datetime.
373 [Arguments] ${file_path}=/tmp/journal_log
374
375 Open Connection And Log In
376
377 ${cur_time}= Get Time Stamp
378 Set Global Variable ${LOG_TIME} ${cur_time}
379 Start Command
380 ... journalctl -f > ${file_path}-${LOG_TIME}
381 Log Journal Log Started: ${file_path}-${LOG_TIME}
382
383Stop Journal Log
384 [Documentation] Stop journalctl process if its running.
385 ... By default return log from /tmp/journal_log else
386 ... user input location.
387 [Arguments] ${file_path}=/tmp/journal_log
388
389 Open Connection And Log In
390
391 ${rc}=
392 ... Execute Command
393 ... ps ax | grep journalctl | grep -v grep
394 ... return_stdout=False return_rc=True
395
396 Return From Keyword If '${rc}' == '${1}'
397 ... No journal log process running
398
399 ${output} ${stderr}=
400 ... Execute Command killall journalctl
401 ... return_stderr=True
402 Should Be Empty ${stderr}
403
404 ${journal_log} ${stderr}=
405 ... Execute Command
406 ... cat ${file_path}-${LOG_TIME}
407 ... return_stderr=True
408 Should Be Empty ${stderr}
409
410 Log ${journal_log}
411
412 Execute Command rm ${file_path}-${LOG_TIME}
413
414 [Return] ${journal_log}
Rahul Maheshwari757d80c2016-10-17 01:09:55 -0500415
416Mac Address To Hex String
417 [Documentation] Converts MAC address into hex format.
418 ... Example
419 ... Given the following MAC: 00:01:6C:80:02:78
420 ... This keyword will return: 0x00 0x01 0x6C 0x80 0x02 0x78
421 ... Description of arguments:
422 ... i_macaddress MAC address in the following format 00:01:6C:80:02:78
423 [Arguments] ${i_macaddress}
424
425 ${mac_hex}= Catenate 0x${i_macaddress.replace(':', ' 0x')}
426 [return] ${mac_hex}
427
428IP Address To Hex String
429 [Documentation] Converts IP address into hex format.
430 ... Example:
431 ... Given the following IP: 10.3.164.100
432 ... This keyword will return: 0xa 0x3 0xa4 0xa0
433 ... Description of arguments:
434 ... i_ipaddress IP address in the following format 10.10.10.10
435 [Arguments] ${i_ipaddress}
436
437 @{ip}= Split String ${i_ipaddress} .
438 ${index}= Set Variable ${0}
439
440 :FOR ${item} IN @{ip}
441 \ ${hex}= Convert To Hex ${item} prefix=0x lowercase=yes
442 \ Set List Value ${ip} ${index} ${hex}
443 \ ${index}= Set Variable ${index + 1}
444 ${ip_hex}= Catenate @{ip}
445 [return] ${ip_hex}