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    ${resp}=    Get Request    pdu    /cmd.cgi?$A4 ${PDU_SLOT_NO}
19
20    ${error_message}=  Catenate  Power cycle of slot ${PDU_SLOT_NO} failed.
21    ...  PDU returned RC=${resp}.
22    Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK}  msg=${error_message}
23