def scheduler_handshake(current_test): cl = client.TCPClient(LOG.getLogger("clientlog", "Agent")) env = envelope.DaytonaEnvelope() ret = cl.send(current_test.serverip, current_test.serverport, env.construct("DAYTONA_HANDSHAKE", "handshake2")) if ret == "SUCCESS": return True else: return False
def __init__(self, db, cfg, lctx): self.dbinstance = db self.cfg = cfg self.testmap = db.tests_to_run self.cl = client.TCPClient(LOG.getLogger("clientlog", "DH")) self.ev = envelope.DaytonaEnvelope() self.HOST = common.get_local_ip() self.PORT = cfg.DHPORT self.CPORT = cfg.CPORT self.scheduler_thread = common.FuncThread(self.dispatch, True) self.testmon_thread = common.FuncThread(self.testmon, True) self.lctx = lctx
def __init__(self, db, cfg, lctx): """ Scheduler class constructor which initialize class variables and other threads """ self.dbinstance = db self.cfg = cfg self.testmap = db.tests_to_run self.cl = client.TCPClient(LOG.getLogger("clientlog", "DH")) self.ev = envelope.DaytonaEnvelope() self.HOST = common.get_local_ip() self.PORT = cfg.DHPORT self.CPORT = cfg.CPORT self.scheduler_thread = common.FuncThread(self.dispatch, True) self.testmon_thread = common.FuncThread(self.testmon, True) self.lctx = lctx
def scheduler_handshake(current_test): """ This procedure is a part of 2-way handshake between scheduler and agent. If agent receive handshake message from scheduler, then agent also send a handshake message to scheduler to check if agent can communicate with scheduler on scheduler port. This part is important as later we need to transfer log files to scheduler using scheduler port :param current_test: Test object :return: true if scheduler respond otherwise false """ cl = client.TCPClient(LOG.getLogger("clientlog", "Agent")) env = envelope.DaytonaEnvelope() ret = cl.send(current_test.serverip, current_test.serverport, env.construct("DAYTONA_HANDSHAKE", "handshake2")) if ret == "SUCCESS": return True else: return False
print "Unknown response received from host" print response sys.exit() else: print "Error - Unknown response received from host" print retsend sys.exit() else: print "Error - No response received from host" sys.exit() if __name__ == "__main__": read_arguments() tcp_client = client.TCPClient(LOG.getLogger("tcpclientlog", "daytona-cli")) env = envelope.DaytonaEnvelope() check_host_hearbeat(tcp_client, env) if action == 0: define_test(tcp_client, env) elif action == 1: add_test(tcp_client, env) elif action == 2: update_test(tcp_client, env) elif action == 3: run_test(tcp_client, env) elif action == 5: get_result(tcp_client, env) else: print "Error - Invalid action" display_usage()