当前位置: 首页>>代码示例>>Java>>正文


Java OFMeterConfigStatsReply类代码示例

本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFMeterConfigStatsReply的典型用法代码示例。如果您正苦于以下问题:Java OFMeterConfigStatsReply类的具体用法?Java OFMeterConfigStatsReply怎么用?Java OFMeterConfigStatsReply使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OFMeterConfigStatsReply类属于org.projectfloodlight.openflow.protocol包,在下文中一共展示了OFMeterConfigStatsReply类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dumpMeters

import org.projectfloodlight.openflow.protocol.OFMeterConfigStatsReply; //导入依赖的package包/类
/**
 * {@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;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:26,代码来源:SwitchManager.java

示例2: getMeters

import org.projectfloodlight.openflow.protocol.OFMeterConfigStatsReply; //导入依赖的package包/类
@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;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:28,代码来源:MetersResource.java

示例3: collectMeters

import org.projectfloodlight.openflow.protocol.OFMeterConfigStatsReply; //导入依赖的package包/类
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
}
 
开发者ID:shlee89,项目名称:athena,代码行数:6,代码来源:OpenFlowMeterProvider.java

示例4: serializeMeterConfigReply

import org.projectfloodlight.openflow.protocol.OFMeterConfigStatsReply; //导入依赖的package包/类
/***
 * 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();
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:58,代码来源:StatsReplySerializer.java

示例5: serializeMeterConfigReply

import org.projectfloodlight.openflow.protocol.OFMeterConfigStatsReply; //导入依赖的package包/类
/***
 * 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();
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:49,代码来源:StatsReplySerializer.java

示例6: serializeMeterConfigReply

import org.projectfloodlight.openflow.protocol.OFMeterConfigStatsReply; //导入依赖的package包/类
/***
 * 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();
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:58,代码来源:StatsReplySerializer.java

示例7: dumpMeters

import org.projectfloodlight.openflow.protocol.OFMeterConfigStatsReply; //导入依赖的package包/类
/**
 * Returns list of installed meters
 *
 * @param dpid switch id
 * @return OF meter config stats entries
 */
OFMeterConfigStatsReply dumpMeters(final DatapathId dpid);
 
开发者ID:telstra,项目名称:open-kilda,代码行数:8,代码来源:ISwitchManager.java


注:本文中的org.projectfloodlight.openflow.protocol.OFMeterConfigStatsReply类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。