當前位置: 首頁>>代碼示例>>Java>>正文


Java MeterId類代碼示例

本文整理匯總了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId的典型用法代碼示例。如果您正苦於以下問題:Java MeterId類的具體用法?Java MeterId怎麽用?Java MeterId使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MeterId類屬於org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918包,在下文中一共展示了MeterId類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createFlow

import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId; //導入依賴的package包/類
public FlowBuilder createFlow(final Dataflow dataFlow) throws DataflowCreationException {
    FlowBuilder flowBuilder = new FlowBuilder();
    try {
        final FlowModFlags flowModFlags = new FlowModFlags(false, false, false, false, false);
        final FlowId flowId = new FlowId(dataFlow.getId().toString());
        final FlowKey flowKey = new FlowKey(flowId);
        final MeterId meterId = new MeterId(dataFlow.getMeterId().longValue());

        flowBuilder.setFlowName("NIC_METER" + meterId.getValue());
        flowBuilder.setId(new FlowId(Long.toString(flowBuilder.hashCode())));
        flowBuilder.setMatch(createMatch(dataFlow.getSourceIpAddress()));
        flowBuilder.setInstructions(createInstruction(meterId));
        flowBuilder.setPriority(OFRendererConstants.DEFAULT_PRIORITY);
        flowBuilder.setCookie(new FlowCookie(BigInteger.valueOf(flowCookieInc.getAndIncrement())));
        flowBuilder.setBufferId(OFP_NO_BUFFER);
        flowBuilder.setHardTimeout((int) dataFlow.getTimeout());
        flowBuilder.setIdleTimeout((int) dataFlow.getTimeout());
        flowBuilder.setFlags(flowModFlags);
        flowBuilder.setKey(flowKey);
    } catch (Exception e) {
        throw new DataflowCreationException(e.getMessage());
    }

    return flowBuilder;
}
 
開發者ID:opendaylight,項目名稱:nic,代碼行數:26,代碼來源:OFRuleWithMeterManager.java

示例2: createInstruction

import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId; //導入依賴的package包/類
private Instructions createInstruction(final MeterId meterId) {
    MeterBuilder meterBuilder = new MeterBuilder();
    meterBuilder.setMeterId(meterId);

    Instruction instruction = new InstructionBuilder()
            .setOrder(0)
            .setInstruction(new MeterCaseBuilder()
                    .setMeter(meterBuilder.build()).build()).build();

    List<Instruction> instructions = new ArrayList<>();
    instructions.add(instruction);

    InstructionsBuilder instructionsBuilder = new InstructionsBuilder();
    instructionsBuilder.setInstruction(instructions);
    return instructionsBuilder.build();
}
 
開發者ID:opendaylight,項目名稱:nic,代碼行數:17,代碼來源:OFRuleWithMeterManager.java

示例3: createFlowData

import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId; //導入依賴的package包/類
public Dataflow createFlowData(final IntentLimiter intent, final MeterId meterId) throws IntentInvalidException {
    final Ipv4Prefix sourceIp = intent.getSourceIp();
    DataflowBuilder dataflowBuilder = new DataflowBuilder();
    dataflowBuilder.setCreationTime(String.valueOf(System.currentTimeMillis()));
    dataflowBuilder.setIsFlowMeter(true);
    dataflowBuilder.setId(intent.getId());
    dataflowBuilder.setTimeout(intent.getDuration());
    dataflowBuilder.setDataflowMeterBandType(org.opendaylight.yang.gen.v1.urn.opendaylight.nic.renderer.api.dataflow
            .rev170309.Dataflow.DataflowMeterBandType.OFMBTDROP);
    dataflowBuilder.setMeterFlags(Dataflow.MeterFlags.METERKBPS);
    dataflowBuilder.setSourceIpAddress(sourceIp);
    dataflowBuilder.setRendererAction(Dataflow.RendererAction.ADD);
    dataflowBuilder.setBandwidthRate(intent.getBandwidthLimit());
    dataflowBuilder.setFlowType(Dataflow.FlowType.L3);
    dataflowBuilder.setMeterId(meterId.getValue().shortValue());
    dataflowBuilder.setStatus(Dataflow.Status.PROCESSING);
    dataflowBuilder.setIsRefreshable(true);
    return dataflowBuilder.build();
}
 
開發者ID:opendaylight,項目名稱:nic,代碼行數:20,代碼來源:CommonUtils.java

示例4: evaluateAction

import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId; //導入依賴的package包/類
@Override
public synchronized void evaluateAction(String id) throws RendererServiceException {
    try {
        final IntentLimiter intentLimiter = commonUtils.retrieveIntentLimiter(id);
        final Long bandwidtLimit = intentLimiter.getBandwidthLimit();
        final MeterId meterId = createMeter(id, bandwidtLimit);
        final Dataflow dataflow = commonUtils.createFlowData(intentLimiter, meterId);

        sendFlows(dataflow);
        saveDataflow(dataflow);
        createDelayConfigs(intentLimiter, dataflow);
    } catch (ExecutionException | IntentInvalidException e) {
        LOG.error(e.getMessage());
        throw new RendererServiceException(e.getMessage());
    }
}
 
開發者ID:opendaylight,項目名稱:nic,代碼行數:17,代碼來源:OFRendererServiceImpl.java

示例5: removeMeter

import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId; //導入依賴的package包/類
public Future<RpcResult<Void>> removeMeter(final Long meterId, String dataflowId) throws MeterRemovalExeption {
    boolean result = false;
    final MeterId id = new MeterId(meterId);
    final Future<RpcResult<Void>> releaseMeterResult = meterQueueService.releaseMeterId(dataflowId);
    final Map<Node, List<NodeConnector>> nodeListMap = TopologyUtils.getNodes(dataBroker);
    for (Map.Entry<Node, List<NodeConnector>> entry : nodeListMap.entrySet()) {
        final InstanceIdentifier<Meter> instanceIdentifier = retrieveMeterIdentifier(id,
                entry.getKey());
        result = mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION, instanceIdentifier);
    }
    if (!result) {
        throw new MeterRemovalExeption(Long.toString(meterId));
    }
    return releaseMeterResult;
}
 
開發者ID:opendaylight,項目名稱:nic,代碼行數:16,代碼來源:MeterExecutor.java

示例6: retrieveMeterIdentifier

import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId; //導入依賴的package包/類
private InstanceIdentifier<Meter> retrieveMeterIdentifier(final MeterId meterId, Node node) {
    KeyedInstanceIdentifier<Meter, MeterKey> flowIID = null;
    try {
        final InstanceIdentifier<Node> nodePath = InstanceIdentifier
                .create(Nodes.class)
                .child(Node.class, node.getKey());
        flowIID = nodePath
                .augmentation(FlowCapableNode.class)
                .child(Meter.class, new MeterKey(meterId));

    } catch (Exception e) {
        LOG.error(e.getMessage());
    }
    return flowIID.builder().build();
}
 
開發者ID:opendaylight,項目名稱:nic,代碼行數:16,代碼來源:MeterExecutor.java

示例7: createMeter

import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId; //導入依賴的package包/類
private MeterId createMeter(final String id, final Long bandwidtLimit) throws RendererServiceException {
    try {
        return ofRendererFlowService.createMeter(id, bandwidtLimit);
    } catch (MeterCreationExeption e) {
        LOG.error(e.getMessage());
        throw new RendererServiceException(e.getMessage());
    }
}
 
開發者ID:opendaylight,項目名稱:nic,代碼行數:9,代碼來源:OFRendererServiceImpl.java

示例8: retrieveMeterId

import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId; //導入依賴的package包/類
public MeterId retrieveMeterId(final Dataflow dataflow) throws MeterCreationExeption {
    final Short id = dataflow.getMeterId();
    final MeterId meterId = (id != null ? new MeterId(id.longValue()) : meterExecutor.createMeter(dataflow));
    return meterId;
}
 
開發者ID:opendaylight,項目名稱:nic,代碼行數:6,代碼來源:OFRuleWithMeterManager.java

示例9: createMeter

import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId; //導入依賴的package包/類
public MeterId createMeter(final String id, final long dropRate) throws MeterCreationExeption {
    return meterExecutor.createMeter(id, dropRate);
}
 
開發者ID:opendaylight,項目名稱:nic,代碼行數:4,代碼來源:OFRuleWithMeterManager.java

示例10: createMeter

import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId; //導入依賴的package包/類
@Override
public MeterId createMeter(final String id, final long dropRate) throws MeterCreationExeption {
    return ofRuleWithMeterManager.createMeter(id, dropRate);
}
 
開發者ID:opendaylight,項目名稱:nic,代碼行數:5,代碼來源:OFRendererFlowManagerProvider.java

示例11: createMeter

import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId; //導入依賴的package包/類
public MeterId createMeter(final Dataflow dataflow) throws MeterCreationExeption {
    return createMeter(dataflow.getId().getValue(), dataflow.getBandwidthRate());
}
 
開發者ID:opendaylight,項目名稱:nic,代碼行數:4,代碼來源:MeterExecutor.java

示例12: createMeter

import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId; //導入依賴的package包/類
/**
 * Create OpenFlow meters
 * @param id the Dataflow ID as {@link String}
 * @param dropRate the bandwidth drop rate as {@link Long}
 * @return {@link MeterId}
 * @throws MeterCreationExeption
 */
MeterId createMeter(String id, long dropRate) throws MeterCreationExeption;
 
開發者ID:opendaylight,項目名稱:nic,代碼行數:9,代碼來源:OFRendererFlowService.java


注:本文中的org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。