blob: ce3dd54ac94c0753f6a7f96a3a06762ef5f1c423 [file] [log] [blame]
Prashanth Katti1dcd5392017-05-12 04:35:53 -05001*** Settings ***
2Documentation Module for testing BMC via XCAT.
3
4Resource ../lib/xcat/resource.txt
5Resource ../lib/xcat/xcat_utils.robot
6
7Library OperatingSystem
Prashanth Katti477debc2017-05-19 03:01:04 -05008Library String
Prashanth Katti1dcd5392017-05-12 04:35:53 -05009
10Suite Setup Validate XCAT Setup
11
Prashanth Katti477debc2017-05-19 03:01:04 -050012*** Variables ***
13
14${poweron_flag} ON
15${poweroff_flag} OFF
16
Prashanth Katti1dcd5392017-05-12 04:35:53 -050017*** Test Cases ***
18
19Add BMC Nodes To XCAT
20 [Documentation] Connect and add BMC nodes.
21 [Tags] Add_BMC_Nodes_To_XCAT
22
Prashanth Katti477debc2017-05-19 03:01:04 -050023 # Add BMC nodes one by one and check whether it is successfully added.
24 : FOR ${bmc} IN @{BMC_LIST}
25 \ Add Nodes To XCAT ${bmc}
26 \ Validate Added Node ${bmc}
Prashanth Katti1dcd5392017-05-12 04:35:53 -050027
Prashanth Katti477debc2017-05-19 03:01:04 -050028Power On Via XCAT And Validate
29 [Documentation] Power on via XCAT and validate.
30 [Tags] Power_On_Via_XCAT_And_Validate
31
32 # Power on each BMC node and validate the power status.
33 : FOR ${bmc} IN @{BMC_LIST}
34 \ Power On Via XCAT ${bmc}
35 \ Validate Power Status Via XCAT ${bmc} ${poweron_flag}
36
37Power Off Via XCAT And Validate
38 [Documentation] Power off via XCAT and validate.
39 [Tags] Power_Off_Via_XCAT_And_Validate
40
41 # Power off each BMC node and validate the power status.
42 : FOR ${bmc} IN @{BMC_LIST}
43 \ Power Off Via XCAT ${bmc}
44 \ Validate Power Status Via XCAT ${bmc} ${poweroff_flag}
Prashanth Katti1dcd5392017-05-12 04:35:53 -050045
Prashanth Kattib974a742017-05-25 06:52:29 -050046Add Nodes To Group List
47 [Documentation] Add BMC nodes into group.
48 [Tags] Move_Added_Nodes_To_Group
49
50 # Add BMC nodes to group and validate.
51 : FOR ${bmc} IN @{BMC_LIST}
Prashanth Katti06c687d2017-06-01 04:15:59 -050052 \ Add Nodes To Group ${bmc} ${GROUP}
53 \ Validate Node Added In Group ${bmc} ${GROUP}
54
55Power On Group And Validate
56 [Documentation] Power on all BMCs in group and validate.
57 [Tags] Power_On_Group_And_Validate
58
59 # Sample output of this keyword:
60 # XXX.XXX.XXX.XXX
61 # YYY.YYY.YYY.YYY
62 # ZZZ.ZZZ.ZZZ.ZZZ
63
64 ${nodes}= Get List Of Nodes In Group ${GROUP}
65 Should Not Be Empty ${nodes} msg=Group is empty.
66 Power On Via XCAT ${GROUP}
67
68 # List the BMC nodes.
69
70 @{bmc_nodes}= Split String ${nodes}
71
72 # Validate power status on each BMC node one by one.
73 : FOR ${bmc_node} IN @{bmc_nodes}
74 \ Validate Power Status Via XCAT ${bmc_node} ${poweron_flag}
75
76Power Off Group And Validate
77 [Documentation] Power off all BMCs in group and validate.
78 [Tags] Power_Off_Group_And_Validate
79
80 # Sample output of this keyword:
81 # XXX.XXX.XXX.XXX
82 # YYY.YYY.YYY.YYY
83 # ZZZ.ZZZ.ZZZ.ZZZ
84
85 ${nodes}= Get List Of Nodes In Group ${GROUP}
86 Should Not Be Empty ${nodes} msg=Group is empty.
87 Power Off Via XCAT ${GROUP}
88
89 # List the BMC nodes.
90 @{bmc_nodes}= Split String ${nodes}
91
92 # Validate power status on each BMC node one by one.
93 : FOR ${bmc_node} IN @{bmc_nodes}
94 \ Validate Power Status Via XCAT ${bmc_node} ${poweroff_flag}
Prashanth Kattib974a742017-05-25 06:52:29 -050095
Prashanth Katti1dcd5392017-05-12 04:35:53 -050096*** Keywords ***
97
98Validate XCAT Setup
99 [Documentation] Validate XCAT setup.
100
101 Open Connection And Login To XCAT
102
103 # Check if XCAT is installed.
104 ${cmd_output}= Execute Command ${XCAT_DIR_PATH}/lsxcatd -v
105 Should Not Be Empty ${cmd_output} msg=XCAT not installed.
106
107 Log \n XCAT Version is: \n${cmd_output}
Prashanth Katti477debc2017-05-19 03:01:04 -0500108
109 # Get all the BMC nodes from the config file.
110 ${nodes}= Get List Of BMC Nodes
111 # Make a list of BMC nodes.
112 @{BMC_LIST}= Split To Lines ${nodes}
113 Log To Console BMC nodes to be added:\n ${BMC_LIST}
114 Set Suite Variable @{BMC_LIST}
115
Prashanth Katti06c687d2017-06-01 04:15:59 -0500116 # GROUP should not be empty.
117 Should Not Be EMPTY ${GROUP} msg=Group does not exist.
118
Prashanth Katti477debc2017-05-19 03:01:04 -0500119Validate Power Status Via XCAT
120 [Documentation] Validate power status.
121 [Arguments] ${node} ${flag}=ON
122
123 ${status}= Get Power Status ${node}
124 Run Keyword If '${flag}' == 'ON'
125 ... Should Contain ${status} on msg=Host is off.
126 ... ELSE Should Contain ${status} off msg=Host is on.