def scpFiles(self, sourceFilePath=None, destFilePath='.', typeOfScp='download'): """ This method is for running scripts from a Linux machine only and retrivving files off an IxLoad Linux Gateway server. Does not get from Windows unless you installed SSH server. As of 8.50, there is no Rest API to retrieve result folders off the IxLoad Gateway server when the test is done. This method will get your specified result folder out of the IxLoad Gateway Server by using SCP. Requirements: Install sshpass on your local Linux. If your IxLoad Gateway is Windows, you need to download and install OpenSSH. The link below shows the steps: https://www.openixia.com/tutorials?subject=Windows&page=sshOnWindows.html NOTE: - If you get an error message: host key verification failed, this means your local host doesn't have the ssh key of the ssh host that you're connecting to. To create the host key, enter: ssh-keyscan >> ~/.ssh/known_hosts Parameters sourceFilePath: From where. destFilePath: To where. Defaults to the location where the script was executed. typeOfScp: download|upload Usage # Download Windows folder to local Linux restObj.scpFiles('C:\\Results', '/home/hgee', typeOfScp='download') # Download Linux to local Linux restObj.scpFiles('/mnt/ixload-share/file', '/home/hgee', typeOfScp='download') # Upload Linux to Windows restObj.scpFiles('/home/hgee/file.txt', 'C:\\Results', typeOfScp='upload') -v = Show debugs. -rp = recursive and persistent files. -p = An estimate time. -P = Specify a port -C = Compress files on the go. Decompress on the destination to regular size. """ if typeOfScp == 'download': cmd = 'sshpass -p {} scp -o "StrictHostKeyChecking no" -P {} -rp -C {}@{}:{} {}'.format(self.sshPassword, self.sshPort, self.sshUsername, self.apiServerIp, sourceFilePath, destFilePath) if typeOfScp == 'upload': cmd = 'sshpass -p {} scp -P {} -rp -C {} {}@{}:{}'.format(self.sshPassword, self.sshPort, sourceFilePath, self.sshUsername, self.apiServerIp, destFilePath) self.logInfo('SCP Files: {} -> {}'.format(sourceFilePath, destFilePath)) output = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) while True: output.poll() line = output.stdout.readline() if line: self.logInfo('scpFiles: {}'.format(line)) else: break