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


Java OFStatisticsRequest类代码示例

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


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

示例1: sendFeatureReplyConfiguration

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

示例2: serializeMessage

import org.openflow.protocol.OFStatisticsRequest; //导入依赖的package包/类
private byte[] serializeMessage(OFMessage message) {
	String serializedMsg = "";
	if (message instanceof OFPacketOut) {
		OFPacketOut packetOut = (OFPacketOut)message;
		serializedMsg = MessageSerializer.serializeMessage(this.dummySwitch.getId(), packetOut);
	}
	else if (message instanceof OFFlowMod) {
		OFFlowMod flowMod = (OFFlowMod)message;
		serializedMsg = MessageSerializer.serializeMessage(this.dummySwitch.getId(), flowMod);
	} 
	else if (message instanceof OFStatisticsRequest) {
		OFStatisticsRequest statRequest = (OFStatisticsRequest)message;			
		serializedMsg = MessageSerializer.serializeMessage(this.dummySwitch.getId(), statRequest);
	}
	logger.debug("serialized: " + serializedMsg);
	return serializedMsg.getBytes();
}
 
开发者ID:fp7-netide,项目名称:Engine,代码行数:18,代码来源:SwitchChannelHandler.java

示例3: serializeMessage

import org.openflow.protocol.OFStatisticsRequest; //导入依赖的package包/类
/**
 * Serializes an Openflow Statistics Request message for Pyretic
 * @param switchID switch id
 * @param statsRequest object to be serialized
 * @return
 */
public static String serializeMessage(long switchID, OFStatisticsRequest statsRequest) {
	String retString="";
	switch (statsRequest.getStatisticType()) {
		case DESC: 
			break;
		case FLOW:
			retString = "[\"flow_stats_request\", " + switchID + "]" + "\n";
			break;
		case AGGREGATE:
		case PORT:
			retString = "[\"port_stats_request\", " + switchID + "]" + "\n"; //maybe portId is also required
		case TABLE:
		case VENDOR:
		case QUEUE:
	}
	return retString;
}
 
开发者ID:fp7-netide,项目名称:Engine,代码行数:24,代码来源:MessageSerializer.java

示例4: getStatistics

import org.openflow.protocol.OFStatisticsRequest; //导入依赖的package包/类
@Override
public Object getStatistics(OFStatisticsRequest req) {
    int xid = getNextXid();
    StatisticsCollector worker = new StatisticsCollector(this, xid, req);
    messageWaitingDone.put(xid, worker);
    Future<Object> submit = executor.submit(worker);
    Object result = null;
    try {
        result = submit.get(responseTimerValue, TimeUnit.MILLISECONDS);
        return result;
    } catch (Exception e) {
        logger.warn("Timeout while waiting for {} replies", req.getType());
        result = null; // to indicate timeout has occurred
        return result;
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:17,代码来源:SwitchHandler.java

示例5: getFlows

import org.openflow.protocol.OFStatisticsRequest; //导入依赖的package包/类
/**
 * @param sw
 *            the switch object that we wish to get flows from
 * @param outPort
 *            the output action port we wish to find flows with
 * @return a list of OFFlowStatisticsReply objects or essentially flows
 */
public List<OFFlowStatisticsReply> getFlows(IOFSwitch sw, Short outPort) {

    statsReply = new ArrayList<OFFlowStatisticsReply>();
    List<OFStatistics> values = null;
    Future<List<OFStatistics>> future;

    // Statistics request object for getting flows
    OFStatisticsRequest req = new OFStatisticsRequest();
    req.setStatisticType(OFStatisticsType.FLOW);
    int requestLength = req.getLengthU();
    OFFlowStatisticsRequest specificReq = new OFFlowStatisticsRequest();
    specificReq.setMatch(new OFMatch().setWildcards(0xffffffff));
    specificReq.setOutPort(outPort);
    specificReq.setTableId((byte) 0xff);
    req.setStatistics(Collections.singletonList((OFStatistics) specificReq));
    requestLength += specificReq.getLength();
    req.setLengthU(requestLength);

    try {
        // System.out.println(sw.getStatistics(req));
        future = sw.queryStatistics(req);
        values = future.get(10, TimeUnit.SECONDS);
        if (values != null) {
            for (OFStatistics stat : values) {
                statsReply.add((OFFlowStatisticsReply) stat);
            }
        }
    } catch (Exception e) {
        log.error("Failure retrieving statistics from switch " + sw, e);
    }

    return statsReply;
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:41,代码来源:PortDownReconciliation.java

示例6: sendStatsQuery

import org.openflow.protocol.OFStatisticsRequest; //导入依赖的package包/类
@Override
public void sendStatsQuery(OFStatisticsRequest request, int xid,
                            IOFMessageListener caller) throws IOException {
    request.setXid(xid);
    this.iofMsgListenersMap.put(xid, caller);
    List<OFMessage> msglist = new ArrayList<OFMessage>(1);
    msglist.add(request);
    this.write(msglist);
    return;
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:11,代码来源:OFSwitchBase.java

示例7: queryStatistics

import org.openflow.protocol.OFStatisticsRequest; //导入依赖的package包/类
@Override
public Future<List<OFStatistics>> queryStatistics(OFStatisticsRequest request) throws IOException {
    request.setXid(getNextTransactionId());
    OFStatisticsFuture future = new OFStatisticsFuture(threadPool, this, request.getXid());
    this.statsFutureMap.put(request.getXid(), future);
    List<OFMessage> msglist = new ArrayList<OFMessage>(1);
    msglist.add(request);
    this.write(msglist);
    return future;
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:11,代码来源:OFSwitchBase.java

示例8: sendHandshakeDescriptionStatsRequest

import org.openflow.protocol.OFStatisticsRequest; //导入依赖的package包/类
/**
 * send a description state request
 * @throws IOException
 */
private void sendHandshakeDescriptionStatsRequest() throws IOException {
    // Get Description to set switch-specific flags
    OFStatisticsRequest req = new OFStatisticsRequest();
    req.setStatisticType(OFStatisticsType.DESC);
    req.setXid(handshakeTransactionIds--);

    channel.write(Collections.singletonList(req));
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:13,代码来源:OFChannelHandler.java

示例9: moveToWaitDescriptionStatReply

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

示例10: sendStatsQuery

import org.openflow.protocol.OFStatisticsRequest; //导入依赖的package包/类
@Override
public void sendStatsQuery(OFStatisticsRequest request, int xid,
                            IOFMessageListener caller) throws IOException {
    request.setXid(xid);
    this.iofMsgListenersMap.put(xid, caller);
    List<OFMessage> msglist = new ArrayList<OFMessage>(1);
    msglist.add(request);
    this.channel.write(msglist);
    return;
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:11,代码来源:OFSwitchImpl.java

示例11: getStatistics

import org.openflow.protocol.OFStatisticsRequest; //导入依赖的package包/类
@Override
public Future<List<OFStatistics>> getStatistics(OFStatisticsRequest request) throws IOException {
    request.setXid(getNextTransactionId());
    OFStatisticsFuture future = new OFStatisticsFuture(threadPool, this, request.getXid());
    this.statsFutureMap.put(request.getXid(), future);
    List<OFMessage> msglist = new ArrayList<OFMessage>(1);
    msglist.add(request);
    this.channel.write(msglist);
    return future;
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:11,代码来源:OFSwitchImpl.java

示例12: sendHandshakeDescriptionStatsRequest

import org.openflow.protocol.OFStatisticsRequest; //导入依赖的package包/类
protected void sendHandshakeDescriptionStatsRequest() {
    final OFStatisticsRequest req = new OFStatisticsRequest();
    req.setStatisticType(OFStatisticsType.DESC);
    req.setXid(this.handshakeTransactionIds--);

    this.channel.write(Collections.singletonList(req));

}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:9,代码来源:SwitchChannelHandler.java

示例13: descStatBuilder

import org.openflow.protocol.OFStatisticsRequest; //导入依赖的package包/类
/**
 * Description Stats Reply Builder
 *
 * @param incomingStat incoming Stats Request
 * @return the Stats Reply
 */
private OFDescriptionStatistics descStatBuilder(OFStatisticsRequest incomingStat) {

    OFDescriptionStatistics descStat = new OFDescriptionStatistics();
    descStat.setDatapathDescription("None");
    descStat.setHardwareDescription("OFCProbe Vswitch");
    descStat.setManufacturerDescription("Lehrstuhl fuer Informatik III, University of Wuerzburg");
    descStat.setSerialNumber(String.valueOf(this.dpid));
    descStat.setSoftwareDescription("1.0.3");

    return descStat;
}
 
开发者ID:lsinfo3,项目名称:ofcprobe,代码行数:18,代码来源:OFStatsHandler.java

示例14: getFlows

import org.openflow.protocol.OFStatisticsRequest; //导入依赖的package包/类
/**
 * @param sw
 *            the switch object that we wish to get flows from
 * @param outPort
 *            the output action port we wish to find flows with
 * @return a list of OFFlowStatisticsReply objects or essentially flows
 */
public List<OFFlowStatisticsReply> getFlows(IOFSwitch sw, Short outPort) {

    statsReply = new ArrayList<OFFlowStatisticsReply>();
    List<OFStatistics> values = null;
    Future<List<OFStatistics>> future;

    // Statistics request object for getting flows
    OFStatisticsRequest req = new OFStatisticsRequest();
    req.setStatisticType(OFStatisticsType.FLOW);
    int requestLength = req.getLengthU();
    OFFlowStatisticsRequest specificReq = new OFFlowStatisticsRequest();
    specificReq.setMatch(new OFMatch().setWildcards(0xffffffff));
    specificReq.setOutPort(outPort);
    specificReq.setTableId((byte) 0xff);
    req.setStatistics(Collections.singletonList((OFStatistics) specificReq));
    requestLength += specificReq.getLength();
    req.setLengthU(requestLength);

    try {
        // System.out.println(sw.getStatistics(req));
        future = sw.getStatistics(req);
        values = future.get(10, TimeUnit.SECONDS);
        if (values != null) {
            for (OFStatistics stat : values) {
                statsReply.add((OFFlowStatisticsReply) stat);
            }
        }
    } catch (Exception e) {
        log.error("Failure retrieving statistics from switch " + sw, e);
    }

    return statsReply;
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:41,代码来源:PortDownReconciliation.java

示例15: sendFeatureReplyConfiguration

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


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