Example #1
0
def test_p_c_loopback(conn, config):
    '''This test require connections from the output of a consumer
       to the input of a producer.
       '''

    src_alias, dst_alias = config['src_alias'], config['dst_alias']

    msg = messages.IdentifyEventsAddressed(
        src_alias=src_alias,
        dst_alias=dst_alias,
    )
    conn.send(msg)

    responses = conn.receive_multi(.2)
    logger.info('Received {0} event messages'.format(len(responses)))
    for frame in responses:
        response = messages.parse_frame(frame)
        if not isinstance(response, messages.ConsumerIdentifiedValid):
            if not isinstance(response, messages.ConsumerIdentifiedUnknown):
               continue
        logger.debug('Received {0} message from {1}'.format(response.__class__.__name__, response.event_id))
        msg = messages.SendProducerConsumerEvent(
            src_alias=src_alias,
            event_id=response.event_id
        )
        logger.info('Sending Consumer output {0}'.format(response.__class__.__name__, response.event_id))

        conn.send(msg)

        response2 = conn.receive_multi(.2)
        for frame in response2:
            response =  messages.parse_frame(frame)
            if isinstance(response, messages.SendProducerConsumerEvent):
                logger.info('Received expected Producer Consumer Event')
Example #2
0
def test_consumer_output(conn, config):
    '''
       '''

    src_alias, dst_alias = config['src_alias'], config['dst_alias']

    msg = messages.IdentifyEventsAddressed(
        src_alias=src_alias,
        dst_alias=dst_alias,
    )
    conn.send(msg)

    responses = conn.receive_multi(.5)
    for frame in responses:
        response = messages.parse_frame(frame)
        if not isinstance(response, messages.ConsumerIdentifiedValid):
            if not isinstance(response, messages.ConsumerIdentifiedUnknown):
                continue
        logger.debug('Received {0} message from {1}'.format(response.__class__.__name__, response.event_id))
        msg = messages.SendProducerConsumerEvent(
            src_alias=src_alias,
            event_id=response.event_id
        )
        #logger.info('Sending Consumer output {0}'.format(response.__class__.__name__, response.event_id))

        conn.send(msg)
        logger.info('Should not receive response')

        response2 = conn.receive_multi(.5)
        for frame in response2:
            response =  messages.parse_frame(frame)

            logger.error('Received unexpected response {0} from {1}'.format(response.__class__.__name__, response.event_id))
Example #3
0
def identify_producers(conn, config):
    '''Sends Identify Events Addressed
       Receives Identified Producers
       then resends the Identified Producers and waits for correct response
    '''

    src_alias, dst_alias = config['src_alias'], config['dst_alias']

    #conn._socket.settimeout(.025) #commented out because does not work on serial com
    msg = messages.IdentifyEventsAddressed(
        src_alias=src_alias,
        dst_alias=dst_alias,
    )
    conn.send(msg)
    responses = conn.receive_multi()
    logger.info('Received {0} event messages'.format(len(responses)))
    for frame in responses:
        response = messages.parse_frame(frame)
        if not isinstance(response, messages.ProducerIdentified):
           continue
        logger.debug('Received {0} message from {1}'.format(response.__class__.__name__, response.event_id))
        msg = messages.IdentifyProducers(
            src_alias=src_alias,
            event_id=response.event_id
        )

        conn.send(msg)
        response2 = conn.receive_one()
        if isinstance(response, messages.ProducerIdentified):
            logger.info('Received expected {0} message from {1}'.format(response.__class__.__name__, response.event_id))
        if not isinstance(response, messages.ProducerIdentified):
            logger.warning('Received unexpected {0} message from {1}'.format(response.__class__.__name__, response.event_id))
Example #4
0
def Ethernet_Connect(self, ip_data):
    ip_address = self.builder.get_object("ip_address_entry").get_text()
    port_data =self.builder.get_object("port_entry_2").get_text()
    src_alias = self.builder.get_object("eth_src_alias_entry").get_text().strip()
    dst_alias = self.builder.get_object("eth_dst_alias_combo_box").get_active_text().strip()
    node_id = self.builder.get_object("eth_node_id_entry").get_text().strip()
    self.conn = communication.EthernetConnection(ip_address, int(port_data))
    msg = messages.VerifiedNodeAddressed(src_alias=int(src_alias, 16),
        dst_alias=int(dst_alias, 16))
    logger.info('Sending Verify Node Addressed message from {src} to {dst} '.format(
    src=msg.src_alias,
    dst=msg.dst_alias
    ))
    self.conn.connect()
    self.config = {'src_alias':int(src_alias, 16),
        'dst_alias':int(dst_alias, 16),'node_id':int(node_id, 16)}
    self.conn.send(msg)
    responses = self.conn.receive_multi()
    for response in responses:
        msg = messages.parse_frame(response)
    logger.info('Received Node alias {0} and Node ID {1}'.format(msg.src_alias, msg.node_id))
    self.connect_status.set_text("Connected to Alias {0} via IP Address {1} Port {2} with Node ID {3}".format(
        msg.src_alias, ip_address, port_data, msg.node_id))
    self.ethernet_dialog.hide()
    self.Show_Connected_OK(ip_data)
    self.eth_disconnect.show_all()
    self.connected_no.hide()
    self.status_connect_button.hide()
    self.status_dst_alias_combo_box.hide()
def protocol_ident_protocol(conn, config):
    ''''''

    dst_alias, src_alias = config['dst_alias'], config['src_alias']

    msg = messages.PIPMessageSend(
        src_alias=src_alias,
        dst_alias=dst_alias,
        )

    logger.info('Sending Protocol Identification Protocol message from {src} to {dst}'.format(
        src=msg.src_alias,
        dst=msg.dst_alias,
    ))
    conn.send(msg)

    responses = conn.receive_multi()
    for response in responses:
        msg = messages.parse_frame(response)
        if isinstance(msg, messages.PIPMessageRecv):
            logger.info('Received expected {0} message: {1}'.format(
                msg.__class__.__name__, response))
        if not isinstance(msg, messages.PIPMessageRecv):
            logger.error('Received unexpected {0} message: {1}'.format(
                msg.__class__.__name__, response))
    logger.info('Received {0} Datagram messages'.format(len(responses)))



    ''''''
Example #6
0
def identify_events_global(conn, config):
    '''Sends the events Global command to the whole bus'''

    src_alias = config['src_alias']

    msg = messages.IdentifyEventsGlobal(src_alias=src_alias)
    logger.info('Sending Identify Events Global message from {src}'.format(
        src=msg.src_alias,
    ))
    conn.send(msg)
    responses = conn.receive_multi()
    logger.info('Received {0} event messages'.format(len(responses)))
    for response in responses:
        msg = messages.parse_frame(response)
        if isinstance(msg, messages.ConsumerIdentifiedValid):
            logger.debug('Got consumer event ID {0}--from source alias {1}'.format(msg.event_id, msg.src_alias))
        elif isinstance(msg, messages.ConsumerIdentifiedUnknown):
            logger.debug('Got consumer unknown event ID {0}--from source alias {1}'.format(msg.event_id, msg.src_alias))
        elif isinstance(msg, messages.ProducerIdentified):
            logger.debug('Got producer event ID {0}--from source alias {1}'.format(msg.event_id, msg.src_alias))
        elif isinstance(msg, messages.IdentifyProducersUnknown):
            logger.debug('Got producer unknown event ID {0}--from source alias {1}'.format(msg.event_id, msg.src_alias))

        else:
            logger.warning('Received unexpected {0} message: {1}'.format(
                msg.__class__.__name__, response))
Example #7
0
def Serial_Connect(self, w):
    connect_status = self.builder.get_object("connect_status")
    comport_active = self.builder.get_object("serial_entry_2").get_active()
    comport_model = self.builder.get_object("serial_entry_2").get_model()
    comport = comport_model[comport_active][0]
    baud = self.builder.get_object("baud_entry").get_active_text()
    src_alias = self.builder.get_object("src_alias_entry").get_text().strip()
    dst_alias = self.builder.get_object("dst_alias_combo_box").get_active_text().strip()
    node_id = self.builder.get_object("node_id_entry").get_text().strip()
    self.conn = communication.SerialConnection(comport, baud)
    msg = messages.VerifiedNodeAddressed(src_alias=int(src_alias, 16),
        dst_alias=int(dst_alias, 16))
    logger.info('Sending Verify Node Addressed message from {src} to {dst} '.format(
    src=msg.src_alias,
    dst=msg.dst_alias
    ))
    self.conn.connect()
    self.config = {'src_alias':int(src_alias, 16),
        'dst_alias':int(dst_alias, 16),'node_id':int(node_id, 16)}
    self.conn.send(msg)
    responses = self.conn.receive_multi()
    for response in responses:
        msg = messages.parse_frame(response)
    logger.info('Received Node alias {0} with Node ID {1}'.format(msg.src_alias, msg.node_id))
    connect_status.set_text("Connected to Alias {0} via Comport {1} with Node ID {2} ".format(
        msg.src_alias, comport, msg.node_id))

    self.Show_Connected_OK(w)
    self.close_connection.show_all()
    self.connected_no.hide()
    self.status_connect_button.hide()
    self.comport_dialog.hide()
    self.status_dst_alias_combo_box.hide()
Example #8
0
 def Reconnect(self, w):
     comport_active = self.builder.get_object("serial_entry_2").get_active()
     comport_model = self.builder.get_object("serial_entry_2").get_model()
     comport = comport_model[comport_active][0]
     baud = self.builder.get_object("baud_entry").get_active_text()
     src_alias = self.builder.get_object("src_alias_entry").get_text().strip()
     conn = communication.SerialConnection(comport, baud)
     msg = messages.VerifyNodeIDNumberSimple(src_alias=int(src_alias, 16))
     logger.info('Sending VerifyNode message from {src}'.format(
     src=msg.src_alias
     ))
     with conn:
         #self.config = {'src_alias':int(src_alias, 16)}
         conn.send(msg)
         status_cbo = self.builder.get_object('status_dst_alias_combo_box')
         model = status_cbo.get_model()
         model.clear()
         responses = conn.receive_multi()
         logger.info('Received response from {0} node(s)'.format(len(responses)))
         for response in responses:
             response = messages.parse_frame(response)
             logger.info('Received {0} message from Node alias -- {1}'.format(
                 response.__class__.__name__, response.src_alias))
             model.append([response.src_alias])
     self.status_connect_button.show_all()
Example #9
0
def identify_consumers_unknown(conn, config):
    '''Sends Identify Events Addressed
       Receives Identified Consumers
       then resends the Identified Consmers and waits for correct response
    '''

    src_alias, dst_alias = config['src_alias'], config['dst_alias']


    msg = messages.IdentifyEventsAddressed(
        src_alias=src_alias,
        dst_alias=dst_alias
    )
    conn.send(msg)
    responses = conn.receive_multi(.2)
    for frame in responses:
        response = messages.parse_frame(frame)
        if not isinstance(response, messages.ConsumerIdentifiedUnknown):
           continue
        logger.debug('Received {0} message from {1}'.format(response.__class__.__name__, response.event_id))
        msg = messages.IdentifyConsumers(
            src_alias=src_alias,
            event_id=response.event_id
        )
        conn.send(msg)
        response2 = conn.receive_one()
        if isinstance(response, messages.ConsumerIdentifiedUnknown):
            logger.info('Received expected {0} message from {1}'.format(response.__class__.__name__, response.event_id))
        if not isinstance(response, messages.ConsumerIdentifiedUnknown):
            logger.error('Received unexpected {0} message from {1}'.format(response.__class__.__name__, response.event_id))
Example #10
0
def received_response(responses):
    for response in responses:
        msg = messages.parse_frame(response)
        expected_responses = (
        messages.DatagramReceived,
        messages.CidMessage1, 
        messages.CidMessage2,
        messages.CidMessage3, 
        messages.CidMessage4,
        messages.ReserveID,  
        messages.AliasMapRequest,
        messages.AliasMapDefinition,
        messages.InitializationComplete, 
        messages.ConsumerIdentifiedValid, 
        messages.ProducerIdentified,
        messages.ConsumerIdentifiedUnknown,
        messages.IdentifyProducersUnknown,
        messages.SendProducerConsumerEvent)

        if isinstance(msg, expected_responses):
                    logger.info('Received expected {0} message: {1}'.format(
                        msg.__class__.__name__, response))

        if not isinstance(msg, expected_responses):
                    logger.error('Received unexpected {0} message: {1}'.format(
                        msg.__class__.__name__, response))
Example #11
0
def receive_response(responses):
    for response in responses:
        msg = messages.parse_frame(response)
        if isinstance(msg, messages.VerifiedNodeIDNumber):
            logger.info('Received expected {0} message: {1}'.format(
                msg.__class__.__name__, response))
        if not isinstance(msg, messages.VerifiedNodeIDNumber):
            logger.error('Received unexpected {0} message: {1}'.format(
                msg.__class__.__name__, response))
Example #12
0
def alias_map_enquiry(conn, config):
    '''Sends the events addressed command to a connected node on bus'''

    src_alias, dst_alias, node_id =  config['src_alias'], config['dst_alias'], config['dst_id']

    msg = messages.AliasMapEquiry(
        src_alias=src_alias,
        node_id=node_id
        )
    logger.info('Sending Alias Map Equiry  from {src}'.format(
        src=msg.src_alias,
    ))
    #conn._socket.settimeout(1.0)
    conn.send(msg)
    responses = conn.receive_multi()
    for response in responses:
        msg = messages.parse_frame(response)
        if isinstance(msg, messages.AliasMapDefinition):
           logger.error('Received expected {0} message: {1}'.format(
                msg.__class__.__name__, response))
        if not isinstance(msg, messages.AliasMapDefinition):
           logger.error('Received unexpected {0} message: {1}'.format(
                msg.__class__.__name__, response))
    logger.info('Received {0} event messages'.format(len(responses)))

    msg = messages.AliasMapEquiry(
        src_alias=src_alias,
        node_id=[0x00, 0x00, 0x00, 0x00, 0x00, 0x01]
        )
    logger.info('Sending Alias Map Equiry  from {src}'.format(
        src=msg.src_alias,
    ))
    #conn._socket.settimeout(1.0)
    conn.send(msg)

    logger.info('expect no reponse')
    responses = conn.receive_multi()
    for response in responses:
            response =  messages.parse_frame(response)

            logger.error('Received unexpected response')
    logger.info('Received {0} event messages'.format(len(responses)))
Example #13
0
def send_datagram_message(src_alias, dst_alias, data,  conn):
    msg = messages.GeneralDatagram(
        src_alias=src_alias,
        dst_alias=dst_alias,
        #body='2043000000000a'.format(data)
        body='20430000004010'
        )
    #logger.debug('Sending Configuration Datagram message from {src} to {dst}'.format(
        #src=msg.src_alias,
        #dst=msg.dst_alias,
    #))
    conn.send(msg)

    responses = conn.receive_multi(.2)
    for response in responses:
        msg = messages.parse_frame(response)
Example #14
0
def test_pc_notification(conn, config):
    '''Sends the events Global command to the whole bus'''

    src_alias, dst_alias = config['src_alias'], config['dst_alias']

    #conn._socket.settimeout(1.0) #commented out because does not work on serial com
    msg = messages.IdentifyEventsAddressed(
        src_alias=src_alias,
        dst_alias=dst_alias,
        )
    conn.send(msg)
    responses = conn.receive_multi()
    logger.info('Received {0} event messages'.format(len(responses)))

    for frame in responses:
        response = messages.parse_frame(frame)
        logger.debug('Received {0} message from {1}'.format(response.__class__.__name__, response.event_id))
Example #15
0
def verify_node_global(conn, config):
    '''Sends the VerifyNode command to the whole bus'''

    src_alias = config['src_alias']#, config['dst_id']

    msg = messages.VerifyNodeIDNumberSimple(src_alias=src_alias)
    logger.info('Sending VerifyNode message from {src}'.format(
        src=msg.src_alias
    ))
    conn.send(msg)
    responses = conn.receive_multi()
    logger.info('Received response from {0} node(s)'.format(len(responses)))

    for frame in responses:
        response = messages.parse_frame(frame)
        if not isinstance(response, messages.VerifiedNodeIDNumber):
           continue

        logger.info('Received {0} message from Node alias -- {1}'.format(response.__class__.__name__, response.src_alias))
Example #16
0
def send_mtiaddress_message(mti, src_alias, dst_alias, conn):
    msg = MtiMessage(
        src_alias=mti,
        dst_alias=dst_alias,
        #body='{0:>02X}'.format(mti)
        )
    logger.info('Sending unknown MTI message from {src}'.format(
        src=msg.src_alias,
        dst=msg.dst_alias,
    ))
    conn.send(msg)
    responses = conn.receive_multi(.01)
    for response in responses:
        msg = messages.parse_frame(response)
        if isinstance(msg, messages.InteractionRejected):
            logger.info('Received expected {0} message: {1}'.format(
                msg.__class__.__name__, response))
        if not isinstance(msg, messages.InteractionRejected):
            logger.error('Received unexpected {0} message: {1}'.format(
                msg.__class__.__name__, response))
Example #17
0
def send_datagram_message(mti, src_alias, dst_alias, conn):
    msg = messages.GeneralDatagram(
        src_alias=src_alias,
        dst_alias=dst_alias,
        body='{0:>02X}'.format(mti)
        )
    logger.debug('Sending Unknown Datagram Type message from {src} to {dst}'.format(
        src=msg.src_alias,
        dst=msg.dst_alias,
    ))
    conn.send(msg)

    responses = conn.receive_multi(.03)
    for response in responses:
        msg = messages.parse_frame(response)
        if isinstance(msg, messages.DatagramTypeNotAccepted):
            logger.info('Received expected {0} message: {1}'.format(
                msg.__class__.__name__, response))
        if not isinstance(msg, messages.DatagramTypeNotAccepted):
            logger.error('Received unexpected {0} message: {1}'.format(
                msg.__class__.__name__, response))
Example #18
0
 def Discover_Nodes(self, ip_data):
     ip_address = self.builder.get_object("ip_address_entry").get_text()
     port_data = self.builder.get_object("port_entry_2").get_text()
     src_alias = self.builder.get_object("eth_src_alias_entry").get_text().strip()
     conn = communication.EthernetConnection(ip_address, int(port_data))
     msg = messages.VerifyNodeIDNumberSimple(src_alias=int(src_alias, 16))
     logger.info('Sending VerifyNode message from {src}'.format(
     src=msg.src_alias
     ))
     with conn:
         conn.send(msg)
         cbo_ = self.builder.get_object('eth_dst_alias_combo_box')
         model = cbo_.get_model()
         model.clear()
         responses = conn.receive_multi()
         logger.info('Received response from {0} node(s)'.format(len(responses)))
         for response in responses:
             response = messages.parse_frame(response)
             logger.info('Received {0} message from Node alias -- {1}'.format(
                 response.__class__.__name__, response.src_alias))
             model.append([response.src_alias])
Example #19
0
def simple_node_ident_info(conn, config):
    ''''''

    src_alias, dst_alias , node_id =  config['src_alias'], config['dst_alias'] , config['node_id']

    msg = messages.SimpleNodeIdentInfo(
        src_alias=src_alias,
        dst_alias=dst_alias,

    )
    logger.info('Sending Simple Node Ident Info from {src} to {dst}'.format(
        src=msg.src_alias,
        dst=msg.dst_alias,
    ))
    conn.send(msg)

    responses = conn.receive_multi()
    for response in responses:
        msg = messages.parse_frame(response)
        if isinstance(msg, messages.SimpleNodeIdentInfoAck):
            logger.info('Received expected {0} message: {1}'.format(
                msg.__class__.__name__, response))
        if not isinstance(msg, messages.SimpleNodeIdentInfoAck):
            logger.error('Received expected {0} message: {1}'.format(
                msg.__class__.__name__, response))
    logger.info('Received {0} messages'.format(len(responses)))



    msg = messages.DatagramReceived(
        src_alias=src_alias,
        dst_alias=dst_alias,

    )

    logger.info('Sending Message Received from {src} to {dst}'.format(
        src=msg.src_alias,
        dst=msg.dst_alias,
    ))
    conn.send(msg)
Example #20
0
def receive_response(responses):
    for response in responses:
        msg = messages.parse_frame(response)
        expected_responses = (
        messages.DatagramReceived,
        messages.DatagramConfiguration,
        messages.GeneralDatagram,
        messages.DatagramLast,
        messages.StartDatagramFrame,
        messages.DatagramRejected,
        messages.DatagramLast,
        messages.DatagramGeneral_1,
        messages.DatagramGeneral_2,
        messages.DatagramTypeNotAccepted
        )

        if isinstance(msg, expected_responses):
            logger.info('Received expected {0} message: {1}'.format(
                msg.__class__.__name__, response))
        if not isinstance(msg, expected_responses):
            logger.error('Received unexpected {0} message: {1}'.format(
                msg.__class__.__name__, response))
def verify_node_addressed(conn, config):
    '''Sends the VerifyNode Addressed command to connected node'''

    dst_alias, src_alias = config['dst_alias'], config['src_alias']

    msg = messages.VerifiedNodeAddressed(
        src_alias=src_alias,
        dst_alias=dst_alias,
    )
    logger.info('Sending Verify Node Addressed from {src} to {dst}'.format(
        src=msg.src_alias,
        dst=msg.dst_alias,
    ))

    conn.send(msg)
    responses = conn.receive_multi()
    for response in responses:
        msg = messages.parse_frame(response)
        if not isinstance(msg, messages.VerifiedNodeIDNumber):
            continue

        logger.info('Received Node alias {0} and Node ID {1}'.format(msg.src_alias, msg.node_id))
Example #22
0
def received_response(responses):
    for response in responses:
        msg = messages.parse_frame(response)
        expected_responses = (
        messages.DatagramReceived,
        messages.CidMessage1,
        messages.CidMessage2,
        messages.CidMessage3,
        messages.CidMessage4,
        messages.ReserveID,
        messages.AliasMapRequest,
        messages.AliasMapDefinition,
        messages.InitializationComplete,
        messages.VerifiedNodeIDNumber)


        if isinstance(msg, expected_responses):
                    logger.info('Received expected {0} message: {1}'.format(
                        msg.__class__.__name__, response))

        if not isinstance(msg, expected_responses):
                    logger.error('Received unexpected {0} message: {1}'.format(
                        msg.__class__.__name__, response))
Example #23
0
def receive_response_two(responses):
    for response in responses:
        msg = messages.parse_frame(response)
        logger.error('Received unexpected {0} message: {1}'.format(
                msg.__class__.__name__, response))
Example #24
0
def alias_conflict(conn, config):
    '''Sends the events addressed command to the whole bus'''

    src_alias, dst_alias, node_id =  config['src_alias'], config['dst_alias'], config['dst_id']
    #conn._socket.settimeout(.7) #commented out because does not work on serial com

    logger.info("check no-response global message with alias conflict")

    msg = messages.VerifyNodeIDNumberSimple(
        src_alias=dst_alias,
        body=(('0' * 11) + '1')
    )
    logger.info('Sending no-response global message with alias conflict message from {src}'.format(
        src=msg.src_alias,

    ))
    conn.send(msg)

    responses = conn.receive_multi()
    received_response(responses)
    #conn._socket.settimeout(.9) #commented out because does not work on serial com

    logger.info('Received {0} messages'.format(len(responses)))
    logger.info("check response-inducing global message with alias conflict")
    response = messages.parse_frame(responses[-1])
    msg = messages.VerifyNodeIDNumberSimple(
        src_alias=response.src_alias,
    )
    conn.send(msg)

    responses = conn.receive_multi()
    received_response(responses)
   # conn._socket.settimeout(1.0) #commented out because does not work on serial com

    logger.info("check addressed message with alias conflict")
    response = messages.parse_frame(responses[-1])
    msg = messages.VerifiedNodeAddressed(
        src_alias=response.src_alias,
        dst_alias=src_alias
    )
    logger.info('Sending check addressed message with alias conflict message from {src}'.format(
        src=msg.src_alias,
    ))
    conn.send(msg)

    responses = conn.receive_multi()
    received_response(responses)
    logger.info('Received {0} messages'.format(len(responses)))

    logger.info("check CheckID with alias conflict")
    response = messages.parse_frame(responses[-1])
    msg = messages.CidMessage1(
        src_alias=response.src_alias,


    )
    logger.info('Sending check CheckID with alias conflict message from {src}'.format(
        src=msg.src_alias,
    ))
    conn.send(msg)

    responses = conn.receive_multi()
    received_response(responses)
    logger.info('Received {0} messages'.format(len(responses)))
    
    logger.info("check ReserveID with aliasconflict")
    response = messages.parse_frame(responses[-1])
    msg = messages.ReserveID(
        src_alias=response.src_alias,


    )
    logger.info('Sending check ReserveID with alias conflict message from {src}'.format(
        src=msg.src_alias,
    ))
    conn.send(msg)

    responses = conn.receive_multi()
    received_response(responses)
    logger.info('Received {0} messages'.format(len(responses)))