本文整理汇总了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();
}
示例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();
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}
示例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
}