def send_event_to_WLserver(dut_obj_handle, message, conn, block=True): """ used to send tcp request to Worklist Server """ try: thread_i = httpclienttoworklist.HttpClientToWorklistServer( dut_handle=dut_obj_handle, url=agentcfg.WL_HTTP_SERVER_URL, timeout=agentcfg.AGENT2WL_HTTP_CLIENT_TIMEOUT) thread_i.msg = ResponseClientHandle.switch_msg_stream_type_dict2str( message) thread_i.msg_type = ( ResponseClientHandle.switch_msg_stream_type_str2dict(message) ).get(event.KEY_MESSAGE) thread_i.conn = conn thread_i.start() if True == block: thread_i.join() except Exception, e: err_info = ( "(Request from client %s)Start http client to WorkList's occurs exception:%s" % (ResponseClientHandle.get_client_ipaddress(conn), e)) log.debug_err(err_info) ResponseClientHandle.handle_except(message, conn, err_info)
def construct_agent_send_message_sequence_property(self): """ 更新从Agent发送出去消息的KEY_SEQUENCE属性 """ new_message = ResponseClientHandle.switch_msg_stream_type_str2dict( self.msg) #生成sequence_id in_sequence_id = MessageProcessing.construct_sequence_id( event.KEY_SENDER_AGENT) #更新sequence属性数据 new_message[event.KEY_SEQUENCE] = in_sequence_id log_info = ("HttpClientToWorklistServer construct sequence id: %s" % in_sequence_id) log.debug_info(log_info) self.msg = ResponseClientHandle.switch_msg_stream_type_dict2str( new_message)