Example #1
0
def send_echo(controller, switch):
    """Send echo request to a datapath.

    Keep the connection alive through symmetric echoes.
    """
    echo = EchoRequest(data=b'kytosd_10')
    emit_message_out(controller, switch.connection, echo)
Example #2
0
def update_flow_list(controller, switch):
    """Method responsible for request stats of flow to switches.

    Args:
        controller(:class:`~kytos.core.controller.Controller`):
            the controller beeing used.
        switch(:class:`~kytos.core.switch.Switch`):
            target to send a stats request.
    """
    body = FlowStatsRequest()
    stats_request = StatsRequest(body_type=StatsTypes.OFPST_FLOW, body=body)
    # req.pack()
    emit_message_out(controller, switch.connection, stats_request)
Example #3
0
 def emit_message_out(self, connection, message):
     """Emit a KytosEvent for an outgoing message containing the message
     and the destination."""
     if connection.is_alive():
         emit_message_out(self.controller, connection, message)
Example #4
0
def say_hello(controller, connection):
    """Send back a Hello packet with the same version as the switch."""
    hello = Hello()
    emit_message_out(controller, connection, hello)
Example #5
0
def send_set_config(controller, switch):
    """Send a SetConfig message after the OpenFlow handshake."""
    set_config = SetConfig()
    set_config.flags = ConfigFlags.OFPC_FRAG_NORMAL
    set_config.miss_send_len = 0xffff  #Send the whole packet
    emit_message_out(controller, switch.connection, set_config)
Example #6
0
def send_set_config(controller, switch):
    """Send a SetConfig message after the OpenFlow handshake."""
    set_config = SetConfig()
    set_config.flags = ConfigFlags.OFPC_FRAG_NORMAL
    set_config.miss_send_len = ControllerMaxLen.OFPCML_NO_BUFFER
    emit_message_out(controller, switch.connection, set_config)
Example #7
0
def send_port_request(controller, connection):
    """Send a Port Description Request after the Features Reply."""
    port_request = MultipartRequest()
    port_request.multipart_type = MultipartTypes.OFPMP_PORT_DESC
    emit_message_out(controller, connection, port_request)