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


Java OFFlowModFlagsSerializerVer12类代码示例

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


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

示例1: serializeFlowMod

import org.projectfloodlight.openflow.protocol.ver12.OFFlowModFlagsSerializerVer12; //导入依赖的package包/类
public static void serializeFlowMod(JsonGenerator jGen, OFFlowMod flowMod) throws IOException, JsonProcessingException {
	
       jGen.configure(Feature.WRITE_NUMBERS_AS_STRINGS, true); // IMHO this just looks nicer and is easier to read if everything is quoted
	
	jGen.writeStartObject();
	jGen.writeStringField("version", flowMod.getVersion().toString()); // return the enum names
	jGen.writeStringField("command", flowMod.getCommand().toString());
	jGen.writeNumberField("cookie", flowMod.getCookie().getValue());
	jGen.writeNumberField("priority", flowMod.getPriority());
	jGen.writeNumberField("idleTimeoutSec", flowMod.getIdleTimeout());
	jGen.writeNumberField("hardTimeoutSec", flowMod.getHardTimeout());
	jGen.writeStringField("outPort", flowMod.getOutPort().toString());

	switch (flowMod.getVersion()) {
	case OF_10:
		break;
	case OF_11:
		jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer11.toWireValue(flowMod.getFlags()));
		jGen.writeNumberField("cookieMask", flowMod.getCookieMask().getValue());
		jGen.writeStringField("outGroup", flowMod.getOutGroup().toString());
		jGen.writeStringField("tableId", flowMod.getTableId().toString());
		break;
	case OF_12:
		jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer12.toWireValue(flowMod.getFlags()));
		jGen.writeNumberField("cookieMask", flowMod.getCookieMask().getValue());
		jGen.writeStringField("outGroup", flowMod.getOutGroup().toString());
		jGen.writeStringField("tableId", flowMod.getTableId().toString());
		break;
	case OF_13:
		jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer13.toWireValue(flowMod.getFlags()));
		jGen.writeNumberField("cookieMask", flowMod.getCookieMask().getValue());
		jGen.writeStringField("outGroup", flowMod.getOutGroup().toString());
		break;
	case OF_14:
		jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer14.toWireValue(flowMod.getFlags()));
		jGen.writeNumberField("cookieMask", flowMod.getCookieMask().getValue());
		jGen.writeStringField("outGroup", flowMod.getOutGroup().toString());
		jGen.writeStringField("tableId", flowMod.getTableId().toString());
		break;
	default:
		logger.error("Could not decode OFVersion {}", flowMod.getVersion());
		break;
	}

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

	// handle OF1.1+ instructions with actions within
	if (flowMod.getVersion() == OFVersion.OF_10) {
		jGen.writeObjectFieldStart("actions");
		OFActionListSerializer.serializeActions(jGen, flowMod.getActions());
		jGen.writeEndObject();
	} else {
		OFInstructionListSerializer.serializeInstructionList(jGen, flowMod.getInstructions());
	} // end not-empty instructions (else)
	jGen.writeEndObject();
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:57,代码来源:OFFlowModSerializer.java

示例2: serializeFlowReply

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

示例3: serializeFlowReply

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

示例4: serializeFlowMod

import org.projectfloodlight.openflow.protocol.ver12.OFFlowModFlagsSerializerVer12; //导入依赖的package包/类
public static void serializeFlowMod(JsonGenerator jGen, OFFlowMod flowMod) throws IOException, JsonProcessingException {

        jGen.configure(Feature.WRITE_NUMBERS_AS_STRINGS, true); // IMHO this just looks nicer and is easier to read if everything is quoted

		jGen.writeStartObject();
		jGen.writeStringField("version", flowMod.getVersion().toString()); // return the enum names
		jGen.writeStringField("command", flowMod.getCommand().toString());
		jGen.writeNumberField("cookie", flowMod.getCookie().getValue());
		jGen.writeNumberField("priority", flowMod.getPriority());
		jGen.writeNumberField("idleTimeoutSec", flowMod.getIdleTimeout());
		jGen.writeNumberField("hardTimeoutSec", flowMod.getHardTimeout());
		jGen.writeStringField("outPort", flowMod.getOutPort().toString());

		switch (flowMod.getVersion()) {
		case OF_10:
			break;
		case OF_11:
			jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer11.toWireValue(flowMod.getFlags()));
			jGen.writeNumberField("cookieMask", flowMod.getCookieMask().getValue());
			jGen.writeStringField("outGroup", flowMod.getOutGroup().toString());
			jGen.writeStringField("tableId", flowMod.getTableId().toString());
			break;
		case OF_12:
			jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer12.toWireValue(flowMod.getFlags()));
			jGen.writeNumberField("cookieMask", flowMod.getCookieMask().getValue());
			jGen.writeStringField("outGroup", flowMod.getOutGroup().toString());
			jGen.writeStringField("tableId", flowMod.getTableId().toString());
			break;
		case OF_13:
			jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer13.toWireValue(flowMod.getFlags()));
			jGen.writeNumberField("cookieMask", flowMod.getCookieMask().getValue());
			jGen.writeStringField("outGroup", flowMod.getOutGroup().toString());
			break;
		case OF_14:
			jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer14.toWireValue(flowMod.getFlags()));
			jGen.writeNumberField("cookieMask", flowMod.getCookieMask().getValue());
			jGen.writeStringField("outGroup", flowMod.getOutGroup().toString());
			jGen.writeStringField("tableId", flowMod.getTableId().toString());
			break;
		default:
			logger.error("Could not decode OFVersion {}", flowMod.getVersion());
			break;
		}

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

		// handle OF1.1+ instructions with actions within
		if (flowMod.getVersion() == OFVersion.OF_10) {
			jGen.writeObjectFieldStart("actions");
			OFActionListSerializer.serializeActions(jGen, flowMod.getActions());
			jGen.writeEndObject();
		} else {
			OFInstructionListSerializer.serializeInstructionList(jGen, flowMod.getInstructions());
		} // end not-empty instructions (else)
		jGen.writeEndObject();
	}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:57,代码来源:OFFlowModSerializer.java

示例5: serializeFlowReply

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

示例6: serializeFlowMod

import org.projectfloodlight.openflow.protocol.ver12.OFFlowModFlagsSerializerVer12; //导入依赖的package包/类
public static void serializeFlowMod(JsonGenerator jGen, OFFlowMod flowMod) throws IOException, JsonProcessingException {
	
       jGen.configure(Feature.WRITE_NUMBERS_AS_STRINGS, true); // IMHO this just looks nicer and is easier to read if everything is quoted
	
	jGen.writeStartObject();
	jGen.writeStringField("version", flowMod.getVersion().toString()); // return the enum names
	jGen.writeStringField("command", flowMod.getCommand().toString());
	jGen.writeNumberField("cookie", flowMod.getCookie().getValue());
	jGen.writeNumberField("cookieMask", flowMod.getCookieMask().getValue());
	jGen.writeStringField("tableId", flowMod.getTableId().toString());
	jGen.writeNumberField("priority", flowMod.getPriority());
	jGen.writeNumberField("idleTimeoutSec", flowMod.getIdleTimeout());
	jGen.writeNumberField("hardTimeoutSec", flowMod.getHardTimeout());
	jGen.writeStringField("outGroup", flowMod.getOutGroup().toString());
	jGen.writeStringField("outPort", flowMod.getOutPort().toString());

	switch (flowMod.getVersion()) {
	case OF_10:
		break;
	case OF_11:
		jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer11.toWireValue(flowMod.getFlags()));
		break;
	case OF_12:
		jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer12.toWireValue(flowMod.getFlags()));
		break;
	case OF_13:
		jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer13.toWireValue(flowMod.getFlags()));
		break;
	case OF_14:
		jGen.writeNumberField("flags", OFFlowModFlagsSerializerVer14.toWireValue(flowMod.getFlags()));
		break;
	default:
		logger.error("Could not decode OFVersion {}", flowMod.getVersion());
		break;
	}

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

	// handle OF1.1+ instructions with actions within
	if (flowMod.getVersion() == OFVersion.OF_10) {
		jGen.writeObjectFieldStart("actions");
		OFActionListSerializer.serializeActions(jGen, flowMod.getActions());
		jGen.writeEndObject();
	} else {
		OFInstructionListSerializer.serializeInstructionList(jGen, flowMod.getInstructions());
	} // end not-empty instructions (else)
	jGen.writeEndObject();
}
 
开发者ID:pixuan,项目名称:floodlight,代码行数:49,代码来源:OFFlowModSerializer.java

示例7: serializeFlowReply

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