Add support to log collecter CLI options for port

Changes:
    - Added CLI option for HTTPS and IPMI

Tested:
    Tested on sanndbox script.

Change-Id: Idfa5679f92f03198505abfb8604d937bea245ef9
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/ffdc/collect_ffdc.py b/ffdc/collect_ffdc.py
index ef96c6b..698b87b 100644
--- a/ffdc/collect_ffdc.py
+++ b/ffdc/collect_ffdc.py
@@ -27,6 +27,12 @@
 @click.option("-u", "--username", help="Username of the remote host.")
 @click.option("-p", "--password", help="Password of the remote host.")
 @click.option(
+    "-port_https", default=443, show_default=True, help="HTTPS port value."
+)
+@click.option(
+    "-port_ipmi", default=623, show_default=True, help="IPMI port value."
+)
+@click.option(
     "-c",
     "--config",
     default=abs_path + "/ffdc_config.yaml",
@@ -77,6 +83,8 @@
     remote,
     username,
     password,
+    port_https,
+    port_ipmi,
     config,
     location,
     type,
@@ -93,11 +101,15 @@
         "\n********** FFDC (First Failure Data Collection) Starts **********"
     )
 
-    if input_options_ok(remote, username, password, config, type):
+    if input_options_ok(
+        remote, username, password, port_https, port_ipmi, config, type
+    ):
         this_ffdc = ffdc_collector(
             remote,
             username,
             password,
+            port_https,
+            port_ipmi,
             config,
             location,
             type,
@@ -127,7 +139,9 @@
     click.echo("\n********** FFDC Finishes **********\n\n")
 
 
-def input_options_ok(remote, username, password, config, type):
+def input_options_ok(
+    remote, username, password, port_https, port_ipmi, config, type
+):
     r"""
     Verify script options exist via CLI options or environment variables.
     """
diff --git a/ffdc/ffdc_collector.py b/ffdc/ffdc_collector.py
index 7ef197d..87cb569 100644
--- a/ffdc/ffdc_collector.py
+++ b/ffdc/ffdc_collector.py
@@ -119,6 +119,8 @@
         hostname,
         username,
         password,
+        port_https,
+        port_ipmi,
         ffdc_config,
         location,
         remote_type,
@@ -133,6 +135,8 @@
         hostname            name/ip of the targeted (remote) system
         username            user on the targeted system with access to FFDC files
         password            password for user on targeted system
+        port_https          HTTPS port value. By default 443
+        port_ipmi           IPMI port value. By default 623
         ffdc_config         configuration file listing commands and files for FFDC
         location            where to store collected FFDC
         remote_type         os type of the remote host
@@ -145,6 +149,8 @@
         self.hostname = hostname
         self.username = username
         self.password = password
+        self.port_https = str(port_https)
+        self.port_ipmi = str(port_ipmi)
         self.ffdc_config = ffdc_config
         self.location = location + "/" + remote_type.upper()
         self.ssh_remoteclient = None
@@ -925,6 +931,8 @@
                 + self.password
                 + " -H "
                 + self.hostname
+                + " -p "
+                + str(self.port_ipmi)
                 + " power status"
             )
         else:
@@ -933,6 +941,8 @@
                 + self.password
                 + " -H "
                 + self.hostname
+                + " -p "
+                + str(self.port_ipmi)
                 + " power status"
             )
 
@@ -1036,11 +1046,15 @@
         os.environ["hostname"] = self.hostname
         os.environ["username"] = self.username
         os.environ["password"] = self.password
+        os.environ["port_https"] = self.port_https
+        os.environ["port_ipmi"] = self.port_ipmi
 
         # Append default Env.
         self.env_dict["hostname"] = self.hostname
         self.env_dict["username"] = self.username
         self.env_dict["password"] = self.password
+        self.env_dict["port_https"] = self.port_https
+        self.env_dict["port_ipmi"] = self.port_ipmi
 
         try:
             tmp_env_dict = {}
diff --git a/ffdc/ffdc_config.yaml b/ffdc/ffdc_config.yaml
index 10e5ecc..f1a9125 100644
--- a/ffdc/ffdc_config.yaml
+++ b/ffdc/ffdc_config.yaml
@@ -137,22 +137,24 @@
     # File contains the data returned from 'redfishtool GET URL'
     REDFISH_LOGS:
         COMMANDS:
-            - redfishtool -u ${username} -p ${password} -r ${hostname} -S Always
-              raw GET /redfish/v1/AccountService/Accounts
-            - redfishtool -u ${username} -p ${password} -r ${hostname} -S Always
-              raw GET
+            - redfishtool -u ${username} -p ${password} -r
+              ${hostname}:${port_https} -S Always raw GET
+              /redfish/v1/AccountService/Accounts
+            - redfishtool -u ${username} -p ${password} -r
+              ${hostname}:${port_https} -S Always raw GET
               /redfish/v1/Managers/${manager_id}/LogServices/Dump/Entries
-            - redfishtool -u ${username} -p ${password} -r ${hostname} -S Always
-              raw GET /redfish/v1/Systems/system/LogServices/Dump/Entries
-            - redfishtool -u ${username} -p ${password} -r ${hostname} -S Always
-              raw GET /redfish/v1/Systems/system/LogServices/EventLog/Entries
+            - redfishtool -u ${username} -p ${password} -r
+              ${hostname}:${port_https} -S Always raw GET
+              /redfish/v1/Systems/system/LogServices/Dump/Entries
+            - redfishtool -u ${username} -p ${password} -r
+              ${hostname}:${port_https} -S Always raw GET
+              /redfish/v1/Systems/system/LogServices/EventLog/Entries
             - plugin:
                   - plugin_name: plugin.redfish.enumerate_request
                   - plugin_args:
                         - ${hostname}
                         - ${username}
                         - ${password}
-                        - ${manager_id}
                         - /redfish/v1/
                         - json
         FILES:
@@ -168,11 +170,11 @@
     IPMI_LOGS:
         COMMANDS:
             - ipmitool -I lanplus -C 17 -U ${username} -P ${password} -H
-              ${hostname} lan print
+              ${hostname} -p ${port_ipmi} lan print
             - ipmitool -I lanplus -C 17 -U ${username} -P ${password} -H
-              ${hostname} fru list
+              ${hostname} -p ${port_ipmi} fru list
             - ipmitool -I lanplus -C 17 -U ${username} -P ${password} -H
-              ${hostname} user list
+              ${hostname} -p ${port_ipmi} user list
         FILES:
             - "IPMI_LAN_print.txt"
             - "IPMI_FRU_list.txt"