Add IPMI timeout option "-N" to the command execution
Changes:
- By default 3 seconds timeout
- User can override the timeout by using CLI option
"-v IPMI_TIMEOUT:<value>"
Resolves openbmc/openbmc-test-automation#2111
Change-Id: I7cabd060f3652e4f9ebf98029e204c53f89ed14f
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/ipmi_client.py b/lib/ipmi_client.py
index 6264a45..9484c13 100644
--- a/lib/ipmi_client.py
+++ b/lib/ipmi_client.py
@@ -13,18 +13,20 @@
# Set default values for required IPMI options.
ipmi_interface = 'lanplus'
ipmi_cipher_suite = BuiltIn().get_variable_value("${IPMI_CIPHER_LEVEL}", '17')
+ipmi_timeout = BuiltIn().get_variable_value("${IPMI_TIMEOUT}", '3')
ipmi_port = BuiltIn().get_variable_value("${IPMI_PORT}", '623')
ipmi_username = BuiltIn().get_variable_value("${IPMI_USERNAME}", "root")
ipmi_password = BuiltIn().get_variable_value("${IPMI_PASSWORD}", "0penBmc")
ipmi_host = BuiltIn().get_variable_value("${OPENBMC_HOST}")
# Create a list of the required IPMI options.
-ipmi_required_options = ['I', 'C', 'p', 'U', 'P', 'H']
+ipmi_required_options = ['I', 'C', 'N', 'p', 'U', 'P', 'H']
# The following dictionary maps the ipmitool option names (e.g. "I") to our
# more descriptive names (e.g. "interface") for the required options.
ipmi_option_name_map = {
'I': 'interface',
'C': 'cipher_suite',
+ 'N': 'timeout',
'p': 'port',
'U': 'username',
'P': 'password',
diff --git a/lib/ipmi_client.robot b/lib/ipmi_client.robot
index 5c12ac5..a9cd0f2 100755
--- a/lib/ipmi_client.robot
+++ b/lib/ipmi_client.robot
@@ -18,7 +18,7 @@
${cmdByte}= ${EMPTY}
${arrayByte}= array:byte:
${IPMI_USER_OPTIONS} ${EMPTY}
-${IPMI_INBAND_CMD}= ipmitool -C ${IPMI_CIPHER_LEVEL} -p ${IPMI_PORT}
+${IPMI_INBAND_CMD}= ipmitool -C ${IPMI_CIPHER_LEVEL} -N ${IPMI_TIMEOUT} -p ${IPMI_PORT}
${HOST}= -H
${RAW}= raw
diff --git a/lib/resource.robot b/lib/resource.robot
index 401cbe9..4d8ba43 100755
--- a/lib/resource.robot
+++ b/lib/resource.robot
@@ -44,6 +44,8 @@
${IPMI_COMMAND} External
# IPMI chipher default.
${IPMI_CIPHER_LEVEL} ${17}
+# IPMI timeout default.
+${IPMI_TIMEOUT} ${3}
# PDU related parameters
${PDU_TYPE} ${EMPTY}