Esempio n. 1
0
    def test_emit_message_in_out(self, mock_message_in):
        """Test emit_message in and out."""

        emit_message_in(self.mock_controller, self.mock_connection, 'in')
        mock_message_in.assert_called()

        emit_message_out(self.mock_controller, self.mock_connection, 'in')
        mock_message_in.assert_called()
Esempio n. 2
0
 def emit_message_in(self, connection, message):
     """Emit a KytosEvent for an incoming message containing the message
     and the source."""
     if connection.is_alive():
         emit_message_in(self.controller, connection, message)
         if message.header.message_type.name.lower() == 'ofpt_port_status':
             self.update_port_status(message, connection)
         elif message.header.message_type.name.lower() == 'ofpt_packet_in':
             self.update_links(message, connection)
Esempio n. 3
0
    def emit_message_in(self, connection, message):
        """Emit a KytosEvent for each incoming message.

        Also update links and port status.
        """
        if not connection.is_alive():
            return
        emit_message_in(self.controller, connection, message)
        msg_type = message.header.message_type.name.lower()
        if msg_type == 'ofpt_port_status':
            self.update_port_status(message, connection)
        elif msg_type == 'ofpt_packet_in':
            self.update_links(message, connection)
Esempio n. 4
0
 def emit_message_in(self, connection, message):
     """Emit a KytosEvent for an incoming message containing the message
     and the source."""
     if connection.is_alive():
         emit_message_in(self.controller, connection, message)