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


Java OFGetConfigReply类代码示例

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


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

示例1: processOFGetConfigReply

import org.openflow.protocol.OFGetConfigReply; //导入依赖的package包/类
@Override
@LogMessageDocs({
    @LogMessageDoc(level="WARN",
            message="Config Reply from {switch} has " +
                    "miss length set to {length}",
            explanation="The controller requires that the switch " +
                    "use a miss length of 0xffff for correct " +
                    "function",
            recommendation="Use a different switch to ensure " +
                    "correct function")
})
void processOFGetConfigReply(OFChannelHandler h, OFGetConfigReply m)
        throws IOException {
    if (m.getMissSendLength() == (short)0xffff) {
        log.trace("Config Reply from switch {} confirms "
                + "miss length set to 0xffff",
                h.getSwitchInfoString());
    } else {
        // FIXME: we can't really deal with switches that don't send
        // full packets. Shouldn't we drop the connection here?
        // FIXME: count??
        log.warn("Config Reply from switch {} has"
                + "miss length set to {}",
                h.getSwitchInfoString(),
                m.getMissSendLength());
    }
    h.sendHandshakeDescriptionStatsRequest();
    h.setState(WAIT_DESCRIPTION_STAT_REPLY);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:30,代码来源:OFChannelHandler.java

示例2: moveToWaitDescriptionStatReply

import org.openflow.protocol.OFGetConfigReply; //导入依赖的package包/类
/** Move the channel from scratch to WAIT_DESCRIPTION_STAT_REPLY state
 * Builds on moveToWaitConfigReply()
 * adds testing for WAIT_CONFIG_REPLY state
 */
@Test
public void moveToWaitDescriptionStatReply() throws Exception {
    moveToWaitConfigReply();
    resetChannel();
    channel.write(capture(writeCapture));
    expectLastCall().andReturn(null).atLeastOnce();
    replay(channel);

    OFGetConfigReply cr = (OFGetConfigReply)BasicFactory.getInstance()
            .getMessage(OFType.GET_CONFIG_REPLY);
    cr.setMissSendLength((short)0xffff);

    sendMessageToHandlerWithControllerReset(Collections.<OFMessage>singletonList(cr));

    List<OFMessage> msgs = getMessagesFromCapture();
    assertEquals(1, msgs.size());
    assertEquals(OFType.STATS_REQUEST, msgs.get(0).getType());
    OFStatisticsRequest sr = (OFStatisticsRequest)msgs.get(0);
    assertEquals(OFStatisticsType.DESC, sr.getStatisticType());
    // no idea why an  OFStatisticsRequest even /has/ a getStatistics()
    // methods. It really shouldn't
    assertNull(sr.getStatistics());
    verifyUniqueXids(msgs);
    assertEquals(OFChannelHandler.ChannelState.WAIT_DESCRIPTION_STAT_REPLY,
                 handler.getStateForTesting());
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:31,代码来源:OFChannelHandlerTest.java

示例3: processOFGetConfigReply

import org.openflow.protocol.OFGetConfigReply; //导入依赖的package包/类
@Override
void processOFGetConfigReply(final SwitchChannelHandler h,
        final OFGetConfigReply m) throws IOException {
    if (m.getMissSendLength() != (short) 0xffff) {
        h.log.error(
                "Miss send length was not set properly by switch {}",
                h.featuresReply.getDatapathId());
    }
    h.sendHandshakeDescriptionStatsRequest();
    h.setState(WAIT_DESCRIPTION_STAT_REPLY);
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:12,代码来源:SwitchChannelHandler.java

示例4: processOFMessage

import org.openflow.protocol.OFGetConfigReply; //导入依赖的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: processOFMessage

import org.openflow.protocol.OFGetConfigReply; //导入依赖的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

示例6: setConfig

import org.openflow.protocol.OFGetConfigReply; //导入依赖的package包/类
/**
 * Safe config set by Controller.
 *
 * @param config OFSetConfig
 */
private void setConfig(OFSetConfig config) {
    this.config_reply = new OFGetConfigReply();
    this.config_reply.setFlags(config.getFlags());
    this.config_reply.setMissSendLength(config.getMissSendLength());
}
 
开发者ID:lsinfo3,项目名称:ofcprobe,代码行数:11,代码来源:OFConnection1_zero.java

示例7: handleMessages

import org.openflow.protocol.OFGetConfigReply; //导入依赖的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


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