Java 类org.projectfloodlight.openflow.protocol.OFBucketCounter 实例源码

项目:spring-open    文件:OFGroupStatsEntryModSerializer.java   
@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();
}
项目:onos    文件:DefaultOFSwitch.java   
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;
}
项目:fresco_floodlight    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:iTAP-controller    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:SDN-Multicast    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:arscheduler    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:floodlight1.2-delay    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:floodlight-hardware    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:ACAMPController    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:fast-failover-demo    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:floodlightLB    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:DSC    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:floodlight    文件:StatsReplySerializer.java   
/***
 * 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();
}