diff options
author | selias <samelias@cisco.com> | 2017-05-26 14:51:50 +0200 |
---|---|---|
committer | Samuel Eliáš <samelias@cisco.com> | 2017-06-30 11:05:53 +0000 |
commit | d32194f3afb0ec725d178effe6ae589571287602 (patch) | |
tree | 285fca263e6208c86b81f1202c99dcd0982b9781 /resources/libraries/python/ssh.py | |
parent | 4a946c16a4935e52b3e9039e4661813c256a8934 (diff) |
CSIT-619 HC Test: Honeycomb performance testing - initial commit
- keywords and scripts for HC performance testing setup
- basic performance suite: operational data read
- traffic script and keywords used in tests
Change-Id: Ic0290be73a7c925ea2561f8cd2524c5cb83fcda2
Signed-off-by: selias <samelias@cisco.com>
Diffstat (limited to 'resources/libraries/python/ssh.py')
-rw-r--r-- | resources/libraries/python/ssh.py | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/resources/libraries/python/ssh.py b/resources/libraries/python/ssh.py index db39a0701c..ca6d6556a1 100644 --- a/resources/libraries/python/ssh.py +++ b/resources/libraries/python/ssh.py @@ -307,17 +307,35 @@ class SSH(object): """ chan.close() - def scp(self, local_path, remote_path): - """Copy files from local_path to remote_path. + def scp(self, local_path, remote_path, get=False): + """Copy files from local_path to remote_path or vice versa. connect() method has to be called first! + + :param local_path: Path to local file that should be uploaded; or + path where to save remote file. + :param remote_path: Remote path where to place uploaded file; or + path to remote file which should be downloaded. + :param get: scp operation to perform. Default is put. + :type local_path: str + :type remote_path: str + :type get: bool """ - logger.trace('SCP {0} to {1}:{2}'.format( - local_path, self._ssh.get_transport().getpeername(), remote_path)) + if not get: + logger.trace('SCP {0} to {1}:{2}'.format( + local_path, self._ssh.get_transport().getpeername(), + remote_path)) + else: + logger.trace('SCP {0}:{1} to {2}'.format( + self._ssh.get_transport().getpeername(), remote_path, + local_path)) # SCPCLient takes a paramiko transport as its only argument scp = SCPClient(self._ssh.get_transport(), socket_timeout=10) start = time() - scp.put(local_path, remote_path) + if not get: + scp.put(local_path, remote_path) + else: + scp.get(remote_path, local_path) scp.close() end = time() logger.trace('SCP took {0} seconds'.format(end-start)) |