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


Java OFFlowStatsEntry.getVersion方法代码示例

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


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

示例1: getInstructions

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入方法依赖的package包/类
private List<OFInstruction> getInstructions(OFFlowStatsEntry entry) {
    switch (entry.getVersion()) {
        case OF_10:
            return Lists.newArrayList(
                    OFFactoryVer13.INSTANCE.instructions().applyActions(entry.getActions()));
        case OF_11:
        case OF_12:
        case OF_13:
        case OF_14:
        case OF_15:
            return entry.getInstructions();
        default:
            log.warn("Unknown OF version {}", entry.getVersion());
    }
    return Lists.newLinkedList();
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:17,代码来源:FlowEntryBuilder.java

示例2: getInstructions

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入方法依赖的package包/类
private List<OFInstruction> getInstructions(OFFlowStatsEntry entry) {
    switch (entry.getVersion()) {
        case OF_10:
            return Lists.newArrayList(
                    OFFactoryVer13.INSTANCE.instructions().applyActions(entry.getActions()));
        case OF_11:
        case OF_12:
        case OF_13:
            return entry.getInstructions();
        default:
            log.warn("Unknown OF version {}", entry.getVersion());
    }
    return Lists.newLinkedList();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:15,代码来源:FlowEntryBuilder.java

示例3: getActions

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入方法依赖的package包/类
public static List<OFAction> getActions(OFFlowStatsEntry e) {
    if(e.getVersion() == OFVersion.OF_10) {
        return e.getActions();
    } else {
        for(OFInstruction i: e.getInstructions()) {
            if(i.getType() == OFInstructionType.APPLY_ACTIONS) {
                return ((OFInstructionApplyActions) i).getActions();
            }
        }
        return ImmutableList.of();
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:13,代码来源:ActionUtils.java

示例4: serializeFlowReply

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入方法依赖的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.OFFlowStatsEntry; //导入方法依赖的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.OFFlowStatsEntry; //导入方法依赖的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.OFFlowStatsEntry; //导入方法依赖的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.OFFlowStatsEntry.getVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。