forked from vamc19/pythonamo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_cases.py
46 lines (35 loc) · 1019 Bytes
/
test_cases.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import argparse
import socket
import sys
import time
import messages
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('--leader', help='Hostname of leader')
parser.add_argument('--port', help='TCP port', type=int)
args = parser.parse_args()
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((args.leader, args.port))
except Exception as e:
print("Cannot start client. Reason: %s" % e)
sys.exit(1)
nodes = [
"vdi-linux-031.ccs.neu.edu",
"vdi-linux-032.ccs.neu.edu",
"vdi-linux-033.ccs.neu.edu",
"vdi-linux-034.ccs.neu.edu",
"vdi-linux-035.ccs.neu.edu",
"vdi-linux-036.ccs.neu.edu",
"vdi-linux-037.ccs.neu.edu",
"vdi-linux-038.ccs.neu.edu",
# "vdi-linux-039.ccs.neu.edu",
]
def add_nodes():
input("++>")
for node in nodes:
print("++> add-node %s" % node)
msg = messages.client_message("add-node %s" % node)
s.sendall(msg)
time.sleep(3)
if __name__ == '__main__':
add_nodes()