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

项目: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    文件:OpenFlowRuleProvider.java   
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);
        }
项目: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    文件:OpenFlowRuleProvider.java   
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);
        }
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目: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();
}
项目:onos    文件:OpenFlowRuleProvider.java   
@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());
    }
}
项目:athena    文件:OpenFlowStatisticsListener.java   
/**
 * 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);