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

项目:open-kilda    文件:SwitchManager.java   
/**
 * {@inheritDoc}
 */
@Override
public OFMeterConfigStatsReply dumpMeters(final DatapathId dpid) {
    OFMeterConfigStatsReply values = null;
    IOFSwitch sw = ofSwitchService.getSwitch(dpid);
    if (sw == null) {
        throw new IllegalArgumentException(String.format("Switch %s was not found", dpid.toString()));
    }

    OFFactory ofFactory = sw.getOFFactory();
    OFMeterConfigStatsRequest meterRequest = ofFactory.buildMeterConfigStatsRequest()
            .setMeterId(0xffffffff)
            .build();

    try {
        ListenableFuture<OFMeterConfigStatsReply> future = sw.writeRequest(meterRequest);
        values = future.get(5, TimeUnit.SECONDS);
    } catch (ExecutionException | InterruptedException | TimeoutException e) {
        logger.error("Could not get meter config stats: {}", e.getMessage());
    }

    return values;
}
项目:open-kilda    文件:MetersResource.java   
@Get("json")
@SuppressWarnings("unchecked")
public Map<Long, Object> getMeters() {
    Map<Long, Object> response = new HashMap<>();
    String switchId = (String) this.getRequestAttributes().get("switch_id");
    logger.debug("Get meters for switch: {}", switchId);
    ISwitchManager switchManager = (ISwitchManager) getContext().getAttributes()
            .get(ISwitchManager.class.getCanonicalName());

    try {
        OFMeterConfigStatsReply replay = switchManager.dumpMeters(DatapathId.of(switchId));
        logger.debug("Meters from switch {} received: {}", switchId, replay);

        if (replay != null) {
            for (OFMeterConfig entry : replay.getEntries()) {
                response.put(entry.getMeterId(), entry);
            }
        }
    } catch (IllegalArgumentException exception) {
        String messageString = "No such switch";
        logger.error("{}: {}", messageString, switchId, exception);
        MessageError responseMessage = new MessageError(DEFAULT_CORRELATION_ID, System.currentTimeMillis(),
                ErrorType.PARAMETERS_INVALID.toString(), messageString, exception.getMessage());
        response.putAll(MAPPER.convertValue(responseMessage, Map.class));
    }
    return response;
}
项目:athena    文件:OpenFlowMeterProvider.java   
private Map<Long, Meter> collectMeters(DeviceId deviceId,
                                       OFMeterConfigStatsReply reply) {
    return Maps.newHashMap();
    //TODO: Needs a fix to be applied to loxi MeterConfig stat is incorrect
}
项目: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();
}
项目:onos    文件:OpenFlowMeterProvider.java   
private Map<Long, Meter> collectMeters(DeviceId deviceId,
                                       OFMeterConfigStatsReply reply) {
    return Maps.newHashMap();
    //TODO: Needs a fix to be applied to loxi MeterConfig stat is incorrect
}
项目:open-kilda    文件:ISwitchManager.java   
/**
 * Returns list of installed meters
 *
 * @param dpid switch id
 * @return OF meter config stats entries
 */
OFMeterConfigStatsReply dumpMeters(final DatapathId dpid);