1*** Settings ***
2Documentation           Synaccess Protocol Distribution Unit (PDU) library
3
4Resource        ../../lib/pdu/pdu.robot
5Library         RequestsLibrary.RequestsKeywords
6
7*** Keywords ***
8Connect and Login
9    [Documentation]  Open PDU connection and login.
10    Validate Prereq
11    SSHLibrary.Open Connection  ${PDU_IP}
12    ${auth}=    Create List     ${PDU_USERNAME}    ${PDU_PASSWORD}
13    Create Session    pdu    http://${PDU_IP}   auth=${auth}
14
15Power Cycle
16    [Documentation]  Perform PDU power cycle.
17    Connect and Login
18    ${ret}=    Get Request    pdu    /cmd.cgi?$A4 ${PDU_SLOT_NO}
19    ${error_message}=  Catenate  Power cycle of slot ${PDU_SLOT_NO} failed.
20    ...  PDU returned RC=${ret}.
21    Should Be Equal As Strings  ${ret}  ${HTTP_OK}  msg=${error_message}
22