Data-Test-Executer Framework speziell zum Test von Datenverarbeitungen mit Datengenerierung, Systemvorbereitungen, Einspielungen, ganzheitlicher diversifizierender Vergleich
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

33 lines
1.1 KiB

#
# ----------------------------------------------------------
"""
This module implements the technique to interact via ssh to the test-object.
The class has to be constructed by the tool-Handling because of keyword "ssh" in the configuration,
then it will be called with the interface / abstract-class cli_abstract
"""
import os
import utils.cli_abstract
import basic
import paramiko
class CliFcts(utils.cli_abstract.CliFcts):
def execCmd(self, cmds):
"""
:param cmds:
:return:
"""
ssh = paramiko.SSHClient()
ssh.load_system_host_keys(os.path.expanduser('~/.ssh/known_hosts'))
if self.conn["password"]:
ssh.connect(self.conn["host"], username=self.conn["user"], password=self.conn["password"])
else:
ssh.connect(self.conn["host"], username=self.conn["user"])
shell = ssh.invoke_shell()
for cmd in cmds:
stdin, stdout, stderr = ssh.exec_command(cmd + "\n")
self.sysout = stdout.read()
stdin.close()
stderr.close()
stdout.close()
ssh.close()