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


Java OFBucketCounter类代码示例

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


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

示例1: serialize

import org.projectfloodlight.openflow.protocol.OFBucketCounter; //导入依赖的package包/类
@Override
public void serialize(OFGroupStatsEntryMod groupStatsEntryMod, JsonGenerator jGen,
        SerializerProvider sp) throws IOException,
        JsonGenerationException {
    OFGroupStatsEntry groupStatsModEntry = groupStatsEntryMod.getGroupStatsEntry();
    List<OFBucketCounter> bucketCounters = groupStatsModEntry.getBucketStats();
    jGen.writeStartObject();
    jGen.writeNumberField("groupId", groupStatsModEntry.getGroup().getGroupNumber());
    jGen.writeNumberField("packetCount", groupStatsModEntry.getPacketCount().getValue());
    jGen.writeNumberField("byteCount", groupStatsModEntry.getByteCount().getValue());
    jGen.writeNumberField("durationNsec", groupStatsModEntry.getDurationNsec());
    jGen.writeNumberField("durationSec", groupStatsModEntry.getDurationSec());
    jGen.writeArrayFieldStart("bucketStats");
    for (OFBucketCounter bucketCouter : bucketCounters){
        jGen.writeStartObject();
        jGen.writeNumberField("pktCount", bucketCouter.getPacketCount().getValue());
        jGen.writeNumberField("byteCount", bucketCouter.getByteCount().getValue());
        jGen.writeEndObject();
    }
    jGen.writeEndArray();
    jGen.writeEndObject();
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:23,代码来源:OFGroupStatsEntryModSerializer.java

示例2: ofGroupStatsEntry

import org.projectfloodlight.openflow.protocol.OFBucketCounter; //导入依赖的package包/类
private OFGroupStatsEntry ofGroupStatsEntry(Group group) {
    List<OFBucketCounter> ofBucketCounters = Lists.newArrayList();
    group.buckets().buckets().forEach(groupBucket -> {
        ofBucketCounters.add(FACTORY.bucketCounter(
                U64.of(groupBucket.packets()), U64.of(groupBucket.bytes())));
    });
    OFGroupStatsEntry entry = FACTORY.buildGroupStatsEntry()
            .setGroup(OFGroup.of(group.id().id()))
            .setDurationSec(group.life())
            .setPacketCount(U64.of(group.packets()))
            .setByteCount(U64.of(group.bytes()))
            .setRefCount(group.referenceCount())
            .setBucketStats(ofBucketCounters)
            .build();
    return entry;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:17,代码来源:DefaultOFSwitch.java

示例3: serializeGroupReply

import org.projectfloodlight.openflow.protocol.OFBucketCounter; //导入依赖的package包/类
/***
 * Serializes the Group Statistics Reply
 * @author Naveen
 * @param groupReplies
 * @param jGen
 * @throws IOException
 * @throws JsonProcessingException
 */
public static void serializeGroupReply(List<OFGroupStatsReply> groupReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{

	OFGroupStatsReply groupReply = groupReplies.get(0); // we will get only one GroupReply and it will contains many OFGroupStatsEntry
	jGen.writeStringField("version", groupReply.getVersion().toString()); //return the enum name
	jGen.writeFieldName("group");
	jGen.writeStartArray();
	for(OFGroupStatsEntry entry : groupReply.getEntries()) {
		jGen.writeStartObject();
		jGen.writeStringField("groupNumber",entry.getGroup().toString());               
		jGen.writeNumberField("refCount", entry.getRefCount());
		jGen.writeNumberField("packetCount", entry.getPacketCount().getValue());
		jGen.writeNumberField("byteCount", entry.getByteCount().getValue());                        
		jGen.writeFieldName("bucketCounters");
		jGen.writeStartArray();            
		for(OFBucketCounter bCounter : entry.getBucketStats()) {
			jGen.writeStartObject();
			jGen.writeNumberField("packetCount", bCounter.getPacketCount().getValue());
			jGen.writeNumberField("byteCount", bCounter.getByteCount().getValue());
			jGen.writeEndObject();
		}//end of for loop - BucketCounter
		jGen.writeEndArray();
		if (OFVersion.OF_13 == entry.getVersion()) {
			jGen.writeNumberField("durationSec", entry.getDurationSec());
			jGen.writeNumberField("durationNsec", entry.getDurationNsec());
		}
		jGen.writeEndObject();
	}//end of for loop - groupStats
	jGen.writeEndArray();
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:38,代码来源:StatsReplySerializer.java

示例4: serializeGroupReply

import org.projectfloodlight.openflow.protocol.OFBucketCounter; //导入依赖的package包/类
/***
 * Serializes the Group Statistics Reply
 * @author Naveen
 * @param groupReplies
 * @param jGen
 * @throws IOException
 * @throws JsonProcessingException
 */
public static void serializeGroupReply(List<OFGroupStatsReply> groupReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{

	OFGroupStatsReply groupReply = groupReplies.get(0); // we will get only one GroupReply and it will contains many OFGroupStatsEntry
	jGen.writeStringField("version", groupReply.getVersion().toString()); //return the enum name
	jGen.writeFieldName("group");
	jGen.writeStartArray();
	for(OFGroupStatsEntry entry : groupReply.getEntries()) {
		jGen.writeStartObject();
		jGen.writeStringField("groupNumber",entry.getGroup().toString());
		jGen.writeNumberField("refCount", entry.getRefCount());
		jGen.writeNumberField("packetCount", entry.getPacketCount().getValue());
		jGen.writeNumberField("byteCount", entry.getByteCount().getValue());
		jGen.writeFieldName("bucketCounters");
		jGen.writeStartArray();
		for(OFBucketCounter bCounter : entry.getBucketStats()) {
			jGen.writeStartObject();
			jGen.writeNumberField("packetCount", bCounter.getPacketCount().getValue());
			jGen.writeNumberField("byteCount", bCounter.getByteCount().getValue());
			jGen.writeEndObject();
		}//end of for loop - BucketCounter
		jGen.writeEndArray();
		if (OFVersion.OF_13 == entry.getVersion()) {
			jGen.writeNumberField("durationSec", entry.getDurationSec());
			jGen.writeNumberField("durationNsec", entry.getDurationNsec());
		}
		jGen.writeEndObject();
	}//end of for loop - groupStats
	jGen.writeEndArray();
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:38,代码来源:StatsReplySerializer.java


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