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


Java OFStatsType类代码示例

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


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

示例1: processOFMultipartReply

import org.projectfloodlight.openflow.protocol.OFStatsType; //导入依赖的package包/类
private void processOFMultipartReply(OFStatsReply stats) {
    log.debug("Received message {} during switch-driver " +
               "subhandshake " + "from switch {} ... " +
               stats,
               getStringId());

     if (stats.getStatsType() == OFStatsType.EXPERIMENTER) {
         try {
           OFExpPortDescReply expPortDescReply =  (OFExpPortDescReply) stats;
           expPortDes.addAll(expPortDescReply.getEntries());
           if (!expPortDescReply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
               driverHandshakeComplete.set(true);
               return;
           }
          } catch (ClassCastException e) {
              log.error("Unexspected Experimenter Multipart message type {} ",
                      stats.getClass().getName());
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:OFOpticalSwitch13.java

示例2: processOFStatsReply

import org.projectfloodlight.openflow.protocol.OFStatsType; //导入依赖的package包/类
@Override
/**
 * Accumulate a list of the OFTableFeaturesStatsReply's until there 
 * are no more remaining. Then, pass the list to the switch for 
 * parsing and configuration.
 * 
 * The assumption is that the OFMessage dispatcher will call this each
 * time, which it does. We don't loop and receive here.
 * 
 * @param m, The potential OFTableFeaturesStatsReply message we want to include
 */
void processOFStatsReply(OFStatsReply m) {
	if (m.getStatsType() == OFStatsType.TABLE_FEATURES) {
		replies.add((OFTableFeaturesStatsReply) m);
		if (!((OFTableFeaturesStatsReply)m).getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
			handleTableFeaturesMessage(replies, false);
			nextState();
		} 
	} else {
		/* should only receive TABLE_FEATURES here */
		log.error("Received {} message but expected TABLE_FEATURES.", m.getStatsType().toString());
	}

}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:25,代码来源:OFSwitchHandshakeHandler.java

示例3: writeStatsRequest

import org.projectfloodlight.openflow.protocol.OFStatsType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public <REPLY extends OFStatsReply> ListenableFuture<List<REPLY>> writeStatsRequest(OFStatsRequest<REPLY> request) {
    ListenableFuture<List<REPLY>> ofStatsFuture =
            EasyMock.createNiceMock(ListenableFuture.class);

    // We create a mock future and return info from the map
    try {
        OFStatsType statsType = request.getStatsType();
        List<REPLY> replies = (List<REPLY>) statsMap.get(statsType);
        EasyMock.expect(ofStatsFuture.get(EasyMock.anyLong(),
                EasyMock.anyObject(TimeUnit.class))).andReturn(replies).anyTimes();
        EasyMock.expect(ofStatsFuture.get()).andReturn(replies).anyTimes();
        EasyMock.replay(ofStatsFuture);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return ofStatsFuture;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:20,代码来源:MockOFSwitchImpl.java

示例4: moveToWaitDescriptionStatReply

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

	connection.clearMessages();
	OFGetConfigReply cr = factory.buildGetConfigReply()
			.setMissSendLen(0xFFFF)
			.build();

	switchHandler.processOFMessage(cr);

	OFMessage msg = connection.retrieveMessage();
	assertEquals(OFType.STATS_REQUEST, msg.getType());
	OFStatsRequest<?> sr = (OFStatsRequest<?>)msg;
	assertEquals(OFStatsType.DESC, sr.getStatsType());
	verifyUniqueXids(msg);
	assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitDescriptionStatReplyState.class));
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:23,代码来源:OFSwitchHandlerTestBase.java

示例5: moveToWaitDescriptionStatReply

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

    connection.clearMessages();
    OFGetConfigReply cr = factory.buildGetConfigReply()
            .setMissSendLen(0xFFFF)
            .build();

    switchHandler.processOFMessage(cr);

    OFMessage msg = connection.retrieveMessage();
    assertEquals(OFType.STATS_REQUEST, msg.getType());
    OFStatsRequest<?> sr = (OFStatsRequest<?>)msg;
    assertEquals(OFStatsType.DESC, sr.getStatsType());
    verifyUniqueXids(msg);
    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(OFSwitchHandshakeHandler.WaitDescriptionStatReplyState.class));
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:23,代码来源:OFSwitchHandlerTestBase.java

示例6: processOFStatsReply

import org.projectfloodlight.openflow.protocol.OFStatsType; //导入依赖的package包/类
@Override
/**
 * Accumulate a list of the OFTableFeaturesStatsReply's until there
 * are no more remaining. Then, pass the list to the switch for
 * parsing and configuration.
 *
 * The assumption is that the OFMessage dispatcher will call this each
 * time, which it does. We don't loop and receive here.
 *
 * @param m, The potential OFTableFeaturesStatsReply message we want to include
 */
void processOFStatsReply(OFStatsReply m) {
	if (m.getStatsType() == OFStatsType.TABLE_FEATURES) {
		replies.add((OFTableFeaturesStatsReply) m);
		if (!((OFTableFeaturesStatsReply)m).getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
			handleTableFeaturesMessage(replies, false);
			nextState();
		}
	} else {
		/* should only receive TABLE_FEATURES here */
		log.error("Received {} message but expected TABLE_FEATURES.", m.getStatsType().toString());
	}

}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:25,代码来源:OFSwitchHandshakeHandler.java

示例7: processOFStatisticsReply

import org.projectfloodlight.openflow.protocol.OFStatsType; //导入依赖的package包/类
@Override
void processOFStatisticsReply(OFChannelHandler h, OFStatsReply m)
        throws SwitchStateException {
    // Read port description
    if (m.getStatsType() != OFStatsType.PORT_DESC) {
        log.warn("Expecting port description stats but received stats "
                + "type {} from {}. Ignoring ...", m.getStatsType(),
                h.channel.getRemoteAddress());
        return;
    }
    if (m.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
        log.warn("Stats reply indicates more stats from sw {} for "
                + "port description - not currently handled",
                h.getSwitchInfoString());
    }
    h.portDescReply = (OFPortDescStatsReply) m; // temp store
    log.info("Received port desc reply for switch at {}",
            h.getSwitchInfoString());
    try {
        h.sendHandshakeSetConfig();
    } catch (IOException e) {
        log.error("Unable to send setConfig after PortDescReply. "
                + "Error: {}", e.getMessage());
    }
    h.setState(WAIT_CONFIG_REPLY);
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:27,代码来源:OFChannelHandler.java

示例8: ofWireValue

import org.projectfloodlight.openflow.protocol.OFStatsType; //导入依赖的package包/类
public static OFStatsType ofWireValue(short val) {
    switch(val) {
        case DESC_VAL:
            return OFStatsType.DESC;
        case FLOW_VAL:
            return OFStatsType.FLOW;
        case AGGREGATE_VAL:
            return OFStatsType.AGGREGATE;
        case TABLE_VAL:
            return OFStatsType.TABLE;
        case PORT_VAL:
            return OFStatsType.PORT;
        case QUEUE_VAL:
            return OFStatsType.QUEUE;
        case GROUP_VAL:
            return OFStatsType.GROUP;
        case GROUP_DESC_VAL:
            return OFStatsType.GROUP_DESC;
        case GROUP_FEATURES_VAL:
            return OFStatsType.GROUP_FEATURES;
        case EXPERIMENTER_VAL:
            return OFStatsType.EXPERIMENTER;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFStatsType in version 1.2: " + val);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:27,代码来源:OFStatsTypeSerializerVer12.java

示例9: toWireValue

import org.projectfloodlight.openflow.protocol.OFStatsType; //导入依赖的package包/类
public static short toWireValue(OFStatsType e) {
    switch(e) {
        case DESC:
            return DESC_VAL;
        case FLOW:
            return FLOW_VAL;
        case AGGREGATE:
            return AGGREGATE_VAL;
        case TABLE:
            return TABLE_VAL;
        case PORT:
            return PORT_VAL;
        case QUEUE:
            return QUEUE_VAL;
        case GROUP:
            return GROUP_VAL;
        case GROUP_DESC:
            return GROUP_DESC_VAL;
        case GROUP_FEATURES:
            return GROUP_FEATURES_VAL;
        case EXPERIMENTER:
            return EXPERIMENTER_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFStatsType in version 1.2: " + e);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:27,代码来源:OFStatsTypeSerializerVer12.java

示例10: ofWireValue

import org.projectfloodlight.openflow.protocol.OFStatsType; //导入依赖的package包/类
public static OFStatsType ofWireValue(short val) {
    switch(val) {
        case DESC_VAL:
            return OFStatsType.DESC;
        case FLOW_VAL:
            return OFStatsType.FLOW;
        case AGGREGATE_VAL:
            return OFStatsType.AGGREGATE;
        case TABLE_VAL:
            return OFStatsType.TABLE;
        case PORT_VAL:
            return OFStatsType.PORT;
        case QUEUE_VAL:
            return OFStatsType.QUEUE;
        case EXPERIMENTER_VAL:
            return OFStatsType.EXPERIMENTER;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFStatsType in version 1.0: " + val);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:21,代码来源:OFStatsTypeSerializerVer10.java

示例11: toWireValue

import org.projectfloodlight.openflow.protocol.OFStatsType; //导入依赖的package包/类
public static short toWireValue(OFStatsType e) {
    switch(e) {
        case DESC:
            return DESC_VAL;
        case FLOW:
            return FLOW_VAL;
        case AGGREGATE:
            return AGGREGATE_VAL;
        case TABLE:
            return TABLE_VAL;
        case PORT:
            return PORT_VAL;
        case QUEUE:
            return QUEUE_VAL;
        case EXPERIMENTER:
            return EXPERIMENTER_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFStatsType in version 1.0: " + e);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:21,代码来源:OFStatsTypeSerializerVer10.java

示例12: ofWireValue

import org.projectfloodlight.openflow.protocol.OFStatsType; //导入依赖的package包/类
public static OFStatsType ofWireValue(short val) {
    switch(val) {
        case DESC_VAL:
            return OFStatsType.DESC;
        case FLOW_VAL:
            return OFStatsType.FLOW;
        case AGGREGATE_VAL:
            return OFStatsType.AGGREGATE;
        case TABLE_VAL:
            return OFStatsType.TABLE;
        case PORT_VAL:
            return OFStatsType.PORT;
        case QUEUE_VAL:
            return OFStatsType.QUEUE;
        case GROUP_VAL:
            return OFStatsType.GROUP;
        case GROUP_DESC_VAL:
            return OFStatsType.GROUP_DESC;
        case EXPERIMENTER_VAL:
            return OFStatsType.EXPERIMENTER;
        default:
            throw new IllegalArgumentException("Illegal wire value for type OFStatsType in version 1.1: " + val);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:25,代码来源:OFStatsTypeSerializerVer11.java

示例13: toWireValue

import org.projectfloodlight.openflow.protocol.OFStatsType; //导入依赖的package包/类
public static short toWireValue(OFStatsType e) {
    switch(e) {
        case DESC:
            return DESC_VAL;
        case FLOW:
            return FLOW_VAL;
        case AGGREGATE:
            return AGGREGATE_VAL;
        case TABLE:
            return TABLE_VAL;
        case PORT:
            return PORT_VAL;
        case QUEUE:
            return QUEUE_VAL;
        case GROUP:
            return GROUP_VAL;
        case GROUP_DESC:
            return GROUP_DESC_VAL;
        case EXPERIMENTER:
            return EXPERIMENTER_VAL;
        default:
            throw new IllegalArgumentException("Illegal enum value for type OFStatsType in version 1.1: " + e);
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:25,代码来源:OFStatsTypeSerializerVer11.java

示例14: analyzeStatsReply

import org.projectfloodlight.openflow.protocol.OFStatsType; //导入依赖的package包/类
@SuppressWarnings("unused")
private void analyzeStatsReply(OFMessage reply) {
    log.info("recieved stats reply (xid = {} type: {}) from sw {} ",
            reply.getXid(), reply.getType(), getStringId());
    if (reply.getType() == OFType.STATS_REPLY) {
        OFStatsReply sr = (OFStatsReply) reply;
        if (sr.getStatsType() == OFStatsType.FLOW) {
            OFFlowStatsReply fsr = (OFFlowStatsReply) sr;
            log.info("received flow stats sw {} --> {}", getStringId(), fsr);
            // fsr.getEntries().get(0).getMatch().getMatchFields()
            for (OFFlowStatsEntry e : fsr.getEntries()) {
                for (MatchField<?> mf : e.getMatch().getMatchFields()) {
                    log.info("mf is exact: {} for {}: {}",
                            e.getMatch().isExact(mf),
                            mf.id,
                            e.getMatch().get(mf));
                }
            }

        }
    }
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:23,代码来源:OFSwitchImplBase.java

示例15: moveToWaitDescriptionStatReply

import org.projectfloodlight.openflow.protocol.OFStatsType; //导入依赖的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)buildOFMessage(OFType.GET_CONFIG_REPLY);

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

    List<OFMessage> msgs = getMessagesFromCapture();
    assertEquals(1, msgs.size());
    assertEquals(OFType.STATS_REQUEST, msgs.get(0).getType());
    OFStatsRequest<?> sr = (OFStatsRequest<?>) msgs.get(0);
    assertEquals(OFStatsType.DESC, sr.getStatsType());
    verifyUniqueXids(msgs);
    assertEquals(OFChannelHandler.ChannelState.WAIT_DESCRIPTION_STAT_REPLY,
            handler.getStateForTesting());
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:27,代码来源:OFChannelHandlerTest.java


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