OS FFDC for all linux distributions

This commit contains the following ffdc functions that will be run on all linux distros:
OS_msglog
OS_cpufrequency
OS_dmesg
OS_boot

Later I will add functions for specific linux distros (i.e. ubuntu, rhel)

Change-Id: I7460459e2c42818b8322f0d88d76a5d0e7beb524
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/lib/openbmc_ffdc.robot b/lib/openbmc_ffdc.robot
index c9440b8..1f7caff 100755
--- a/lib/openbmc_ffdc.robot
+++ b/lib/openbmc_ffdc.robot
@@ -14,6 +14,10 @@
 ...                │       ├── 20160909102538035251_BMC_led
 ...                │       ├── 20160909102538035251_BMC_record_log
 ...                │       ├── 20160909102538035251_BMC_sensor_list
+...                │       ├── 20160909102538035251_OS_dmesg
+...                │       ├── 20160909102538035251_OS_msglog
+...                │       ├── 20160909102538035251_OS_cpufrequency
+...                │       ├── 20160909102538035251_OS_boot
 ...                │       └── 20160909102538035251_ffdc_report.txt
 ...                └── test_history.txt
 
diff --git a/lib/openbmc_ffdc_list.py b/lib/openbmc_ffdc_list.py
index b367e8b..f71309a 100755
--- a/lib/openbmc_ffdc_list.py
+++ b/lib/openbmc_ffdc_list.py
@@ -49,6 +49,18 @@
     },
 }
 
+# Add file name and correcponding command needed for all Linux distributions
+FFDC_OS_ALL_DISTROS_FILE = {
+    'OS FILES':
+    {
+        # File Name         Command
+        'OS_msglog': 'cat /sys/firmware/opal/msglog',
+        'OS_cpufrequency': 'ppc64_cpu --frequency',
+        'OS_dmesg': 'dmesg',
+        'OS_boot': 'cat /var/log/boot.log',
+    },
+}
+
 # Add file name and correcponding Get Request
 FFDC_GET_REQUEST = {
     'GET REQUESTS':
@@ -70,6 +82,7 @@
         'FFDC Generic Report': 'BMC FFDC Manifest',
         'BMC Specific Files': 'BMC FFDC Files',
         'Get Request FFDC': 'BMC FFDC Get Requests',
+        'OS FFDC': 'OS FFDC Files',
     },
 }
 
@@ -154,6 +167,24 @@
         """
         return FFDC_METHOD_CALL[i_type].items()
 
+    def get_ffdc_os_all_distros_index(self):
+        r"""
+        ########################################################################
+        #   @brief    This method returns the key pair from the dictionary
+        #   @return   Index of the method dictionary
+        ########################################################################
+        """
+        return FFDC_OS_ALL_DISTROS_FILE.keys()
+
+    def get_ffdc_os_all_distros_call(self, i_type):
+        r"""
+        ########################################################################
+        #   @brief    This method returns the key pair from the dictionary
+        #   @return   List of key pair keywords
+        ########################################################################
+        """
+        return FFDC_OS_ALL_DISTROS_FILE[i_type].items()
+
     def get_strip_string(self, i_str):
         r"""
         ########################################################################
diff --git a/lib/openbmc_ffdc_methods.robot b/lib/openbmc_ffdc_methods.robot
index 5c4b9cf..6bdf5e8 100755
--- a/lib/openbmc_ffdc_methods.robot
+++ b/lib/openbmc_ffdc_methods.robot
@@ -5,6 +5,7 @@
 Resource           openbmc_ffdc_utils.robot
 Resource           rest_client.robot
 
+
 *** Keywords ***
 
 ################################################################
@@ -160,3 +161,27 @@
     @{entries}=  Get ffdc get request index
     :FOR  ${index}  IN  @{entries}
     \   Log FFDC Get Requests   ${index}
+
+
+Log OS FFDC
+    [Documentation]    Create file in current FFDC log directory.
+    ...                Executes OS command and write to
+    ...                corresponding file name.
+    [Arguments]        ${key_index}
+
+    Open Connection And Log In  host=${OS_HOST}  username=${OS_USERNAME}
+    ...   password=${OS_PASSWORD}
+    @{cmd_list}=  get ffdc os all distros call  ${key_index}
+    :FOR  ${cmd}  IN  @{cmd_list}
+    \   ${logpath}=  Catenate  SEPARATOR=  ${LOG_PREFIX}  ${cmd[0]}
+    \   Execute Command and Write FFDC  ${cmd[0]}  ${cmd[1]}   ${logpath}
+
+
+OS FFDC
+    [Documentation]    Get the command list and iterate
+
+    Return From Keyword If  '${OS_HOST}' == '${EMPTY}'
+    ...   No OS Host Provided
+    @{entries}=  Get ffdc os all distros index
+    :FOR  ${index}  IN  @{entries}
+    \   Log OS FFDC  ${index}