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


Java OFFlowStatsReply.getEntries方法代码示例

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


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

示例1: analyzeStatsReply

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

示例2: getFlows

import org.projectfloodlight.openflow.protocol.OFFlowStatsReply; //导入方法依赖的package包/类
@Get("json")
@SuppressWarnings("unchecked")
public Map<String, Object> getFlows() {
    Map<String, Object> response = new HashMap<>();
    String switchId = (String) this.getRequestAttributes().get("switch_id");
    logger.debug("Get flows for switch: {}", switchId);
    ISwitchManager switchManager = (ISwitchManager) getContext().getAttributes()
            .get(ISwitchManager.class.getCanonicalName());

    try {
        OFFlowStatsReply replay = switchManager.dumpFlowTable(DatapathId.of(switchId));
        logger.debug("OF_STATS: {}", replay);

        if (replay != null) {
            for (OFFlowStatsEntry entry : replay.getEntries()) {
                String key = String.format("flow-0x%s",
                        Long.toHexString(entry.getCookie().getValue()).toUpperCase());
                response.put(key, buildFlowStat(entry));
            }
        }
    } catch (IllegalArgumentException exception) {
        String messageString = "No such switch";
        logger.error("{}: {}", messageString, switchId, exception);
        MessageError responseMessage = new MessageError(DEFAULT_CORRELATION_ID, System.currentTimeMillis(),
                ErrorType.PARAMETERS_INVALID.toString(), messageString, exception.getMessage());
        response.putAll(MAPPER.convertValue(responseMessage, Map.class));
    }
    return response;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:30,代码来源:FlowsResource.java

示例3: sumflows

import org.projectfloodlight.openflow.protocol.OFFlowStatsReply; //导入方法依赖的package包/类
/**
 * ͳ�Ʒ�������������ɾ��ԭʼ���������ɾ������Ϊ֮����·����ȼ����ߵ������
 * @param sw
 * @param values
 * @return
 */
protected long sumflows(DatapathId sw, List<OFFlowStatsReply> values){
	long sum=0;
	OFFlowStatsReply value=values.get(0);
	List<OFFlowStatsEntry> entries = value.getEntries();
	for(OFFlowStatsEntry entry: entries){
		long bc = entry.getByteCount().getValue();
		sum += bc;
		deleteflowentry(sw,entry);
	}
	return sum;
}
 
开发者ID:pixuan,项目名称:floodlight,代码行数:18,代码来源:Massive_failure_recovery.java

示例4: serializeFlowReply

import org.projectfloodlight.openflow.protocol.OFFlowStatsReply; //导入方法依赖的package包/类
public static void serializeFlowReply(List<OFFlowStatsReply> flowReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
	/* start the array before each reply */
	jGen.writeFieldName("flows"); 
	jGen.writeStartArray();
	for (OFFlowStatsReply flowReply : flowReplies) { // for each flow stats reply
		List<OFFlowStatsEntry> entries = flowReply.getEntries();
		for (OFFlowStatsEntry entry : entries) { // for each flow
			jGen.writeStartObject();
			// list flow stats/info
			jGen.writeStringField("version", entry.getVersion().toString()); // return the enum name
			jGen.writeNumberField("cookie", entry.getCookie().getValue());
			jGen.writeStringField("tableId", entry.getTableId().toString());
			jGen.writeNumberField("packetCount", entry.getPacketCount().getValue());
			jGen.writeNumberField("byteCount", entry.getByteCount().getValue());
			jGen.writeNumberField("durationSeconds", entry.getDurationSec());
			jGen.writeNumberField("durationNSeconds", entry.getDurationNsec());
			jGen.writeNumberField("priority", entry.getPriority());
			jGen.writeNumberField("idleTimeoutSec", entry.getIdleTimeout());
			jGen.writeNumberField("hardTimeoutSec", entry.getHardTimeout());
			switch (entry.getVersion()) {
			case OF_10:
				// flags not supported
				break;
			case OF_11:
				jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer11.toWireValue(entry.getFlags()));
				break;
			case OF_12:
				jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer12.toWireValue(entry.getFlags()));
				break;
			case OF_13:
				jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer13.toWireValue(entry.getFlags()));
				break;
			case OF_14:
				jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer14.toWireValue(entry.getFlags()));
				break;
			default:
				logger.error("Could not decode OFVersion {}", entry.getVersion());
				break;
			}

			MatchSerializer.serializeMatch(jGen, entry.getMatch());

			// handle OF1.1+ instructions with actions within
			if (entry.getVersion() == OFVersion.OF_10) {
				jGen.writeObjectFieldStart("actions");
				OFActionListSerializer.serializeActions(jGen, entry.getActions());
				jGen.writeEndObject();
			} else {
				OFInstructionListSerializer.serializeInstructionList(jGen, entry.getInstructions());
			}

			jGen.writeEndObject();
		} // end for each OFFlowStatsReply entry */
	} // end for each OFStatsReply
	//jGen.writeEndObject();
	jGen.writeEndArray();
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:58,代码来源:StatsReplySerializer.java

示例5: serializeFlowReply

import org.projectfloodlight.openflow.protocol.OFFlowStatsReply; //导入方法依赖的package包/类
public static void serializeFlowReply(List<OFFlowStatsReply> flowReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
	/* start the array before each reply */
	jGen.writeFieldName("flows"); 
	jGen.writeStartArray();
	for (OFFlowStatsReply flowReply : flowReplies) { // for each flow stats reply
		List<OFFlowStatsEntry> entries = flowReply.getEntries();
		for (OFFlowStatsEntry entry : entries) { // for each flow
			jGen.writeStartObject();
			// list flow stats/info
			jGen.writeStringField("version", entry.getVersion().toString()); // return the enum name
			jGen.writeNumberField("cookie", entry.getCookie().getValue());
			jGen.writeStringField("tableId", entry.getTableId().toString());
			jGen.writeNumberField("packetCount", entry.getPacketCount().getValue());
			jGen.writeNumberField("byteCount", entry.getByteCount().getValue());
			jGen.writeNumberField("durationSeconds", entry.getDurationSec());
			jGen.writeNumberField("priority", entry.getPriority());
			jGen.writeNumberField("idleTimeoutSec", entry.getIdleTimeout());
			jGen.writeNumberField("hardTimeoutSec", entry.getHardTimeout());
			switch (entry.getVersion()) {
			case OF_10:
				// flags not supported
				break;
			case OF_11:
				jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer11.toWireValue(entry.getFlags()));
				break;
			case OF_12:
				jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer12.toWireValue(entry.getFlags()));
				break;
			case OF_13:
				jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer13.toWireValue(entry.getFlags()));
				break;
			case OF_14:
				jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer14.toWireValue(entry.getFlags()));
				break;
			default:
				logger.error("Could not decode OFVersion {}", entry.getVersion());
				break;
			}

			MatchSerializer.serializeMatch(jGen, entry.getMatch());

			// handle OF1.1+ instructions with actions within
			if (entry.getVersion() == OFVersion.OF_10) {
				jGen.writeObjectFieldStart("actions");
				OFActionListSerializer.serializeActions(jGen, entry.getActions());
				jGen.writeEndObject();
			} else {
				OFInstructionListSerializer.serializeInstructionList(jGen, entry.getInstructions());
			}

			jGen.writeEndObject();
		} // end for each OFFlowStatsReply entry */
	} // end for each OFStatsReply
	//jGen.writeEndObject();
	jGen.writeEndArray();
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:57,代码来源:StatsReplySerializer.java

示例6: serializeFlowReply

import org.projectfloodlight.openflow.protocol.OFFlowStatsReply; //导入方法依赖的package包/类
public static void serializeFlowReply(List<OFFlowStatsReply> flowReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
	/* start the array before each reply */
	jGen.writeFieldName("flows");
	jGen.writeStartArray();
	for (OFFlowStatsReply flowReply : flowReplies) { // for each flow stats reply
		List<OFFlowStatsEntry> entries = flowReply.getEntries();
		for (OFFlowStatsEntry entry : entries) { // for each flow
			jGen.writeStartObject();
			// list flow stats/info
			jGen.writeStringField("version", entry.getVersion().toString()); // return the enum name
			jGen.writeNumberField("cookie", entry.getCookie().getValue());
			jGen.writeStringField("tableId", entry.getTableId().toString());
			jGen.writeNumberField("packetCount", entry.getPacketCount().getValue());
			jGen.writeNumberField("byteCount", entry.getByteCount().getValue());
			jGen.writeNumberField("durationSeconds", entry.getDurationSec());
			jGen.writeNumberField("durationNSeconds", entry.getDurationNsec());
			jGen.writeNumberField("priority", entry.getPriority());
			jGen.writeNumberField("idleTimeoutSec", entry.getIdleTimeout());
			jGen.writeNumberField("hardTimeoutSec", entry.getHardTimeout());
			switch (entry.getVersion()) {
			case OF_10:
				// flags not supported
				break;
			case OF_11:
				jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer11.toWireValue(entry.getFlags()));
				break;
			case OF_12:
				jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer12.toWireValue(entry.getFlags()));
				break;
			case OF_13:
				jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer13.toWireValue(entry.getFlags()));
				break;
			case OF_14:
				jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer14.toWireValue(entry.getFlags()));
				break;
			default:
				logger.error("Could not decode OFVersion {}", entry.getVersion());
				break;
			}

			MatchSerializer.serializeMatch(jGen, entry.getMatch());

			// handle OF1.1+ instructions with actions within
			if (entry.getVersion() == OFVersion.OF_10) {
				jGen.writeObjectFieldStart("actions");
				OFActionListSerializer.serializeActions(jGen, entry.getActions());
				jGen.writeEndObject();
			} else {
				OFInstructionListSerializer.serializeInstructionList(jGen, entry.getInstructions());
			}

			jGen.writeEndObject();
		} // end for each OFFlowStatsReply entry */
	} // end for each OFStatsReply
	//jGen.writeEndObject();
	jGen.writeEndArray();
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:58,代码来源:StatsReplySerializer.java

示例7: serializeFlowReply

import org.projectfloodlight.openflow.protocol.OFFlowStatsReply; //导入方法依赖的package包/类
public static void serializeFlowReply(List<OFFlowStatsReply> flowReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
	for (OFFlowStatsReply flowReply : flowReplies) { // for each flow stats reply
		//Dose the switch will reply multiple OFFlowStatsReply ?
		//Or we juse need to use the first item of the list.
		List<OFFlowStatsEntry> entries = flowReply.getEntries();
		jGen.writeFieldName("flows");
		jGen.writeStartArray();
		for (OFFlowStatsEntry entry : entries) { // for each flow
			jGen.writeStartObject();
			// list flow stats/info
			jGen.writeStringField("version", entry.getVersion().toString()); // return the enum name
			jGen.writeNumberField("cookie", entry.getCookie().getValue());
			jGen.writeStringField("tableId", entry.getTableId().toString());
			jGen.writeNumberField("packetCount", entry.getPacketCount().getValue());
			jGen.writeNumberField("byteCount", entry.getByteCount().getValue());
			jGen.writeNumberField("durationSeconds", entry.getDurationSec());
			jGen.writeNumberField("priority", entry.getPriority());
			jGen.writeNumberField("idleTimeoutSec", entry.getIdleTimeout());
			jGen.writeNumberField("hardTimeoutSec", entry.getHardTimeout());
			switch (entry.getVersion()) {
			case OF_10:
				// flags not supported
				break;
			case OF_11:
				jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer11.toWireValue(entry.getFlags()));
				break;
			case OF_12:
				jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer12.toWireValue(entry.getFlags()));
				break;
			case OF_13:
				jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer13.toWireValue(entry.getFlags()));
				break;
			case OF_14:
				jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer14.toWireValue(entry.getFlags()));
				break;
			default:
				logger.error("Could not decode OFVersion {}", entry.getVersion());
				break;
			}

			MatchSerializer.serializeMatch(jGen, entry.getMatch());

			// handle OF1.1+ instructions with actions within
			if (entry.getVersion() == OFVersion.OF_10) {
				jGen.writeObjectFieldStart("actions");
				OFActionListSerializer.serializeActions(jGen, entry.getActions());
				jGen.writeEndObject();
			} else {
				OFInstructionListSerializer.serializeInstructionList(jGen, entry.getInstructions());
			}

			jGen.writeEndObject();
		} // end for each OFFlowStatsReply entry
		jGen.writeEndArray();
	} // end for each OFStatsReply
}
 
开发者ID:pixuan,项目名称:floodlight,代码行数:57,代码来源:StatsReplySerializer.java


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