+ overall = True
+
+ # first wait for the network to be up and ready from the slices
+ class CompleterTaskNetworkReadyInSliver(CompleterTask):
+ def __init__(self, test_sliver):
+ self.test_sliver = test_sliver
+ def actual_run(self):
+ return self.test_sliver.check_tcp_ready(port = 9999)
+ def message(self):
+ return "network ready checker for {}".format(self.test_sliver.name())
+ def failure_epilogue(self):
+ print("could not bind port from sliver {}".format(self.test_sliver.name()))
+
+ sliver_specs = {}
+ tasks = []
+ managed_sliver_names = set()
+ for spec in specs:
+ # locate the TestSliver instances involved, and cache them in the spec instance
+ spec['s_sliver'] = self.locate_sliver_obj_cross(spec['server_node'], spec['server_slice'], other_plcs)
+ spec['c_sliver'] = self.locate_sliver_obj_cross(spec['client_node'], spec['client_slice'], other_plcs)
+ message = "Will check TCP between s={} and c={}"\
+ .format(spec['s_sliver'].name(), spec['c_sliver'].name())
+ if 'client_connect' in spec:
+ message += " (using {})".format(spec['client_connect'])
+ utils.header(message)
+ # we need to check network presence in both slivers, but also
+ # avoid to insert a sliver several times
+ for sliver in [ spec['s_sliver'], spec['c_sliver'] ]:
+ if sliver.name() not in managed_sliver_names:
+ tasks.append(CompleterTaskNetworkReadyInSliver(sliver))
+ # add this sliver's name in the set
+ managed_sliver_names .update( {sliver.name()} )
+
+ # wait for the netork to be OK in all server sides
+ if not Completer(tasks, message='check for network readiness in slivers').\
+ run(timedelta(seconds=30), timedelta(seconds=24), period=timedelta(seconds=5)):
+ return False
+
+ # run server and client