adding missing example flows
[integration/test.git] / test / tools / cluster-deployer / remote_host.py
1 # remote_host.py
2
3
4 # The RemoteHost class provides methods to do operations on a remote host
5 #
6
7 from SSHLibrary import SSHLibrary
8
9 class RemoteHost:
10         def __init__(self, host, user, password, rootdir):
11                 self.host = host
12                 self.user = user
13                 self.password = password
14                 self.rootdir = rootdir
15
16         def exec_cmd(self, command):
17                 print "Executing command " + command + " on host " + self.host
18                 lib = SSHLibrary()
19                 lib.open_connection(self.host)
20                 lib.login(username=self.user,password=self.password)
21                 lib.execute_command(command)
22                 lib.close_connection()
23
24
25         def mkdir(self, dir_name):
26                 self.exec_cmd("mkdir -p " + dir_name)
27
28         def copy_file(self, src, dest):
29             lib = SSHLibrary()
30             lib.open_connection(self.host)
31             lib.login(username=self.user, password=self.password)
32             print "Copying " + src + " to " + dest + " on " + self.host
33             lib.put_file(src, dest)
34             lib.close_connection()
35
36         def kill_controller(self):
37             self.exec_cmd("ps axf | grep karaf | grep -v grep | awk '{print \"kill -9 \" $1}' | sh")
38
39         def start_controller(self, dir_name):
40                 self.exec_cmd(dir_name + "/odl/bin/start")