IPMI channel support test use case
Added:
- Test case to verify supported IPMI channel of the system.
- Test case to verify invalid IPMI channel response.
- Keyword to get the MAC address.
- Keyword to get the valid physical network count.
- Added expect_error parameter to standard IPMI keyword args.
For reference: openbmc/openbmc#3036
Resolves openbmc/openbmc-test-automation#1313
Change-Id: Ie94e87094056248c335822b1bdc41b8254bfa343
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/bmc_network_utils.robot b/lib/bmc_network_utils.robot
index 41b248c..8c0e2ef 100644
--- a/lib/bmc_network_utils.robot
+++ b/lib/bmc_network_utils.robot
@@ -85,6 +85,7 @@
[Return] ${cmd_output}
+# TODO: openbmc/openbmc-test-automation#1331
Get BMC MAC Address
[Documentation] Get system MAC address.
@@ -103,6 +104,28 @@
[Return] ${words[1]}
+
+Get BMC MAC Address List
+ [Documentation] Get system MAC address
+
+ # Sample output of "ip addr | grep ether":
+ # link/ether xx.xx.xx.xx.xx.xx brd ff:ff:ff:ff:ff:ff
+
+ ${cmd_output}= BMC Execute Command /sbin/ip addr | grep ether
+
+ # Split the line and return MAC address.
+ # Split list data:
+ # link/ether | xx:xx:xx:xx:xx:xx | brd | ff:ff:ff:ff:ff:ff
+ # link/ether | xx:xx:xx:xx:xx:xx | brd | ff:ff:ff:ff:ff:ff
+
+ ${mac_list}= Create List
+ @{lines}= Split To Lines ${cmd_output[0]}
+ :FOR ${line} IN @{lines}
+ \ @{words}= Split String ${line}
+ \ Append To List ${mac_list} ${words[1]}
+
+ [Return] ${mac_list}
+
Get BMC Hostname
[Documentation] Get BMC hostname.
diff --git a/lib/ipmi_client.robot b/lib/ipmi_client.robot
index 2a3b743..60c5a45 100755
--- a/lib/ipmi_client.robot
+++ b/lib/ipmi_client.robot
@@ -112,12 +112,17 @@
[Return] ${output}
Run External IPMI Standard Command
- [Arguments] ${args}
+ [Arguments] ${args} ${fail_on_err}=${1}
+
+ # Description of argument(s):
+ # args IPMI command to be executed.
+ # fail_on_err Fail if keyword the IPMI command fails
${ipmi_cmd}= Catenate SEPARATOR=
... ${IPMI_EXT_CMD} ${IPMI_USER_OPTIONS} -P${SPACE}${IPMI_PASSWORD}
... ${SPACE}${HOST}${SPACE}${OPENBMC_HOST}${SPACE}${args}
${rc} ${output}= Run And Return RC and Output ${ipmi_cmd}
+ Return From Keyword If ${fail_on_err} == ${0} ${output}
Should Be Equal ${rc} ${0} msg=${output}
[Return] ${output}