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


Java OFTableStatsReply.getEntries方法代码示例

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


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

示例1: 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);
        }
 
开发者ID:shlee89,项目名称:athena,代码行数:36,代码来源:FeatureCollectorProvider.java

示例2: 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();
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:54,代码来源:StatsReplySerializer.java

示例3: 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();
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:54,代码来源:StatsReplySerializer.java


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