*** Settings ***
Documentation           synaccess PDU library

Resource        ../../lib/pdu/pdu.robot
Library         RequestsLibrary.RequestsKeywords

*** Keywords ***
Connect and Login
    Validate Prereq
    SSHLibrary.Open Connection  ${PDU_IP}
    ${auth}=    Create List     ${PDU_USERNAME}    ${PDU_PASSWORD}
    Create Session    pdu    http://${PDU_IP}   auth=${auth}

Power Cycle
    Connect and Login
    ${ret}=    Get Request    pdu    /cmd.cgi?$A4 ${PDU_SLOT_NO}

*** Settings ***
Documentation           synaccess PDU library

Resource        ../../lib/pdu/pdu.robot
Library         RequestsLibrary.RequestsKeywords

*** Keywords ***
Connect and Login
    Validate Prereq
    SSHLibrary.Open Connection  ${PDU_IP}
    ${auth}=    Create List     ${PDU_USERNAME}    ${PDU_PASSWORD}
    Create Session    pdu    http://${PDU_IP}   auth=${auth}

Power Cycle
    Connect and Login
    ${ret}=    Get Request    pdu    /cmd.cgi?$A4 ${PDU_SLOT_NO}
    ${error_message}=  Catenate  Power cycle of slot ${PDU_SLOT_NO} failed.
    ...  PDU returned RC=${ret}.
    Should Be Equal As Strings  ${ret}  ${HTTP_OK}  msg=${error_message}

Check return code when doing PDU reset
Check return code when doing PDU reset

PDU (Power Distribution Unit) will return HTTP_OK if successful.

Resolves openbmc/openbmc-test-automation#971
Change-Id: I153d9019ba3170fbb97522dc3ddd458cc4481a2b
Signed-off-by: Steven Sombar <fb37bb6ac5c2258e1cbf80690dea88925949957e@us.ibm.com>

openbmc/openbmc-test-automation,openbmc/openbmc-test-automation