当前位置: 首页>>代码示例>>Java>>正文


Java OFEchoReply类代码示例

本文整理汇总了Java中org.openflow.protocol.OFEchoReply的典型用法代码示例。如果您正苦于以下问题:Java OFEchoReply类的具体用法?Java OFEchoReply怎么用?Java OFEchoReply使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OFEchoReply类属于org.openflow.protocol包,在下文中一共展示了OFEchoReply类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processOFEchoRequest

import org.openflow.protocol.OFEchoReply; //导入依赖的package包/类
void processOFEchoRequest(OFChannelHandler h, OFEchoRequest m)
    throws IOException {
    OFEchoReply reply = (OFEchoReply)
            BasicFactory.getInstance().getMessage(OFType.ECHO_REPLY);
    reply.setXid(m.getXid());
    reply.setPayload(m.getPayload());
    reply.setLengthU(m.getLengthU());
    h.channel.write(Collections.singletonList(reply));
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:10,代码来源:OFChannelHandler.java

示例2: processOFEchoRequest

import org.openflow.protocol.OFEchoReply; //导入依赖的package包/类
/**
 * Processes OpenFlow echo request message.
 *
 * @param h the switch channel handler
 * @param m the echo request message
 * @throws IOException TODO
 */
void processOFEchoRequest(final SwitchChannelHandler h,
        final OFEchoRequest m) throws IOException {
    final OFEchoReply reply = (OFEchoReply) BasicFactory.getInstance()
            .getMessage(OFType.ECHO_REPLY);
    reply.setXid(m.getXid());
    reply.setPayload(m.getPayload());
    reply.setLengthU(m.getLengthU());
    h.channel.write(Collections.singletonList(reply));
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:17,代码来源:SwitchChannelHandler.java

示例3: processOFEchoRequest

import org.openflow.protocol.OFEchoReply; //导入依赖的package包/类
void processOFEchoRequest(final ControllerChannelHandler h,
        final OFEchoRequest m) throws IOException {
    final OFEchoReply reply = (OFEchoReply) BasicFactory.getInstance()
            .getMessage(OFType.ECHO_REPLY);
    reply.setXid(m.getXid());
    reply.setPayload(m.getPayload());
    reply.setLengthU(m.getLengthU());
    h.channel.write(Collections.singletonList(reply));
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:10,代码来源:ControllerChannelHandler.java

示例4: processOFMessage

import org.openflow.protocol.OFEchoReply; //导入依赖的package包/类
/**
 * Process an OF message received on the channel and
 * update state accordingly.
 *
 * The main "event" of the state machine. Process the received message,
 * send follow up message if required and update state if required.
 *
 * Switches on the message type and calls more specific event handlers
 * for each individual OF message type. If we receive a message that
 * is supposed to be sent from a controller to a switch we throw
 * a SwitchStateExeption.
 *
 * The more specific handlers can also throw SwitchStateExceptions
 *
 * @param h The OFChannelHandler that received the message
 * @param m The message we received.
 * @throws SwitchStateException
 * @throws IOException
 */
void processOFMessage(OFChannelHandler h, OFMessage m) throws IOException {
    h.roleChanger.checkTimeout();
    switch(m.getType()) {
        case HELLO:
            processOFHello(h, (OFHello)m);
            break;
        case BARRIER_REPLY:
            processOFBarrierReply(h, (OFBarrierReply)m);
            break;
        case ECHO_REPLY:
            processOFEchoReply(h, (OFEchoReply)m);
            break;
        case ECHO_REQUEST:
            processOFEchoRequest(h, (OFEchoRequest)m);
            break;
        case ERROR:
            processOFError(h, (OFError)m);
            break;
        case FEATURES_REPLY:
            processOFFeaturesReply(h, (OFFeaturesReply)m);
            break;
        case FLOW_REMOVED:
            processOFFlowRemoved(h, (OFFlowRemoved)m);
            break;
        case GET_CONFIG_REPLY:
            processOFGetConfigReply(h, (OFGetConfigReply)m);
            break;
        case PACKET_IN:
            processOFPacketIn(h, (OFPacketIn)m);
            break;
        case PORT_STATUS:
            processOFPortStatus(h, (OFPortStatus)m);
            break;
        case QUEUE_GET_CONFIG_REPLY:
            processOFQueueGetConfigReply(h, (OFQueueGetConfigReply)m);
            break;
        case STATS_REPLY:
            processOFStatisticsReply(h, (OFStatisticsReply)m);
            break;
        case VENDOR:
            processOFVendor(h, (OFVendor)m);
            break;
        // The following messages are sent to switches. The controller
        // should never receive them
        case SET_CONFIG:
        case GET_CONFIG_REQUEST:
        case PACKET_OUT:
        case PORT_MOD:
        case QUEUE_GET_CONFIG_REQUEST:
        case BARRIER_REQUEST:
        case STATS_REQUEST:
        case FEATURES_REQUEST:
        case FLOW_MOD:
            illegalMessageReceived(h, m);
            break;
    }
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:77,代码来源:OFChannelHandler.java

示例5: processOFEchoReply

import org.openflow.protocol.OFEchoReply; //导入依赖的package包/类
void processOFEchoReply(OFChannelHandler h, OFEchoReply m)
    throws IOException {
    // Do nothing with EchoReplies !!
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:5,代码来源:OFChannelHandler.java

示例6: processOFMessage

import org.openflow.protocol.OFEchoReply; //导入依赖的package包/类
/**
 * Process an OF message received on the channel and update state
 * accordingly.
 *
 * The main "event" of the state machine. Process the received message,
 * send follow up message if required and update state if required.
 *
 * Switches on the message type and calls more specific event handlers
 * for each individual OF message type. If we receive a message that is
 * supposed to be sent from a controller to a switch we throw a
 * SwitchStateExeption.
 *
 * The more specific handlers can also throw SwitchStateExceptions
 *
 * @param h
 *            The SwitchChannelHandler that received the message
 * @param m
 *            The message we received.
 * @throws SwitchStateException
 * @throws IOException
 */
void processOFMessage(final SwitchChannelHandler h, final OFMessage m)
        throws IOException {
    switch (m.getType()) {
    case HELLO:
        this.processOFHello(h, (OFHello) m);
        break;
    case BARRIER_REPLY:
        this.processOFBarrierReply(h, (OFBarrierReply) m);
        break;
    case ECHO_REPLY:
        this.processOFEchoReply(h, (OFEchoReply) m);
        break;
    case ECHO_REQUEST:
        this.processOFEchoRequest(h, (OFEchoRequest) m);
        break;
    case ERROR:
        this.processOFError(h, (OFError) m);
        break;
    case FEATURES_REPLY:
        this.processOFFeaturesReply(h, (OFFeaturesReply) m);
        break;
    case FLOW_REMOVED:
        this.processOFFlowRemoved(h, (OFFlowRemoved) m);
        break;
    case GET_CONFIG_REPLY:
        this.processOFGetConfigReply(h, (OFGetConfigReply) m);
        break;
    case PACKET_IN:
        this.processOFPacketIn(h, (OFPacketIn) m);
        break;
    case PORT_STATUS:
        this.processOFPortStatus(h, (OFPortStatus) m);
        break;
    case QUEUE_GET_CONFIG_REPLY:
        this.processOFQueueGetConfigReply(h, (OFQueueGetConfigReply) m);
        break;
    case STATS_REPLY:
        this.processOFStatisticsReply(h, (OFStatisticsReply) m);
        break;
    case VENDOR:
        this.processOFVendor(h, (OFVendor) m);
        break;
        // The following messages are sent to switches. The controller
        // should never receive them
    case SET_CONFIG:
    case GET_CONFIG_REQUEST:
    case PACKET_OUT:
    case PORT_MOD:
    case QUEUE_GET_CONFIG_REQUEST:
    case BARRIER_REQUEST:
    case STATS_REQUEST:
    case FEATURES_REQUEST:
    case FLOW_MOD:
        this.illegalMessageReceived(h, m);
        break;
    default:
        break;
    }
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:81,代码来源:SwitchChannelHandler.java

示例7: processOFEchoReply

import org.openflow.protocol.OFEchoReply; //导入依赖的package包/类
void processOFEchoReply(final ControllerChannelHandler h,
        final OFEchoReply m) throws IOException {
    // Do nothing with EchoReplies !!
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:5,代码来源:ControllerChannelHandler.java

示例8: handleMessages

import org.openflow.protocol.OFEchoReply; //导入依赖的package包/类
public void handleMessages() {
    List<OFMessage> msgs = null;

    try {
        if (msgReadWriteService != null) {
            msgs = msgReadWriteService.readMessages();
        }
    } catch (Exception e) {
        reportError(e);
    }

    if (msgs == null) {
        logger.debug("{} is down", this);
        // the connection is down, inform core
        reportSwitchStateChange(false);
        return;
    }
    for (OFMessage msg : msgs) {
        logger.trace("Message received: {}", msg);
        this.lastMsgReceivedTimeStamp = System.currentTimeMillis();
        OFType type = msg.getType();
        switch (type) {
        case HELLO:
            // send feature request
            OFMessage featureRequest = factory
                    .getMessage(OFType.FEATURES_REQUEST);
            asyncFastSend(featureRequest);
            // delete all pre-existing flows
            OFMatch match = new OFMatch().setWildcards(OFMatch.OFPFW_ALL);
            OFFlowMod flowMod = (OFFlowMod) factory
                    .getMessage(OFType.FLOW_MOD);
            flowMod.setMatch(match).setCommand(OFFlowMod.OFPFC_DELETE)
                    .setOutPort(OFPort.OFPP_NONE)
                    .setLength((short) OFFlowMod.MINIMUM_LENGTH);
            asyncFastSend(flowMod);
            this.state = SwitchState.WAIT_FEATURES_REPLY;
            startSwitchTimer();
            break;
        case ECHO_REQUEST:
            OFEchoReply echoReply = (OFEchoReply) factory
                    .getMessage(OFType.ECHO_REPLY);
            // respond immediately
            asyncSendNow(echoReply, msg.getXid());
            break;
        case ECHO_REPLY:
            this.probeSent = false;
            break;
        case FEATURES_REPLY:
            processFeaturesReply((OFFeaturesReply) msg);
            break;
        case GET_CONFIG_REPLY:
            // make sure that the switch can send the whole packet to the
            // controller
            if (((OFGetConfigReply) msg).getMissSendLength() == (short) 0xffff) {
                this.state = SwitchState.OPERATIONAL;
            }
            break;
        case BARRIER_REPLY:
            processBarrierReply((OFBarrierReply) msg);
            break;
        case ERROR:
            processErrorReply((OFError) msg);
            break;
        case PORT_STATUS:
            processPortStatusMsg((OFPortStatus) msg);
            break;
        case STATS_REPLY:
            processStatsReply((OFStatisticsReply) msg);
            break;
        case PACKET_IN:
            break;
        default:
            break;
        } // end of switch
        if (isOperational()) {
            ((Controller) core).takeSwitchEventMsg(thisISwitch, msg);
        }
    } // end of for
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:80,代码来源:SwitchHandler.java

示例9: handleSwitchEvent

import org.openflow.protocol.OFEchoReply; //导入依赖的package包/类
protected void handleSwitchEvent(SelectionKey key, SocketChannel sock) {
    OFSwitch sw = switchSockets.get(sock);
    OFMessageAsyncStream stream = sw.getStream();
    try {
        if (key.isReadable()) {
            List<OFMessage> msgs = stream.read();
            if (msgs == null) {
                key.cancel();
                switchSockets.remove(sock);
                return;
            }

            for (OFMessage m : msgs) {
                switch (m.getType()) {
                    case PACKET_IN:
                        sw.handlePacketIn((OFPacketIn) m);
                        break;
                    case HELLO:
                        System.err.println("GOT HELLO from " + sw);
                        break;
                    case ECHO_REQUEST:
                        OFEchoReply reply = (OFEchoReply) stream
                            .getMessageFactory().getMessage(
                                    OFType.ECHO_REPLY);
                        reply.setXid(m.getXid());
                        stream.write(reply);
                        break;
                    default:
                        System.err.println("Unhandled OF message: "
                                + m.getType() + " from "
                                + sock.socket().getInetAddress());
                }
            }
        }
        if (key.isWritable()) {
            stream.flush();
        }

        /**
         * Only register for interest in R OR W, not both, causes stream
         * deadlock after some period of time
         */
        if (stream.needsFlush())
            key.interestOps(SelectionKey.OP_WRITE);
        else
            key.interestOps(SelectionKey.OP_READ);
    } catch (IOException e) {
        // if we have an exception, disconnect the switch
        key.cancel();
        switchSockets.remove(sock);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:53,代码来源:SimpleController.java

示例10: processOFEchoReply

import org.openflow.protocol.OFEchoReply; //导入依赖的package包/类
/**
 * Processes OpenFlow echo reply.
 *
 * @param h the switch channel handler
 * @param m the echo reply message
 * @throws IOException TODO
 */
void processOFEchoReply(final SwitchChannelHandler h,
        final OFEchoReply m) throws IOException {
    // Do nothing with EchoReplies !!
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:12,代码来源:SwitchChannelHandler.java


注:本文中的org.openflow.protocol.OFEchoReply类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。