本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFTableStatsReply类的典型用法代码示例。如果您正苦于以下问题:Java OFTableStatsReply类的具体用法?Java OFTableStatsReply怎么用?Java OFTableStatsReply使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFTableStatsReply类属于org.projectfloodlight.openflow.protocol包,在下文中一共展示了OFTableStatsReply类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: publishTableStats
import org.projectfloodlight.openflow.protocol.OFTableStatsReply; //导入依赖的package包/类
private synchronized Collection<OFTableStatsEntry> publishTableStats(Dpid dpid,
OFTableStatsReply reply) {
//TODO: Get rid of synchronized
fullTableStats.putAll(dpid, reply.getEntries());
if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
return fullTableStats.removeAll(dpid);
}
return null;
}
示例2: pushTableStatistics
import org.projectfloodlight.openflow.protocol.OFTableStatsReply; //导入依赖的package包/类
private void pushTableStatistics(Dpid dpid, OFTableStatsReply replies) {
DeviceId did = DeviceId.deviceId(Dpid.uri(dpid));
List<TableStatisticsEntry> tableStatsEntries = replies.getEntries().stream()
.map(entry -> buildTableStatistics(did, entry))
.filter(Objects::nonNull)
.collect(Collectors.toList());
providerService.pushTableStatistics(did, tableStatsEntries);
}
示例3: tableStatsProcess
import org.projectfloodlight.openflow.protocol.OFTableStatsReply; //导入依赖的package包/类
@Override
public void tableStatsProcess(Dpid dpid, OFTableStatsReply reply) {
//magic number
if (reply.getXid() != 1130) {
return;
}
TableStatisticsFeature tsf = new TableStatisticsFeature();
List<OFTableStatsEntry> otse = reply.getEntries();
Date date = new java.sql.Timestamp(Calendar.getInstance().getTime().getTime());
for (OFTableStatsEntry t : otse) {
if (t.getActiveCount() == 0) {
break;
}
UnitTableStatistics uts = new UnitTableStatistics(t.getMaxEntries(),
t.getActiveCount(), t.getLookupCount().getValue(), t.getMatchedCount().getValue());
uts.setDate(date);
FeatureIndex fi = new FeatureIndex();
fi.setSwitchDatapathId(dpid.value());
fi.setSwitchTableId(t.getTableId().getValue());
// extract rich feature -> store to UnitTablestatistics
uts = (UnitTableStatistics) extractRichFeature(fi, uts, AthenaFeatureField.TABLE_STATS);
tsf.addFeatureData(fi, uts);
}
// printTableStatsLFT(tStatisticsLFT);
providerService.tableStatsHandler(tsf);
}
示例4: publishTableStats
import org.projectfloodlight.openflow.protocol.OFTableStatsReply; //导入依赖的package包/类
private synchronized Collection<OFTableStatsEntry> publishTableStats(Dpid dpid,
OFTableStatsReply reply) {
//TODO: Get rid of synchronized
fullTableStats.putAll(dpid, reply.getEntries());
if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
return fullTableStats.removeAll(dpid);
}
return null;
}
示例5: serializeTableReply
import org.projectfloodlight.openflow.protocol.OFTableStatsReply; //导入依赖的package包/类
/***
* Serializes Table Statistics
* @author Naveen
* @param tableReplies
* @param jGen
* @throws IOException
* @throws JsonProcessingException
*/
public static void serializeTableReply(List<OFTableStatsReply> tableReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
OFTableStatsReply tableReply = tableReplies.get(0); // we will get only one tableReply and it will contains many OFTableStatsEntry ?
jGen.writeStringField("version", tableReply.getVersion().toString()); //return the enum name
jGen.writeFieldName("table");
jGen.writeStartArray();
for(OFTableStatsEntry entry : tableReply.getEntries()) {
jGen.writeStartObject();
//Fields common to all OF versions
//For OF 1.3, only these fields are applicable
jGen.writeStringField("tableId",entry.getTableId().toString());
jGen.writeNumberField("activeCount", entry.getActiveCount());
jGen.writeNumberField("lookUpCount", entry.getLookupCount().getValue());
jGen.writeNumberField("matchCount", entry.getMatchedCount().getValue());
//Fields Applicable only for specific Versions
switch (entry.getVersion()) {
case OF_12:
//Fields applicable only to OF 1.2
jGen.writeNumberField("writeSetFields", entry.getWriteSetfields().getValue());
jGen.writeNumberField("applySetFields", entry.getApplySetfields().getValue());
jGen.writeNumberField("metaDataMatch", entry.getMetadataMatch().getValue());
jGen.writeNumberField("metaDataWrite", entry.getMetadataWrite().getValue());
case OF_11:
//Fields applicable to OF 1.1 & 1.2
jGen.writeStringField("match", entry.getMatch().toString());
jGen.writeNumberField("instructions", entry.getInstructions());
jGen.writeNumberField("writeActions", entry.getWriteActions());
jGen.writeNumberField("applyActions", entry.getApplyActions());
jGen.writeNumberField("config", entry.getConfig());
case OF_10:
//Fields applicable to OF 1.0, 1.1 & 1.2
jGen.writeStringField("name",entry.getName());
jGen.writeNumberField("wildcards", entry.getWildcards());
jGen.writeNumberField("maxEntries", entry.getMaxEntries());
break;
default:
//no extra fields for OF_13
break;
}//End of switch case
jGen.writeEndObject();
}//End of for loop
jGen.writeEndArray();
}
示例6: serializeTableReply
import org.projectfloodlight.openflow.protocol.OFTableStatsReply; //导入依赖的package包/类
/***
* Serializes Table Statistics
* @author Naveen
* @param tableReplies
* @param jGen
* @throws IOException
* @throws JsonProcessingException
*/
public static void serializeTableReply(List<OFTableStatsReply> tableReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
OFTableStatsReply tableReply = tableReplies.get(0); // we will get only one tableReply and it will contains many OFTableStatsEntry ?
jGen.writeStringField("version", tableReply.getVersion().toString()); //return the enum name
jGen.writeFieldName("table");
jGen.writeStartArray();
for(OFTableStatsEntry entry : tableReply.getEntries()) {
jGen.writeStartObject();
//Fields common to all OF versions
//For OF 1.3, only these fields are applicable
jGen.writeStringField("tableId",entry.getTableId().toString());
jGen.writeNumberField("activeCount", entry.getActiveCount());
jGen.writeNumberField("lookUpCount", entry.getLookupCount().getValue());
jGen.writeNumberField("matchCount", entry.getMatchedCount().getValue());
//Fields Applicable only for specific Versions
switch (entry.getVersion()) {
case OF_12:
//Fields applicable only to OF 1.2
jGen.writeNumberField("writeSetFields", entry.getWriteSetfields().getValue());
jGen.writeNumberField("applySetFields", entry.getApplySetfields().getValue());
jGen.writeNumberField("metaDataMatch", entry.getMetadataMatch().getValue());
jGen.writeNumberField("metaDataWrite", entry.getMetadataWrite().getValue());
case OF_11:
//Fields applicable to OF 1.1 & 1.2
jGen.writeStringField("match", entry.getMatch().toString());
jGen.writeNumberField("instructions", entry.getInstructions());
jGen.writeNumberField("writeActions", entry.getWriteActions());
jGen.writeNumberField("applyActions", entry.getApplyActions());
jGen.writeNumberField("config", entry.getConfig());
case OF_10:
//Fields applicable to OF 1.0, 1.1 & 1.2
jGen.writeStringField("name",entry.getName());
jGen.writeNumberField("wildcards", entry.getWildcards());
jGen.writeNumberField("maxEntries", entry.getMaxEntries());
break;
default:
//no extra fields for OF_13
break;
}//End of switch case
jGen.writeEndObject();
}//End of for loop
jGen.writeEndArray();
}
示例7: handleMessage
import org.projectfloodlight.openflow.protocol.OFTableStatsReply; //导入依赖的package包/类
@Override
public void handleMessage(Dpid dpid, OFMessage msg) {
if (providerService == null) {
// We are shutting down, nothing to be done
return;
}
DeviceId deviceId = DeviceId.deviceId(Dpid.uri(dpid));
switch (msg.getType()) {
case FLOW_REMOVED:
OFFlowRemoved removed = (OFFlowRemoved) msg;
FlowEntry fr = new FlowEntryBuilder(deviceId, removed, getDriver(deviceId)).build();
providerService.flowRemoved(fr);
break;
case STATS_REPLY:
if (((OFStatsReply) msg).getStatsType() == OFStatsType.FLOW) {
pushFlowMetrics(dpid, (OFFlowStatsReply) msg, getDriver(deviceId));
} else if (((OFStatsReply) msg).getStatsType() == OFStatsType.TABLE) {
pushTableStatistics(dpid, (OFTableStatsReply) msg);
} else if (((OFStatsReply) msg).getStatsType() == OFStatsType.FLOW_LIGHTWEIGHT) {
pushFlowLightWeightMetrics(dpid, (OFFlowLightweightStatsReply) msg);
}
break;
case BARRIER_REPLY:
try {
InternalCacheEntry entry = pendingBatches.getIfPresent(msg.getXid());
if (entry != null) {
providerService
.batchOperationCompleted(msg.getXid(),
entry.completed());
} else {
log.warn("Received unknown Barrier Reply: {}",
msg.getXid());
}
} finally {
pendingBatches.invalidate(msg.getXid());
}
break;
case ERROR:
// TODO: This needs to get suppressed in a better way.
if (msg instanceof OFBadRequestErrorMsg &&
((OFBadRequestErrorMsg) msg).getCode() == OFBadRequestCode.BAD_TYPE) {
log.debug("Received error message {} from {}", msg, dpid);
} else {
log.warn("Received error message {} from {}", msg, dpid);
}
handleErrorMsg(deviceId, msg);
break;
default:
log.debug("Unhandled message type: {}", msg.getType());
}
}
示例8: tableStatsProcess
import org.projectfloodlight.openflow.protocol.OFTableStatsReply; //导入依赖的package包/类
/**
* Notify that the table statistics event is arrived.
* @param dpid the switch where the event occured.
* @param reply the table statistics.
*/
void tableStatsProcess(Dpid dpid, OFTableStatsReply reply);