blob: 906b56ddf704b43de1a8182640c3d1fce1951e2d [file] [log] [blame]
aravinth051067b409b2022-07-13 10:41:26 +00001*** Settings ***
2Documentation Schneider Power Distribution Unit (PDU) library
3
4Library Telnet
5Library SSHLibrary
6Resource ../../lib/pdu/pdu.robot
7
8*** Keywords ***
9Login To Schneider PDU Via SSH
10 [Documentation] Open PDU connection and login via SSH.
11
12 Validate Prereq
13 SSHLibrary.Open Connection ${PDU_IP} prompt=apc>
14 ${connection_status}= Run Keyword And Return Status
15 ... SSHLibrary.Login ${PDU_USERNAME} ${PDU_PASSWORD}
16 Return From Keyword ${connection_status}
17
18
19Login To Schneider PDU Via Telnet
20 [Documentation] Open PDU connection and login via telnet.
21
22 Validate Prereq
23 Telnet.Open Connection ${PDU_IP}
24
25 Telnet.Write \n
26 Telnet.Read Until User Name :
27 Telnet.Write ${PDU_USERNAME}
28
29 Telnet.Read Until Password${SPACE}${SPACE}:
30 Telnet.Write ${PDU_PASSWORD}
31
32 Set Prompt apc>
33 Telnet.Read Until Prompt
34 Telnet.Write ?
35 Telnet.Read Until Prompt
36
37
38Power Cycle
39 [Documentation] Perform PDU power cycle.
40
41 # Sample output from schneider PDU console
42
43 # Schneider Electric Network Management Card AOS v6.9.6
44 # (c) Copyright 2020 All Rights Reserved RPDU 2g APP v6.9.6
45 # -------------------------------------------------------------------------------
46 # Name : apc566BF4 Date : 07/07/2022
47 # Contact : Unknown Time : 01:18:18
48 # Location : Unknown User : Super User
49 # Up Time : 0 Days 12 Hours 17 Minutes Stat : P+ N4+ N6+ A+
50 # -------------------------------------------------------------------------------
51 # IPv4 : Enabled IPv6 : Enabled
52 # Ping Response : Enabled
53 # -------------------------------------------------------------------------------
54 # HTTP : Disabled HTTPS : Enabled
55 # FTP : Disabled Telnet : Disabled
56 # SSH/SCP : Enabled SNMPv1 : Disabled
57 # SNMPv3 : Disabled
58 # -------------------------------------------------------------------------------
59 # Super User : Enabled RADIUS : Disabled
60 # Administrator : Disabled Device User : Disabled
61 # Read-Only User : Disabled Network-Only User : Disabled
62
63
64 # Type ? for command listing
65 # Use tcpip command for IP address(-i), subnet(-s), and gateway(-g)
66
67 # apc>?
68 # System Commands:
69 # ---------------------------------------------------------------------------
70 # For command help: command ?
71
72 # ? about alarmcount boot bye cd
73 # cipher clrrst console date delete dir
74 # dns eapol email eventlog exit firewall
75 # format ftp help lang lastrst ledblink
76 # logzip netstat ntp ping portspeed prompt
77 # pwd quit radius reboot resetToDef session
78 # smtp snmp snmptrap snmpv3 system tcpip
79 # tcpip6 user userdflt web whoami xferINI
80 # xferStatus
81
82 # Device Commands:
83 # ---------------------------------------------------------------------------
84 # alarmList bkLowLoad bkNearOver bkOverLoad bkReading bkPeakCurr
85 # bkRestrictn devStartDly energyWise olAssignUsr olCancelCmd olDlyOff
86 # olDlyOn olDlyReboot olGroups olName olOff olOffDelay
87 # olOn olOnDelay olRbootTime olReboot olStatus olUnasgnUsr
88 # phLowLoad phNearOver phOverLoad phReading phPeakCurr phRestrictn
89 # prodInfo userAdd userDelete userList userPasswd
90
91 # apc>olReboot 3,4,5,6,7,8
92 # E000: Success
93
94 # Enter command olOn <Outlet number> & verify success.
95
96 ${connection_status}= Login To Schneider PDU Via SSH
97
98 IF '${connection_status}' == '${False}'
99 Set Suite Variable ${lib_name} Telnet
100 Login To Schneider PDU Via Telnet
101 ELSE
102 Set Suite Variable ${lib_name} SSHLibrary
103 END
104
105 @{outlets}= Split String ${PDU_SLOT_NO} separator=,
106 FOR ${outlet} IN @{outlets}
107 Run Keyword ${lib_name}.Write olReboot ${outlet}
108 ${output}= Run Keyword ${lib_name}.Read Until Prompt
109 Should Contain ${output} Success msg=Device Command Failed
110 END