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


Java OFSetConfig类代码示例

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


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

示例1: sendHandshakeSetConfig

import org.openflow.protocol.OFSetConfig; //导入依赖的package包/类
/**
 * Send the configuration requests to tell the switch we want full
 * packets
 * @throws IOException
 */
private void sendHandshakeSetConfig() throws IOException {
    List<OFMessage> msglist = new ArrayList<OFMessage>(3);

    // Ensure we receive the full packet via PacketIn
    // FIXME: We don't set the reassembly flags.
    OFSetConfig configSet = (OFSetConfig) BasicFactory.getInstance()
            .getMessage(OFType.SET_CONFIG);
    configSet.setMissSendLength((short) 0xffff)
        .setLengthU(OFSwitchConfig.MINIMUM_LENGTH);
    configSet.setXid(handshakeTransactionIds--);
    msglist.add(configSet);

    // Barrier
    OFBarrierRequest barrier = (OFBarrierRequest) BasicFactory.getInstance()
            .getMessage(OFType.BARRIER_REQUEST);
    barrier.setXid(handshakeTransactionIds--);
    msglist.add(barrier);

    // Verify (need barrier?)
    OFGetConfigRequest configReq = (OFGetConfigRequest)
            BasicFactory.getInstance().getMessage(OFType.GET_CONFIG_REQUEST);
    configReq.setXid(handshakeTransactionIds--);
    msglist.add(configReq);
    channel.write(msglist);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:31,代码来源:OFChannelHandler.java

示例2: moveToWaitConfigReply

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

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

    List<OFMessage> msgs = getMessagesFromCapture();
    assertEquals(3, msgs.size());
    assertEquals(OFType.SET_CONFIG, msgs.get(0).getType());
    OFSetConfig sc = (OFSetConfig)msgs.get(0);
    assertEquals((short)0xffff, sc.getMissSendLength());
    assertEquals(OFType.BARRIER_REQUEST, msgs.get(1).getType());
    assertEquals(OFType.GET_CONFIG_REQUEST, msgs.get(2).getType());
    verifyUniqueXids(msgs);
    assertEquals(OFChannelHandler.ChannelState.WAIT_CONFIG_REPLY,
                 handler.getStateForTesting());
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:26,代码来源:OFChannelHandlerTest.java

示例3: sendFeatureReplyConfiguration

import org.openflow.protocol.OFSetConfig; //导入依赖的package包/类
/**
 * Send the configuration requests we can only do after we have
 * the features reply
 * @throws IOException
 */
void sendFeatureReplyConfiguration() throws IOException {
    // Ensure we receive the full packet via PacketIn
    OFSetConfig config = (OFSetConfig) factory
            .getMessage(OFType.SET_CONFIG);
    config.setMissSendLength((short) 0xffff)
    .setLengthU(OFSwitchConfig.MINIMUM_LENGTH);
    sw.write(config, null);
    sw.write(factory.getMessage(OFType.GET_CONFIG_REQUEST),
            null);

    // Get Description to set switch-specific flags
    OFStatisticsRequest req = new OFStatisticsRequest();
    req.setStatisticType(OFStatisticsType.DESC);
    req.setLengthU(req.getLengthU());
    Future<List<OFStatistics>> dfuture = 
            sw.getStatistics(req);
    sw.setAttribute(IOFSwitch.SWITCH_DESCRIPTION_FUTURE,
            dfuture);

}
 
开发者ID:smartenit-eu,项目名称:smartenit,代码行数:26,代码来源:Controller.java

示例4: sendHandshakeSetConfig

import org.openflow.protocol.OFSetConfig; //导入依赖的package包/类
/**
 * Sends the configuration requests to tell the switch we want full packets.
 *
 * @throws IOException
 */
private void sendHandshakeSetConfig() throws IOException {
    final List<OFMessage> msglist = new ArrayList<OFMessage>(3);

    // Ensure we receive the full packet via PacketIn

    final OFSetConfig configSet = (OFSetConfig) BasicFactory.getInstance()
            .getMessage(OFType.SET_CONFIG);
    configSet.setMissSendLength(OVXSetConfig.MSL_FULL).setLengthU(
            OFSwitchConfig.MINIMUM_LENGTH);
    configSet.setXid(this.handshakeTransactionIds--);
    msglist.add(configSet);

    // Barrier
    final OFBarrierRequest barrier = (OFBarrierRequest) BasicFactory
            .getInstance().getMessage(OFType.BARRIER_REQUEST);
    barrier.setXid(this.handshakeTransactionIds--);
    msglist.add(barrier);

    // Verify (need barrier?)
    final OFGetConfigRequest configReq = (OFGetConfigRequest) BasicFactory
            .getInstance().getMessage(OFType.GET_CONFIG_REQUEST);
    configReq.setXid(this.handshakeTransactionIds--);
    msglist.add(configReq);
    this.channel.write(msglist);
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:31,代码来源:SwitchChannelHandler.java

示例5: processFeaturesReply

import org.openflow.protocol.OFSetConfig; //导入依赖的package包/类
private void processFeaturesReply(OFFeaturesReply reply) {
    if (this.state == SwitchState.WAIT_FEATURES_REPLY) {
        this.sid = reply.getDatapathId();
        this.buffers = reply.getBuffers();
        this.capabilities = reply.getCapabilities();
        this.tables = reply.getTables();
        this.actions = reply.getActions();
        // notify core of this error event
        for (OFPhysicalPort port : reply.getPorts()) {
            updatePhysicalPort(port);
        }
        // config the switch to send full data packet
        OFSetConfig config = (OFSetConfig) factory
                .getMessage(OFType.SET_CONFIG);
        config.setMissSendLength((short) 0xffff).setLengthU(
                OFSetConfig.MINIMUM_LENGTH);
        asyncFastSend(config);
        // send config request to make sure the switch can handle the set
        // config
        OFMessage getConfig = factory.getMessage(OFType.GET_CONFIG_REQUEST);
        asyncFastSend(getConfig);
        this.state = SwitchState.WAIT_CONFIG_REPLY;
        // inform core that a new switch is now operational
        reportSwitchStateChange(true);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:27,代码来源:SwitchHandler.java

示例6: sendFeatureReplyConfiguration

import org.openflow.protocol.OFSetConfig; //导入依赖的package包/类
/**
 * Send the configuration requests we can only do after we have
 * the features reply
 * @throws IOException
 */
private void sendFeatureReplyConfiguration() throws IOException {
    List<OFMessage> msglist = new ArrayList<OFMessage>(3);

    // Ensure we receive the full packet via PacketIn
    OFSetConfig configSet = (OFSetConfig) factory
            .getMessage(OFType.SET_CONFIG);
    configSet.setMissSendLength((short) 0xffff)
        .setLengthU(OFSwitchConfig.MINIMUM_LENGTH);
    configSet.setXid(-4);
    msglist.add(configSet);

    // Verify (need barrier?)
    OFGetConfigRequest configReq = (OFGetConfigRequest)
            factory.getMessage(OFType.GET_CONFIG_REQUEST);
    configReq.setXid(-3);
    msglist.add(configReq);

    // Get Description to set switch-specific flags
    OFStatisticsRequest req = new OFStatisticsRequest();
    req.setStatisticType(OFStatisticsType.DESC);
    req.setXid(-2);  // something "large"
    req.setLengthU(req.getLengthU());
    msglist.add(req);

    channel.write(msglist);
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:32,代码来源:Controller.java

示例7: processOFSetConfig

import org.openflow.protocol.OFSetConfig; //导入依赖的package包/类
void processOFSetConfig(final ControllerChannelHandler h,
        final OFSetConfig m) {
    this.illegalMessageReceived(h, m);
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:5,代码来源:ControllerChannelHandler.java

示例8: setConfig

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

示例9: startSwitchTimer

import org.openflow.protocol.OFSetConfig; //导入依赖的package包/类
private void startSwitchTimer() {
    this.periodicTimer = new Timer();
    this.periodicTimer.scheduleAtFixedRate(new TimerTask() {
        @Override
        public void run() {
            try {
                Long now = System.currentTimeMillis();
                if ((now - lastMsgReceivedTimeStamp) > switchLivenessTimeout) {
                    if (probeSent) {
                        // switch failed to respond to our probe, consider
                        // it down
                        logger.warn("{} is idle for too long, disconnect",
                                toString());
                        reportSwitchStateChange(false);
                    } else {
                        // send a probe to see if the switch is still alive
                        logger.debug(
                                "Send idle probe (Echo Request) to {}",
                                this);
                        probeSent = true;
                        OFMessage echo = factory
                                .getMessage(OFType.ECHO_REQUEST);
                        asyncFastSend(echo);
                    }
                } else {
                    if (state == SwitchState.WAIT_FEATURES_REPLY) {
                        // send another features request
                        OFMessage request = factory
                                .getMessage(OFType.FEATURES_REQUEST);
                        asyncFastSend(request);
                    } else {
                        if (state == SwitchState.WAIT_CONFIG_REPLY) {
                            // send another config request
                            OFSetConfig config = (OFSetConfig) factory
                                    .getMessage(OFType.SET_CONFIG);
                            config.setMissSendLength((short) 0xffff)
                                    .setLengthU(OFSetConfig.MINIMUM_LENGTH);
                            asyncFastSend(config);
                            OFMessage getConfig = factory
                                    .getMessage(OFType.GET_CONFIG_REQUEST);
                            asyncFastSend(getConfig);
                        }
                    }
                }
            } catch (Exception e) {
                reportError(e);
            }
        }
    }, SWITCH_LIVENESS_TIMER, SWITCH_LIVENESS_TIMER);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:51,代码来源:SwitchHandler.java


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