IPMI changes to support port changes

Changes:
    - Added "-p" option with defaulted to port 623.

Change-Id: I4a49505f6ecf1a234caebaf74ed6499b1a8c2fe5
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/gen_cmd.py b/lib/gen_cmd.py
index a654828..18b79e9 100644
--- a/lib/gen_cmd.py
+++ b/lib/gen_cmd.py
@@ -628,10 +628,10 @@
     my_pgm -i -m 1 --password="${my_pw}" /tmp/myfile
 
     command_string = create_command_string('ipmitool', 'power status',
-        I='lanplus', C='3', U='root', P='0penBmc', H='xx.xx.xx.xx')
+        I='lanplus', C='3', 'p=623', U='root', P='0penBmc', H='xx.xx.xx.xx')
 
     Result:
-    ipmitool -I lanplus -C 3 -U root -P 0penBmc -H xx.xx.xx.xx power status
+    ipmitool -I lanplus -C 3 -p 623 -U root -P 0penBmc -H xx.xx.xx.xx power status
 
     By default create_command_string will take measures to preserve the order of the callers options.  In
     some cases, this effort may fail (as when calling directly from a robot program).  In this case, the
diff --git a/lib/ipmi_client.py b/lib/ipmi_client.py
index 2327f75..3c747aa 100644
--- a/lib/ipmi_client.py
+++ b/lib/ipmi_client.py
@@ -13,17 +13,19 @@
 # Set default values for required IPMI options.
 ipmi_interface = 'lanplus'
 ipmi_cipher_suite = BuiltIn().get_variable_value("${IPMI_CIPHER_LEVEL}", '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', 'U', 'P', 'H']
+ipmi_required_options = ['I', 'C', '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',
+    'p': 'port',
     'U': 'username',
     'P': 'password',
     'H': 'host',
@@ -40,14 +42,14 @@
     ipmi_ext_cmd = create_ipmi_ext_command_string('power status')
 
     Result:
-    ipmitool -I lanplus -C 3 -P ******** -H x.x.x.x power status
+    ipmitool -I lanplus -C 3 -p 623 -P ******** -H x.x.x.x power status
 
     Example:
 
     ipmi_ext_cmd = create_ipmi_ext_command_string('power status', C='4')
 
     Result:
-    ipmitool -I lanplus -C 4 -P ******** -H x.x.x.x power status
+    ipmitool -I lanplus -C 4 -p 623 -P ******** -H x.x.x.x power status
 
     Description of argument(s):
     command                         The ipmitool command (e.g. 'power status').
diff --git a/lib/ipmi_client.robot b/lib/ipmi_client.robot
index b71d1c5..0ec6306 100755
--- a/lib/ipmi_client.robot
+++ b/lib/ipmi_client.robot
@@ -17,7 +17,7 @@
 ${cmdByte}=            ${EMPTY}
 ${arrayByte}=          array:byte:
 ${IPMI_USER_OPTIONS}   ${EMPTY}
-${IPMI_INBAND_CMD}=    ipmitool -C ${IPMI_CIPHER_LEVEL}
+${IPMI_INBAND_CMD}=    ipmitool -C ${IPMI_CIPHER_LEVEL} -p ${IPMI_PORT}
 ${HOST}=               -H
 ${RAW}=                raw
 
diff --git a/lib/resource.robot b/lib/resource.robot
index f128d23..bb43a2d 100755
--- a/lib/resource.robot
+++ b/lib/resource.robot
@@ -37,6 +37,7 @@
 # User define input SSH and HTTPS related parameters
 ${SSH_PORT}         22
 ${HTTPS_PORT}       443
+${IPMI_PORT}        623
 ${OPENBMC_SERIAL_HOST}      ${EMPTY}
 ${OPENBMC_SERIAL_PORT}      ${EMPTY}