Update client and test code to accept different IPMI cipher level value
Change-Id: I6e0bd4439094c3b91003cf89d61e8b25ed60515d
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/ipmi_client.py b/lib/ipmi_client.py
index 6ed5a51..f3394d7 100644
--- a/lib/ipmi_client.py
+++ b/lib/ipmi_client.py
@@ -9,12 +9,15 @@
from robot.libraries.BuiltIn import BuiltIn
-def build_ipmi_ext_cmd(quiet=None):
+def build_ipmi_ext_cmd(ipmi_cipher_level=None, quiet=None):
r"""
Build the global IPMI_EXT_CMD variable.
If global variable IPMI_EXT_CMD already has a value, this keyword will
- simply return without taking any action.
+ simply return without taking any action with the following exception:
+
+ If ipmi_cipher_level is is anything but None, this function will continue
+ on and re-build the IPMI_EXT_CMD variable.
This keyword is designed for use by keywords which use the IPMI_EXT_CMD
variable (e.g. 'Run External IPMI Raw Command'). This keyword is
@@ -27,12 +30,14 @@
username.
Description of argument(s):
+ # ipmi_cipher_level IPMI cipher level value
+ # (e.g. "1", "2", "3", "15", "16", "17").
# quiet Indicates whether this keyword should run
# without any output to the console.
"""
ipmi_ext_cmd = BuiltIn().get_variable_value("${IPMI_EXT_CMD}", "")
- if ipmi_ext_cmd != "":
+ if ipmi_ext_cmd != "" and not ipmi_cipher_level:
return
quiet = int(gp.get_var_value(quiet, 0))
@@ -40,8 +45,9 @@
ipmi_username = BuiltIn().get_variable_value("${IPMI_USERNAME}", "root")
ipmi_password = BuiltIn().get_variable_value("${IPMI_PASSWORD}",
"0penBmc")
- ipmi_cipher_level = BuiltIn().get_variable_value("${IPMI_CIPHER_LEVEL}",
- "3")
+ if not ipmi_cipher_level:
+ ipmi_cipher_level = BuiltIn().get_variable_value("${IPMI_CIPHER_LEVEL}",
+ "3")
old_ipmi_ext_cmd = "ipmitool -I lanplus -C " + str(ipmi_cipher_level)\
+ " -P " + ipmi_password
diff --git a/tests/ipmi/test_general_ipmi.robot b/tests/ipmi/test_general_ipmi.robot
index f2d9e44..63599e1 100755
--- a/tests/ipmi/test_general_ipmi.robot
+++ b/tests/ipmi/test_general_ipmi.robot
@@ -49,7 +49,7 @@
:FOR ${cipher_level} IN @{valid_cipher_list}
\ ${status}= Execute IPMI Command With Cipher ${cipher_level}
- \ Should Be Equal ${status} ${0}
+ \ Should Be Equal ${status} ${True}
Verify Unsupported Cipher List
@@ -58,7 +58,7 @@
:FOR ${cipher_level} IN @{unsupported_cipher_list}
\ ${status}= Execute IPMI Command With Cipher ${cipher_level}
- \ Should Be Equal ${status} ${1}
+ \ Should Be Equal ${status} ${False}
Verify Supported Cipher List Via Lan Print
@@ -900,9 +900,6 @@
# cipher_level IPMI chipher level value
# (e.g. "1", "2", "3", "15", "16", "17").
- ${ipmi_cmd}= Catenate SEPARATOR=
- ... ipmitool -I lanplus -C ${cipher_level} -P${SPACE}${IPMI_PASSWORD}
- ... ${SPACE}${HOST}${SPACE}${OPENBMC_HOST}${SPACE}mc info
+ ${status}= Run Keyword And Return Status Build IPMI Ext Cmd ${cipher_level}
- ${rc} ${output}= Run And Return RC and Output ${ipmi_cmd}
- [Return] ${rc}
+ [Return] ${status}