Java 类org.projectfloodlight.openflow.protocol.meterband.OFMeterBandDrop 实例源码

项目:athena    文件:MeterModBuilder.java   
private List<OFMeterBand> buildBands() {
    return bands.stream().map(b -> {
        switch (b.type()) {
            case DROP:
                OFMeterBandDrop.Builder dropBuilder =
                        factory.meterBands().buildDrop();
                if (burst) {
                    dropBuilder.setBurstSize(b.burst());
                }
                dropBuilder.setRate(b.rate());
                return dropBuilder.build();
            case REMARK:
                OFMeterBandDscpRemark.Builder remarkBand =
                        factory.meterBands().buildDscpRemark();
                if (burst) {
                    remarkBand.setBurstSize(b.burst());
                }
                remarkBand.setRate(b.rate());
                remarkBand.setPrecLevel(b.dropPrecedence());
                return remarkBand.build();
            default:
                log.warn("Unknown band type {}", b.type());
                return null;
        }
    }).filter(Objects::nonNull).collect(Collectors.toList());
}
项目:onos    文件:MeterModBuilder.java   
private List<OFMeterBand> buildBands() {
    return bands.stream().map(b -> {
        switch (b.type()) {
            case DROP:
                OFMeterBandDrop.Builder dropBuilder =
                        factory.meterBands().buildDrop();
                if (burst) {
                    dropBuilder.setBurstSize(b.burst());
                }
                dropBuilder.setRate(b.rate());
                return dropBuilder.build();
            case REMARK:
                OFMeterBandDscpRemark.Builder remarkBand =
                        factory.meterBands().buildDscpRemark();
                if (burst) {
                    remarkBand.setBurstSize(b.burst());
                }
                remarkBand.setRate(b.rate());
                remarkBand.setPrecLevel(b.dropPrecedence());
                return remarkBand.build();
            default:
                log.warn("Unknown band type {}", b.type());
                return null;
        }
    }).filter(Objects::nonNull).collect(Collectors.toList());
}
项目:onos    文件:DefaultOFSwitch.java   
private Band band(OFMeterBand ofMeterBand) {
    DefaultBand.Builder builder = DefaultBand.builder();
    if (ofMeterBand instanceof OFMeterBandDrop) {
        OFMeterBandDrop ofMeterBandDrop = (OFMeterBandDrop) ofMeterBand;
        builder.ofType(Band.Type.DROP)
                .burstSize(ofMeterBandDrop.getBurstSize())
                .withRate(ofMeterBandDrop.getRate());
    } else if (ofMeterBand instanceof OFMeterBandDscpRemark) {
        OFMeterBandDscpRemark ofMeterBandDscpRemark = (OFMeterBandDscpRemark) ofMeterBand;
        builder.ofType(Band.Type.REMARK)
                .burstSize(ofMeterBandDscpRemark.getBurstSize())
                .withRate(ofMeterBandDscpRemark.getRate())
                .dropPrecedence(ofMeterBandDscpRemark.getPrecLevel());
    } else  if (ofMeterBand instanceof OFMeterBandExperimenter) {
        OFMeterBandExperimenter ofMeterBandExperimenter = (OFMeterBandExperimenter) ofMeterBand;
        builder.ofType(Band.Type.EXPERIMENTAL)
                .burstSize(ofMeterBandExperimenter.getBurstSize())
                .withRate(ofMeterBandExperimenter.getRate());
    }
    return builder.build();
}
项目:open-kilda    文件:SwitchManager.java   
private ImmutablePair<Long, Boolean> installMeter(final IOFSwitch sw, final DatapathId dpid, final long bandwidth,
                                                 final long burstSize, final long meterId) {
    logger.debug("installing meter {} on switch {} width bandwidth {}", meterId, dpid, bandwidth);

    Set<OFMeterFlags> flags = new HashSet<>(Arrays.asList(OFMeterFlags.KBPS, OFMeterFlags.BURST));
    OFFactory ofFactory = sw.getOFFactory();

    OFMeterBandDrop.Builder bandBuilder = ofFactory.meterBands()
            .buildDrop()
            .setRate(bandwidth)
            .setBurstSize(burstSize);

    OFMeterMod.Builder meterModBuilder = ofFactory.buildMeterMod()
            .setMeterId(meterId)
            .setCommand(OFMeterModCommand.ADD)
            .setFlags(flags);

    if (sw.getOFFactory().getVersion().compareTo(OF_13) > 0) {
        meterModBuilder.setBands(singletonList(bandBuilder.build()));
    } else {
        meterModBuilder.setMeters(singletonList(bandBuilder.build()));
    }

    OFMeterMod meterMod = meterModBuilder.build();

    boolean response = sw.write(meterMod);
    return new ImmutablePair<>(meterMod.getXid(), response);
}
项目:fresco_floodlight    文件:StatsReplySerializer.java   
/***
 * Serializes Meter Config Reply
 * @author Naveen 
 * @param meterConfigReplies
 * @param jGen
 * @throws IOException
 * @throws JsonProcessingException
 */
public static void serializeMeterConfigReply(List<OFMeterConfigStatsReply> meterConfigReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFMeterConfigStatsReply meterConfigReply = meterConfigReplies.get(0);
    jGen.writeStringField("version", meterConfigReply.getVersion().toString()); //return the enum name
    jGen.writeFieldName("meterConfig");
    jGen.writeStartArray();
    for (OFMeterConfig config : meterConfigReply.getEntries()) {
        jGen.writeStartObject();
        jGen.writeNumberField("meterId", config.getMeterId());
        jGen.writeNumberField("flags", config.getFlags());
        jGen.writeFieldName("meterBands");
        jGen.writeStartArray();
        for (OFMeterBand band : config.getEntries()) {
            jGen.writeStartObject();
            short type = (short)band.getType();
            jGen.writeNumberField("bandType",type);

            switch (type) {
            case OFMeterBandTypeSerializerVer13.DROP_VAL:
                OFMeterBandDrop bandDrop = (OFMeterBandDrop) band;
                jGen.writeNumberField("rate", bandDrop.getRate());
                jGen.writeNumberField("burstSize", bandDrop.getBurstSize());
                break;

            case OFMeterBandTypeSerializerVer13.DSCP_REMARK_VAL:
                OFMeterBandDscpRemark bandDscp = (OFMeterBandDscpRemark) band;
                jGen.writeNumberField("rate", bandDscp.getRate());
                jGen.writeNumberField("burstSize", bandDscp.getBurstSize());
                jGen.writeNumberField("precLevel", bandDscp.getPrecLevel());
                break;

            case OFMeterBandTypeSerializerVer13.EXPERIMENTER_VAL:
                OFMeterBandExperimenter bandExp = (OFMeterBandExperimenter) band;
                jGen.writeNumberField("rate", bandExp.getRate());
                jGen.writeNumberField("burstSize", bandExp.getBurstSize());
                jGen.writeNumberField("experimenter", bandExp.getExperimenter());
                break;

            default:
                // shouldn't ever get here
                break;                  
            }//end of Switch Case

            jGen.writeEndObject();
        }//end of for loop
        jGen.writeEndArray();
        jGen.writeEndObject();
    }//end of for loop
    jGen.writeEndArray();
}
项目:iTAP-controller    文件:StatsReplySerializer.java   
/***
 * Serializes Meter Config Reply
 * @author Naveen 
 * @param meterConfigReplies
 * @param jGen
 * @throws IOException
 * @throws JsonProcessingException
 */
public static void serializeMeterConfigReply(List<OFMeterConfigStatsReply> meterConfigReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFMeterConfigStatsReply meterConfigReply = meterConfigReplies.get(0);
    jGen.writeStringField("version", meterConfigReply.getVersion().toString()); //return the enum name
    jGen.writeFieldName("meterConfig");
    jGen.writeStartArray();
    for(OFMeterBand band : meterConfigReply.getEntries()) {
        jGen.writeStartObject();
        short type = (short)band.getType();
        jGen.writeNumberField("bandType",type);

        switch (type) {
        case OFMeterBandTypeSerializerVer13.DROP_VAL:
            OFMeterBandDrop bandDrop = (OFMeterBandDrop) band;
            jGen.writeNumberField("rate", bandDrop.getRate());
            jGen.writeNumberField("burstSize", bandDrop.getBurstSize());
            break;

        case OFMeterBandTypeSerializerVer13.DSCP_REMARK_VAL:
            OFMeterBandDscpRemark bandDscp = (OFMeterBandDscpRemark) band;
            jGen.writeNumberField("rate", bandDscp.getRate());
            jGen.writeNumberField("burstSize", bandDscp.getBurstSize());
            jGen.writeNumberField("precLevel", bandDscp.getPrecLevel());
            break;

        case OFMeterBandTypeSerializerVer13.EXPERIMENTER_VAL:
            OFMeterBandExperimenter bandExp = (OFMeterBandExperimenter) band;
            jGen.writeNumberField("rate", bandExp.getRate());
            jGen.writeNumberField("burstSize", bandExp.getBurstSize());
            jGen.writeNumberField("experimenter", bandExp.getExperimenter());
            break;

        default:
            // shouldn't ever get here
            break;                  
        }//end of Switch Case

        jGen.writeEndObject();
    }//end of for loop
    jGen.writeEndArray();
}
项目:SDN-Multicast    文件:StatsReplySerializer.java   
/***
 * Serializes Meter Config Reply
 * @author Naveen 
 * @param meterConfigReplies
 * @param jGen
 * @throws IOException
 * @throws JsonProcessingException
 */
public static void serializeMeterConfigReply(List<OFMeterConfigStatsReply> meterConfigReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFMeterConfigStatsReply meterConfigReply = meterConfigReplies.get(0);
    jGen.writeStringField("version", meterConfigReply.getVersion().toString()); //return the enum name
    jGen.writeFieldName("meterConfig");
    jGen.writeStartArray();
    for (OFMeterConfig config : meterConfigReply.getEntries()) {
        jGen.writeStartObject();
        jGen.writeNumberField("meterId", config.getMeterId());
        jGen.writeNumberField("flags", config.getFlags());
        jGen.writeFieldName("meterBands");
        jGen.writeStartArray();
        for (OFMeterBand band : config.getEntries()) {
            jGen.writeStartObject();
            short type = (short)band.getType();
            jGen.writeNumberField("bandType",type);

            switch (type) {
            case OFMeterBandTypeSerializerVer13.DROP_VAL:
                OFMeterBandDrop bandDrop = (OFMeterBandDrop) band;
                jGen.writeNumberField("rate", bandDrop.getRate());
                jGen.writeNumberField("burstSize", bandDrop.getBurstSize());
                break;

            case OFMeterBandTypeSerializerVer13.DSCP_REMARK_VAL:
                OFMeterBandDscpRemark bandDscp = (OFMeterBandDscpRemark) band;
                jGen.writeNumberField("rate", bandDscp.getRate());
                jGen.writeNumberField("burstSize", bandDscp.getBurstSize());
                jGen.writeNumberField("precLevel", bandDscp.getPrecLevel());
                break;

            case OFMeterBandTypeSerializerVer13.EXPERIMENTER_VAL:
                OFMeterBandExperimenter bandExp = (OFMeterBandExperimenter) band;
                jGen.writeNumberField("rate", bandExp.getRate());
                jGen.writeNumberField("burstSize", bandExp.getBurstSize());
                jGen.writeNumberField("experimenter", bandExp.getExperimenter());
                break;

            default:
                // shouldn't ever get here
                break;                  
            }//end of Switch Case

            jGen.writeEndObject();
        }//end of for loop
        jGen.writeEndArray();
        jGen.writeEndObject();
    }//end of for loop
    jGen.writeEndArray();
}
项目:arscheduler    文件:StatsReplySerializer.java   
/***
 * Serializes Meter Config Reply
 * @author Naveen 
 * @param meterConfigReplies
 * @param jGen
 * @throws IOException
 * @throws JsonProcessingException
 */
public static void serializeMeterConfigReply(List<OFMeterConfigStatsReply> meterConfigReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFMeterConfigStatsReply meterConfigReply = meterConfigReplies.get(0);
    jGen.writeStringField("version", meterConfigReply.getVersion().toString()); //return the enum name
    jGen.writeFieldName("meterConfig");
    jGen.writeStartArray();
    for (OFMeterConfig config : meterConfigReply.getEntries()) {
        jGen.writeStartObject();
        jGen.writeNumberField("meterId", config.getMeterId());
        jGen.writeNumberField("flags", config.getFlags());
        jGen.writeFieldName("meterBands");
        jGen.writeStartArray();
        for (OFMeterBand band : config.getEntries()) {
            jGen.writeStartObject();
            short type = (short)band.getType();
            jGen.writeNumberField("bandType",type);

            switch (type) {
            case OFMeterBandTypeSerializerVer13.DROP_VAL:
                OFMeterBandDrop bandDrop = (OFMeterBandDrop) band;
                jGen.writeNumberField("rate", bandDrop.getRate());
                jGen.writeNumberField("burstSize", bandDrop.getBurstSize());
                break;

            case OFMeterBandTypeSerializerVer13.DSCP_REMARK_VAL:
                OFMeterBandDscpRemark bandDscp = (OFMeterBandDscpRemark) band;
                jGen.writeNumberField("rate", bandDscp.getRate());
                jGen.writeNumberField("burstSize", bandDscp.getBurstSize());
                jGen.writeNumberField("precLevel", bandDscp.getPrecLevel());
                break;

            case OFMeterBandTypeSerializerVer13.EXPERIMENTER_VAL:
                OFMeterBandExperimenter bandExp = (OFMeterBandExperimenter) band;
                jGen.writeNumberField("rate", bandExp.getRate());
                jGen.writeNumberField("burstSize", bandExp.getBurstSize());
                jGen.writeNumberField("experimenter", bandExp.getExperimenter());
                break;

            default:
                // shouldn't ever get here
                break;                  
            }//end of Switch Case

            jGen.writeEndObject();
        }//end of for loop
        jGen.writeEndArray();
        jGen.writeEndObject();
    }//end of for loop
    jGen.writeEndArray();
}
项目:floodlight1.2-delay    文件:StatsReplySerializer.java   
/***
 * Serializes Meter Config Reply
 * @author Naveen 
 * @param meterConfigReplies
 * @param jGen
 * @throws IOException
 * @throws JsonProcessingException
 */
public static void serializeMeterConfigReply(List<OFMeterConfigStatsReply> meterConfigReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFMeterConfigStatsReply meterConfigReply = meterConfigReplies.get(0);
    jGen.writeStringField("version", meterConfigReply.getVersion().toString()); //return the enum name
    jGen.writeFieldName("meterConfig");
    jGen.writeStartArray();
    for (OFMeterConfig config : meterConfigReply.getEntries()) {
        jGen.writeStartObject();
        jGen.writeNumberField("meterId", config.getMeterId());
        jGen.writeNumberField("flags", config.getFlags());
        jGen.writeFieldName("meterBands");
        jGen.writeStartArray();
        for (OFMeterBand band : config.getEntries()) {
            jGen.writeStartObject();
            short type = (short)band.getType();
            jGen.writeNumberField("bandType",type);

            switch (type) {
            case OFMeterBandTypeSerializerVer13.DROP_VAL:
                OFMeterBandDrop bandDrop = (OFMeterBandDrop) band;
                jGen.writeNumberField("rate", bandDrop.getRate());
                jGen.writeNumberField("burstSize", bandDrop.getBurstSize());
                break;

            case OFMeterBandTypeSerializerVer13.DSCP_REMARK_VAL:
                OFMeterBandDscpRemark bandDscp = (OFMeterBandDscpRemark) band;
                jGen.writeNumberField("rate", bandDscp.getRate());
                jGen.writeNumberField("burstSize", bandDscp.getBurstSize());
                jGen.writeNumberField("precLevel", bandDscp.getPrecLevel());
                break;

            case OFMeterBandTypeSerializerVer13.EXPERIMENTER_VAL:
                OFMeterBandExperimenter bandExp = (OFMeterBandExperimenter) band;
                jGen.writeNumberField("rate", bandExp.getRate());
                jGen.writeNumberField("burstSize", bandExp.getBurstSize());
                jGen.writeNumberField("experimenter", bandExp.getExperimenter());
                break;

            default:
                // shouldn't ever get here
                break;                  
            }//end of Switch Case

            jGen.writeEndObject();
        }//end of for loop
        jGen.writeEndArray();
        jGen.writeEndObject();
    }//end of for loop
    jGen.writeEndArray();
}
项目:floodlight-hardware    文件:StatsReplySerializer.java   
/***
 * Serializes Meter Config Reply
 * @author Naveen
 * @param meterConfigReplies
 * @param jGen
 * @throws IOException
 * @throws JsonProcessingException
 */
public static void serializeMeterConfigReply(List<OFMeterConfigStatsReply> meterConfigReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFMeterConfigStatsReply meterConfigReply = meterConfigReplies.get(0);
    jGen.writeStringField("version", meterConfigReply.getVersion().toString()); //return the enum name
    jGen.writeFieldName("meterConfig");
    jGen.writeStartArray();
    for (OFMeterConfig config : meterConfigReply.getEntries()) {
        jGen.writeStartObject();
        jGen.writeNumberField("meterId", config.getMeterId());
        jGen.writeNumberField("flags", config.getFlags());
        jGen.writeFieldName("meterBands");
        jGen.writeStartArray();
        for (OFMeterBand band : config.getEntries()) {
            jGen.writeStartObject();
            short type = (short)band.getType();
            jGen.writeNumberField("bandType",type);

            switch (type) {
            case OFMeterBandTypeSerializerVer13.DROP_VAL:
                OFMeterBandDrop bandDrop = (OFMeterBandDrop) band;
                jGen.writeNumberField("rate", bandDrop.getRate());
                jGen.writeNumberField("burstSize", bandDrop.getBurstSize());
                break;

            case OFMeterBandTypeSerializerVer13.DSCP_REMARK_VAL:
                OFMeterBandDscpRemark bandDscp = (OFMeterBandDscpRemark) band;
                jGen.writeNumberField("rate", bandDscp.getRate());
                jGen.writeNumberField("burstSize", bandDscp.getBurstSize());
                jGen.writeNumberField("precLevel", bandDscp.getPrecLevel());
                break;

            case OFMeterBandTypeSerializerVer13.EXPERIMENTER_VAL:
                OFMeterBandExperimenter bandExp = (OFMeterBandExperimenter) band;
                jGen.writeNumberField("rate", bandExp.getRate());
                jGen.writeNumberField("burstSize", bandExp.getBurstSize());
                jGen.writeNumberField("experimenter", bandExp.getExperimenter());
                break;

            default:
                // shouldn't ever get here
                break;
            }//end of Switch Case

            jGen.writeEndObject();
        }//end of for loop
        jGen.writeEndArray();
        jGen.writeEndObject();
    }//end of for loop
    jGen.writeEndArray();
}
项目:ACAMPController    文件:StatsReplySerializer.java   
/***
 * Serializes Meter Config Reply
 * @author Naveen 
 * @param meterConfigReplies
 * @param jGen
 * @throws IOException
 * @throws JsonProcessingException
 */
public static void serializeMeterConfigReply(List<OFMeterConfigStatsReply> meterConfigReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFMeterConfigStatsReply meterConfigReply = meterConfigReplies.get(0);
    jGen.writeStringField("version", meterConfigReply.getVersion().toString()); //return the enum name
    jGen.writeFieldName("meterConfig");
    jGen.writeStartArray();
    for (OFMeterConfig config : meterConfigReply.getEntries()) {
        jGen.writeStartObject();
        jGen.writeNumberField("meterId", config.getMeterId());
        jGen.writeNumberField("flags", config.getFlags());
        jGen.writeFieldName("meterBands");
        jGen.writeStartArray();
        for (OFMeterBand band : config.getEntries()) {
            jGen.writeStartObject();
            short type = (short)band.getType();
            jGen.writeNumberField("bandType",type);

            switch (type) {
            case OFMeterBandTypeSerializerVer13.DROP_VAL:
                OFMeterBandDrop bandDrop = (OFMeterBandDrop) band;
                jGen.writeNumberField("rate", bandDrop.getRate());
                jGen.writeNumberField("burstSize", bandDrop.getBurstSize());
                break;

            case OFMeterBandTypeSerializerVer13.DSCP_REMARK_VAL:
                OFMeterBandDscpRemark bandDscp = (OFMeterBandDscpRemark) band;
                jGen.writeNumberField("rate", bandDscp.getRate());
                jGen.writeNumberField("burstSize", bandDscp.getBurstSize());
                jGen.writeNumberField("precLevel", bandDscp.getPrecLevel());
                break;

            case OFMeterBandTypeSerializerVer13.EXPERIMENTER_VAL:
                OFMeterBandExperimenter bandExp = (OFMeterBandExperimenter) band;
                jGen.writeNumberField("rate", bandExp.getRate());
                jGen.writeNumberField("burstSize", bandExp.getBurstSize());
                jGen.writeNumberField("experimenter", bandExp.getExperimenter());
                break;

            default:
                // shouldn't ever get here
                break;                  
            }//end of Switch Case

            jGen.writeEndObject();
        }//end of for loop
        jGen.writeEndArray();
        jGen.writeEndObject();
    }//end of for loop
    jGen.writeEndArray();
}
项目:fast-failover-demo    文件:StatsReplySerializer.java   
/***
 * Serializes Meter Config Reply
 * @author Naveen 
 * @param meterConfigReplies
 * @param jGen
 * @throws IOException
 * @throws JsonProcessingException
 */
public static void serializeMeterConfigReply(List<OFMeterConfigStatsReply> meterConfigReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFMeterConfigStatsReply meterConfigReply = meterConfigReplies.get(0);
    jGen.writeStringField("version", meterConfigReply.getVersion().toString()); //return the enum name
    jGen.writeFieldName("meterConfig");
    jGen.writeStartArray();
    for(OFMeterBand band : meterConfigReply.getEntries()) {
        jGen.writeStartObject();
        short type = (short)band.getType();
        jGen.writeNumberField("bandType",type);

        switch (type) {
        case OFMeterBandTypeSerializerVer13.DROP_VAL:
            OFMeterBandDrop bandDrop = (OFMeterBandDrop) band;
            jGen.writeNumberField("rate", bandDrop.getRate());
            jGen.writeNumberField("burstSize", bandDrop.getBurstSize());
            break;

        case OFMeterBandTypeSerializerVer13.DSCP_REMARK_VAL:
            OFMeterBandDscpRemark bandDscp = (OFMeterBandDscpRemark) band;
            jGen.writeNumberField("rate", bandDscp.getRate());
            jGen.writeNumberField("burstSize", bandDscp.getBurstSize());
            jGen.writeNumberField("precLevel", bandDscp.getPrecLevel());
            break;

        case OFMeterBandTypeSerializerVer13.EXPERIMENTER_VAL:
            OFMeterBandExperimenter bandExp = (OFMeterBandExperimenter) band;
            jGen.writeNumberField("rate", bandExp.getRate());
            jGen.writeNumberField("burstSize", bandExp.getBurstSize());
            jGen.writeNumberField("experimenter", bandExp.getExperimenter());
            break;

        default:
            // shouldn't ever get here
            break;                  
        }//end of Switch Case

        jGen.writeEndObject();
    }//end of for loop
    jGen.writeEndArray();
}
项目:floodlightLB    文件:StatsReplySerializer.java   
/***
 * Serializes Meter Config Reply
 * @author Naveen 
 * @param meterConfigReplies
 * @param jGen
 * @throws IOException
 * @throws JsonProcessingException
 */
public static void serializeMeterConfigReply(List<OFMeterConfigStatsReply> meterConfigReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFMeterConfigStatsReply meterConfigReply = meterConfigReplies.get(0);
    jGen.writeStringField("version", meterConfigReply.getVersion().toString()); //return the enum name
    jGen.writeFieldName("meterConfig");
    jGen.writeStartArray();
    for(OFMeterBand band : meterConfigReply.getEntries()) {
        jGen.writeStartObject();
        short type = (short)band.getType();
        jGen.writeNumberField("bandType",type);

        switch (type) {
        case OFMeterBandTypeSerializerVer13.DROP_VAL:
            OFMeterBandDrop bandDrop = (OFMeterBandDrop) band;
            jGen.writeNumberField("rate", bandDrop.getRate());
            jGen.writeNumberField("burstSize", bandDrop.getBurstSize());
            break;

        case OFMeterBandTypeSerializerVer13.DSCP_REMARK_VAL:
            OFMeterBandDscpRemark bandDscp = (OFMeterBandDscpRemark) band;
            jGen.writeNumberField("rate", bandDscp.getRate());
            jGen.writeNumberField("burstSize", bandDscp.getBurstSize());
            jGen.writeNumberField("precLevel", bandDscp.getPrecLevel());
            break;

        case OFMeterBandTypeSerializerVer13.EXPERIMENTER_VAL:
            OFMeterBandExperimenter bandExp = (OFMeterBandExperimenter) band;
            jGen.writeNumberField("rate", bandExp.getRate());
            jGen.writeNumberField("burstSize", bandExp.getBurstSize());
            jGen.writeNumberField("experimenter", bandExp.getExperimenter());
            break;

        default:
            // shouldn't ever get here
            break;                  
        }//end of Switch Case

        jGen.writeEndObject();
    }//end of for loop
    jGen.writeEndArray();
}
项目:DSC    文件:StatsReplySerializer.java   
/***
 * Serializes Meter Config Reply
 * @author Naveen 
 * @param meterConfigReplies
 * @param jGen
 * @throws IOException
 * @throws JsonProcessingException
 */
public static void serializeMeterConfigReply(List<OFMeterConfigStatsReply> meterConfigReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFMeterConfigStatsReply meterConfigReply = meterConfigReplies.get(0);
    jGen.writeStringField("version", meterConfigReply.getVersion().toString()); //return the enum name
    jGen.writeFieldName("meterConfig");
    jGen.writeStartArray();
    for(OFMeterBand band : meterConfigReply.getEntries()) {
        jGen.writeStartObject();
        short type = (short)band.getType();
        jGen.writeNumberField("bandType",type);

        switch (type) {
        case OFMeterBandTypeSerializerVer13.DROP_VAL:
            OFMeterBandDrop bandDrop = (OFMeterBandDrop) band;
            jGen.writeNumberField("rate", bandDrop.getRate());
            jGen.writeNumberField("burstSize", bandDrop.getBurstSize());
            break;

        case OFMeterBandTypeSerializerVer13.DSCP_REMARK_VAL:
            OFMeterBandDscpRemark bandDscp = (OFMeterBandDscpRemark) band;
            jGen.writeNumberField("rate", bandDscp.getRate());
            jGen.writeNumberField("burstSize", bandDscp.getBurstSize());
            jGen.writeNumberField("precLevel", bandDscp.getPrecLevel());
            break;

        case OFMeterBandTypeSerializerVer13.EXPERIMENTER_VAL:
            OFMeterBandExperimenter bandExp = (OFMeterBandExperimenter) band;
            jGen.writeNumberField("rate", bandExp.getRate());
            jGen.writeNumberField("burstSize", bandExp.getBurstSize());
            jGen.writeNumberField("experimenter", bandExp.getExperimenter());
            break;

        default:
            // shouldn't ever get here
            break;                  
        }//end of Switch Case

        jGen.writeEndObject();
    }//end of for loop
    jGen.writeEndArray();
}
项目:floodlight    文件:StatsReplySerializer.java   
/***
 * Serializes Meter Config Reply
 * @author Naveen 
 * @param meterConfigReplies
 * @param jGen
 * @throws IOException
 * @throws JsonProcessingException
 */
public static void serializeMeterConfigReply(List<OFMeterConfigStatsReply> meterConfigReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
    OFMeterConfigStatsReply meterConfigReply = meterConfigReplies.get(0);
    jGen.writeStringField("version", meterConfigReply.getVersion().toString()); //return the enum name
    jGen.writeFieldName("meterConfig");
    jGen.writeStartArray();
    for(OFMeterBand band : meterConfigReply.getEntries()) {
        jGen.writeStartObject();
        short type = (short)band.getType();
        jGen.writeNumberField("bandType",type);

        switch (type) {
        case OFMeterBandTypeSerializerVer13.DROP_VAL:
            OFMeterBandDrop bandDrop = (OFMeterBandDrop) band;
            jGen.writeNumberField("rate", bandDrop.getRate());
            jGen.writeNumberField("burstSize", bandDrop.getBurstSize());
            break;

        case OFMeterBandTypeSerializerVer13.DSCP_REMARK_VAL:
            OFMeterBandDscpRemark bandDscp = (OFMeterBandDscpRemark) band;
            jGen.writeNumberField("rate", bandDscp.getRate());
            jGen.writeNumberField("burstSize", bandDscp.getBurstSize());
            jGen.writeNumberField("precLevel", bandDscp.getPrecLevel());
            break;

        case OFMeterBandTypeSerializerVer13.EXPERIMENTER_VAL:
            OFMeterBandExperimenter bandExp = (OFMeterBandExperimenter) band;
            jGen.writeNumberField("rate", bandExp.getRate());
            jGen.writeNumberField("burstSize", bandExp.getBurstSize());
            jGen.writeNumberField("experimenter", bandExp.getExperimenter());
            break;

        default:
            // shouldn't ever get here
            break;                  
        }//end of Switch Case

        jGen.writeEndObject();
    }//end of for loop
    jGen.writeEndArray();
}