1*** Settings ***
2Documentation  Update BMC MAC address with input MAC.
3
4Library   ../lib/gen_robot_keyword.py
5Resource  ../lib/utils.robot
6Resource  ../extended/obmc_boot_test_resource.robot
7
8*** Variables ***
9
10# MAC input from Jenkins job.
11${MAC_ADDRESS}  ${EMPTY}
12
13*** Test Cases ***
14
15Check And Reset MAC
16    [Documentation]  Update BMC with user input MAC address.
17
18    Should Not Be Empty  ${MAC_ADDRESS}
19    Open Connection And Log In
20    ${bmc_mac_addr}=  Execute Command On BMC  cat /sys/class/net/eth0/address
21    Run Keyword If  '${MAC_ADDRESS}' != '${bmc_mac_addr}'
22    ...  Set MAC Address
23
24*** Keywords ***
25
26Set MAC Address
27    [Documentation]  Update eth0 with input MAC address.
28
29    Write  fw_setenv ethaddr ${MAC_ADDRESS}
30    Run Key U  OBMC Boot Test \ OBMC Reboot (off)
31    ${bmc_mac_addr}=  Execute Command On BMC  cat /sys/class/net/eth0/address
32    Should Be Equal  ${bmc_mac_addr}  ${MAC_ADDRESS}
33