ffdc: Use paramiko non blocking APIs

- Set 1: Use paramiko non blocking APIs to better manage user input timeout values.
         Remove duplicate entries in OPENBMC DUMP_LOGS.
- Set 2: Restore OPENBMC:DUMP_LOGS:COMMANDS with new layout design.
- Set 3: Restore 1 second delay.
- Set 4: Additional info for Timeout Error message.
- Set 5: Restore standalone LINUX block. Keep UBUNTU and RHEL as they were.

Tests:
- Set 1: Regression tests to all supported remote systems.
- Set 2: Regression tests to all supported remote systems.
- Set 3: Regression tests to all supported remote systems.
- Set 4: Regression tests to all supported remote systems.

Signed-off-by: Peter D  Phan <peterp@us.ibm.com>
Change-Id: I3fafaefcb58dba500755f914facd95ce08095e32
diff --git a/ffdc/ssh_utility.py b/ffdc/ssh_utility.py
index 44a76ff..56d4dad 100644
--- a/ffdc/ssh_utility.py
+++ b/ffdc/ssh_utility.py
@@ -8,6 +8,7 @@
 from paramiko.buffered_pipe import PipeTimeout as PipeTimeout
 from scp import SCPClient, SCPException
 import sys
+import time
 import socket
 from socket import timeout as SocketTimeout
 
@@ -79,15 +80,26 @@
 
         """
 
+        empty = ''
+        cmd_start = time.time()
         try:
-            stdin, stdout, stderr = self.sshclient.exec_command(command, timeout=default_timeout)
-            stdout.channel.recv_exit_status()
-            response = stdout.readlines()
-            return response
+            stdin, stdout, stderr = \
+                self.sshclient.exec_command(command, timeout=default_timeout)
+            start = time.time()
+            while time.time() < start + default_timeout:
+                if stdout.channel.exit_status_ready():
+                    break
+                time.sleep(1)
+
+            return stderr.readlines(), stdout.readlines()
+
         except (paramiko.AuthenticationException, paramiko.SSHException,
-                paramiko.ChannelException) as e:
+                paramiko.ChannelException, SocketTimeout) as e:
             # Log command with error. Return to caller for next command, if any.
-            print("\n>>>>>\tERROR: Fail remote command %s %s %s\n\n" % (command, e.__class__, e))
+            print("\n>>>>>\tERROR: Fail remote command %s %s" % (e.__class__, e))
+            print(">>>>>\tCommand '%s' Elapsed Time %s" %
+                  (command, time.strftime("%H:%M:%S", time.gmtime(time.time() - cmd_start))))
+            return empty, empty
 
     def scp_connection(self):