1bcb3288fSGeorge Keishing*** Settings ***
2bcb3288fSGeorge KeishingDocumentation  BMC OEM serial update utilities keywords.
3bcb3288fSGeorge Keishing
4bcb3288fSGeorge KeishingResource    code_update_utils.robot
5217402feSSteven SombarResource    serial_connection/serial_console_client.robot
6bcb3288fSGeorge Keishing
7bcb3288fSGeorge Keishing*** Keywords ***
8bcb3288fSGeorge Keishing
9bcb3288fSGeorge KeishingReset Network Interface During Code Update
10bcb3288fSGeorge Keishing    [Documentation]  Disable and re-enable the network while doing code update.
11bcb3288fSGeorge Keishing    [Arguments]  ${image_file_path}  ${reboot}
12bcb3288fSGeorge Keishing
13bcb3288fSGeorge Keishing    # Resetting the network will be done via the serial console.
14bcb3288fSGeorge Keishing    #
15bcb3288fSGeorge Keishing    # Description of argument(s):
16bcb3288fSGeorge Keishing    # image_file_path   Path to the image file to update to.
17bcb3288fSGeorge Keishing    # reboot            If set to true, will reboot the BMC after the code
18bcb3288fSGeorge Keishing    #                   update is finished.
19bcb3288fSGeorge Keishing
20bcb3288fSGeorge Keishing    ${version_id}=  Upload And Activate Image  ${image_file_path}  wait=${0}
21bcb3288fSGeorge Keishing    Reset Network Interface
22bcb3288fSGeorge Keishing
23bcb3288fSGeorge Keishing    # Verify code update was successful and 'Activation' state is 'Active'.
24bcb3288fSGeorge Keishing    Wait For Activation State Change  ${version_id}  ${ACTIVATING}
25bcb3288fSGeorge Keishing    ${software_state}=  Read Properties  ${SOFTWARE_VERSION_URI}${version_id}
26*a2f6d421SGeorge Keishing    Should Be Equal As Strings  ${software_state}[Activation]  ${ACTIVE}
27bcb3288fSGeorge Keishing
28bcb3288fSGeorge Keishing    Run Keyword If  '${reboot}'  OBMC Reboot (off)  stack_mode=normal
29bcb3288fSGeorge Keishing
30bcb3288fSGeorge Keishing
31bcb3288fSGeorge KeishingReset Network Interface
32bcb3288fSGeorge Keishing    [Documentation]  Turn the ethernet network interface off and then on again
33bcb3288fSGeorge Keishing    ...              through the serial console.
34bcb3288fSGeorge Keishing
35217402feSSteven Sombar    Import Resource  ${CURDIR}/serial_connection/serial_console_client.robot
36bcb3288fSGeorge Keishing    Set Library Search Order  SSHLibrary  Telnet
37bcb3288fSGeorge Keishing    Execute Command On Serial Console  ifconfig eth0 down
38bcb3288fSGeorge Keishing    Sleep  30s
39bcb3288fSGeorge Keishing    Execute Command On Serial Console  ifconfig eth0 up
40