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

项目:athena    文件:OpenFlowControllerImpl.java   
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;
}
项目:athena    文件:FeatureCollectorProvider.java   
@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);
        }
项目:onos    文件:OpenFlowControllerImpl.java   
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;
}
项目:onos    文件:DefaultOFSwitch.java   
private OFTableStatsEntry ofFlowTableStatsEntry(TableStatisticsEntry tableStatisticsEntry) {
    OFTableStatsEntry ofTableStatsEntry = FACTORY.buildTableStatsEntry()
            .setTableId(TableId.of(tableStatisticsEntry.tableId()))
            .setActiveCount(tableStatisticsEntry.activeFlowEntries())
            .setLookupCount(U64.of(tableStatisticsEntry.packetsLookedup()))
            .setMatchedCount(U64.of(tableStatisticsEntry.packetsLookedup()))
            .build();
    return ofTableStatsEntry;
}
项目:fresco_floodlight    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:fresco_floodlight    文件:TableStatistics.java   
public static TableStatistics of(OFTableStatsEntry entry) {
    return new TableStatistics(entry.getTableId(),
            entry.getActiveCount(), entry.getLookupCount(), entry.getMatchedCount());
}
项目:iTAP-controller    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:iTAP-controller    文件:TableStatistics.java   
public static TableStatistics of(OFTableStatsEntry entry) {
    return new TableStatistics(entry.getTableId(),
            entry.getActiveCount(), entry.getLookupCount(), entry.getMatchedCount());
}
项目:SDN-Multicast    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:SDN-Multicast    文件:TableStatistics.java   
public static TableStatistics of(OFTableStatsEntry entry) {
    return new TableStatistics(entry.getTableId(),
            entry.getActiveCount(), entry.getLookupCount(), entry.getMatchedCount());
}
项目:arscheduler    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:arscheduler    文件:TableStatistics.java   
public static TableStatistics of(OFTableStatsEntry entry) {
    return new TableStatistics(entry.getTableId(),
            entry.getActiveCount(), entry.getLookupCount(), entry.getMatchedCount());
}
项目:floodlight1.2-delay    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:floodlight1.2-delay    文件:TableStatistics.java   
public static TableStatistics of(OFTableStatsEntry entry) {
    return new TableStatistics(entry.getTableId(),
            entry.getActiveCount(), entry.getLookupCount(), entry.getMatchedCount());
}
项目:floodlight-hardware    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:floodlight-hardware    文件:TableStatistics.java   
public static TableStatistics of(OFTableStatsEntry entry) {
    return new TableStatistics(entry.getTableId(),
            entry.getActiveCount(), entry.getLookupCount(), entry.getMatchedCount());
}
项目:ACAMPController    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:ACAMPController    文件:TableStatistics.java   
public static TableStatistics of(OFTableStatsEntry entry) {
    return new TableStatistics(entry.getTableId(),
            entry.getActiveCount(), entry.getLookupCount(), entry.getMatchedCount());
}
项目:fast-failover-demo    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:fast-failover-demo    文件:TableStatistics.java   
public static TableStatistics of(OFTableStatsEntry entry) {
    return new TableStatistics(entry.getTableId(),
            entry.getActiveCount(), entry.getLookupCount(), entry.getMatchedCount());
}
项目:floodlightLB    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:floodlightLB    文件:TableStatistics.java   
public static TableStatistics of(OFTableStatsEntry entry) {
    return new TableStatistics(entry.getTableId(),
            entry.getActiveCount(), entry.getLookupCount(), entry.getMatchedCount());
}
项目:DSC    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:DSC    文件:TableStatistics.java   
public static TableStatistics of(OFTableStatsEntry entry) {
    return new TableStatistics(entry.getTableId(),
            entry.getActiveCount(), entry.getLookupCount(), entry.getMatchedCount());
}
项目:floodlight    文件:StatsReplySerializer.java   
/***
 * 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();
}
项目:floodlight    文件:TableStatistics.java   
public static TableStatistics of(OFTableStatsEntry entry) {
    return new TableStatistics(entry.getTableId(),
            entry.getActiveCount(), entry.getLookupCount(), entry.getMatchedCount());
}