本文整理汇总了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;
}
示例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();
}
示例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();
}
示例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());
}
}
示例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;
}
示例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();
}
示例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());
}
}
示例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;
}
示例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);
}
示例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);
}
示例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());
}
示例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;