Exemplo n.º 1
0
def send_desc_request(controller, switch):
    """Request vendor-specific switch description.

    Args:
        controller(:class:`~kytos.core.controller.Controller`):
            the controller being used.
        switch(:class:`~kytos.core.switch.Switch`):
            target to send a stats request.
    """
    multipart_request = MultipartRequest()
    multipart_request.multipart_type = MultipartType.OFPMP_DESC
    emit_message_out(controller, switch.connection, multipart_request)
Exemplo n.º 2
0
def send_desc_request(controller, switch):
    """Method responsible for request stats of flow to switches.

    Args:
        controller(:class:`~kytos.core.controller.Controller`):
            the controller being used.
        switch(:class:`~kytos.core.switch.Switch`):
            target to send a stats request.
    """
    multipart_request = MultipartRequest()
    multipart_request.multipart_type = MultipartType.OFPMP_DESC
    emit_message_out(controller, switch.connection, multipart_request)
Exemplo n.º 3
0
 def _get_versioned_request(of_version):
     if of_version == 0x01:
         return StatsRequest(body_type=StatsType.OFPST_PORT,
                             body=v0x01.PortStatsRequest(
                                 Port.OFPP_NONE))  # All ports
     return MultipartRequest(multipart_type=MultipartType.OFPMP_PORT_STATS,
                             body=v0x04.PortStatsRequest())
Exemplo n.º 4
0
 def _get_versioned_request(of_version):
     if of_version == 0x01:
         return StatsRequest(
             body_type=StatsType.OFPST_FLOW,
             body=v0x01.FlowStatsRequest())
     return MultipartRequest(
         multipart_type=MultipartType.OFPMP_FLOW,
         body=v0x04.FlowStatsRequest())
Exemplo n.º 5
0
def update_flow_list(controller, switch):
    """Request flow stats from switches.

    Args:
        controller(:class:`~kytos.core.controller.Controller`):
            the controller being used.
        switch(:class:`~kytos.core.switch.Switch`):
            target to send a stats request.

    Returns:
        int: multipart request xid

    """
    multipart_request = MultipartRequest()
    multipart_request.multipart_type = MultipartType.OFPMP_FLOW
    multipart_request.body = FlowStatsRequest()
    emit_message_out(controller, switch.connection, multipart_request)
    return multipart_request.header.xid
Exemplo n.º 6
0
def request_port_stats(controller, switch):
    """Request port stats from switches.

    Args:
        controller(:class:`~kytos.core.controller.Controller`):
            the controller being used.
        switch(:class:`~kytos.core.switch.Switch`):
            target to send a stats request.

    Returns:
        int: multipart request xid

    """
    multipart_request = MultipartRequest()
    multipart_request.multipart_type = MultipartType.OFPMP_PORT_STATS
    multipart_request.body = PortStatsRequest()
    emit_message_out(controller, switch.connection, multipart_request)
    return multipart_request.header.xid
Exemplo n.º 7
0
def send_port_request(controller, connection):
    """Send a Port Description Request after the Features Reply."""
    port_request = MultipartRequest()
    port_request.multipart_type = MultipartType.OFPMP_PORT_DESC
    emit_message_out(controller, connection, port_request)