1*** Settings ***
2Resource                ../lib/utils.robot
3Resource                ../lib/connection_client.robot
4Resource                ../lib/boot_utils.robot
5
6*** Variables ***
7# MAC input from user.
8${MAC_ADDRESS}          ${EMPTY}
9
10
11*** Keywords ***
12
13###############################################################################
14Check And Reset MAC
15    [Documentation]  Update BMC with user input MAC address.
16    [Arguments]  ${mac_address}=${MAC_ADDRESS}
17
18    # Description of argument(s):
19    # mac_address  The mac address (e.g. 00:01:6c:80:02:28).
20
21    Should Not Be Empty  ${mac_address}
22    Open Connection And Log In
23    ${bmc_mac_addr}=  Execute Command On BMC  cat /sys/class/net/eth0/address
24    Run Keyword If  '${mac_address.lower()}' != '${bmc_mac_addr.lower()}'
25    ...  Set MAC Address
26
27###############################################################################
28
29
30###############################################################################
31Set MAC Address
32    [Documentation]  Update eth0 with input MAC address.
33    [Arguments]  ${mac_address}=${MAC_ADDRESS}
34
35    # Description of argument(s):
36    # mac_address  The mac address (e.g. 00:01:6c:80:02:28).
37
38    Write  fw_setenv ethaddr ${mac_address}
39    OBMC Reboot (off)
40    ${bmc_mac_addr}=  Execute Command On BMC  cat /sys/class/net/eth0/address
41    Should Be Equal  ${bmc_mac_addr}  ${mac_address}  ignore_case=True
42
43###############################################################################
44