for spec in specs:
port = spec['port']
# server side
- s_test_sliver = self.locate_sliver_obj_cross (spec['server_node'],spec['server_slice'],other_plcs)
- if not s_test_sliver.run_tcp_server(port,timeout=20):
- overall=False
+ # the issue here is that we have the server run in background
+ # and so we have no clue if it took off properly or not
+ # looks like in some cases it does not
+ s_test_sliver = self.locate_sliver_obj_cross (spec['server_node'], spec['server_slice'], other_plcs)
+ if not s_test_sliver.run_tcp_server(port, timeout=20):
+ overall = False
break
# idem for the client side
- c_test_sliver = self.locate_sliver_obj_cross (spec['client_node'],spec['client_slice'],other_plcs)
+ c_test_sliver = self.locate_sliver_obj_cross (spec['client_node'], spec['client_slice'], other_plcs)
# use nodename from locatesd sliver, unless 'client_connect' is set
if 'client_connect' in spec:
destination = spec['client_connect']
else:
- destination=s_test_sliver.test_node.name()
- if not c_test_sliver.run_tcp_client(destination,port):
- overall=False
+ destination = s_test_sliver.test_node.name()
+ if not c_test_sliver.run_tcp_client(destination, port):
+ overall = False
return overall
# painfully enough, we need to allow for some time as netflow might show up last
def name (self):
return "%s@%s"%(self.test_slice.name(),self.test_node.name())
- def check_initscript_stamp(self,stamp):
- utils.header("Checking for initscript stamp %s on sliver %s"%(stamp,self.name()))
+ def check_initscript_stamp(self, stamp):
+ utils.header("Checking for initscript stamp %s on sliver %s"%(stamp, self.name()))
return self.test_ssh.run("ls -l /var/tmp/%s.stamp"%stamp)==0
- def run_tcp_server (self,port,timeout=10):
+ def run_tcp_server (self, port, timeout=10):
server_command = "./tcptest.py server -p %d -t %d"%(port,timeout)
return self.test_ssh.copy("tcptest.py")==0 and \
- self.test_ssh.run(server_command,background=True)==0
+ self.test_ssh.run(server_command, background=True)==0
- def run_tcp_client (self,servername,port,retry=5):
- client_command="./tcptest.py client -a %s -p %d"%(servername,port)
+ def run_tcp_client (self, servername, port, retry=5):
+ client_command="./tcptest.py client -a %s -p %d"%(servername, port)
if self.test_ssh.copy("tcptest.py")!=0: return False
utils.header ("tcp client - first attempt")
- if self.test_ssh.run(client_command,background=False)==0: return True
+ if self.test_ssh.run(client_command, background=False)==0: return True
# if first try has failed, wait for <retry> s an try again
time.sleep(retry)
utils.header ("tcp client - second attempt")
- if self.test_ssh.run(client_command,background=False)==0: return True
+ if self.test_ssh.run(client_command, background=False)==0: return True
return False
# use the node's main ssh root entrance, as the slice entrance might be down
-def system(command,background=False,silent=False, dry_run=None):
- dry_run = dry_run if dry_run is not None else getattr(options,'dry_run',False)
+def system(command, background=False, silent=False, dry_run=None):
+ dry_run = dry_run if dry_run is not None else getattr(options, 'dry_run', False)
if dry_run:
print 'dry_run:',command
return 0
pattern=pattern.replace("?",".")
return re.compile(pattern).match(string)
-def locate_hooks_scripts (message,path,extensions):
+def locate_hooks_scripts (message, path, extensions):
print message,'searching',path,'for extensions',extensions
scripts=[]
for ext in extensions:
# quick & dirty - should probably use the parseroption object instead
# and move to TestMain as well
exclude_options_keys = [ 'ensure_value' , 'read_file', 'read_module' ]
-def show_options (message,options):
+def show_options (message, options):
now=time.strftime("%H:%M:%S", time.localtime())
print ">",now,"--",message
for k in dir(options):