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


Java MeterFailReason类代码示例

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


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

示例1: activate

import org.onosproject.net.meter.MeterFailReason; //导入依赖的package包/类
@Activate
public void activate() {
    providerService = providerRegistry.register(this);

    pendingOperations = CacheBuilder.newBuilder()
            .expireAfterWrite(TIMEOUT, TimeUnit.SECONDS)
            .removalListener((RemovalNotification<Long, MeterOperation> notification) -> {
                if (notification.getCause() == RemovalCause.EXPIRED) {
                    providerService.meterOperationFailed(notification.getValue(),
                                                         MeterFailReason.TIMEOUT);
                }
            }).build();

    controller.addEventListener(listener);
    controller.addListener(listener);

    controller.getSwitches().forEach((sw -> createStatsCollection(sw)));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:OpenFlowMeterProvider.java

示例2: activate

import org.onosproject.net.meter.MeterFailReason; //导入依赖的package包/类
@Activate
public void activate() {

    store.setDelegate(delegate);

    onComplete = (request, result, error) ->
        {
            request.context().ifPresent(c -> {
                if (error != null) {
                    c.onError(request, MeterFailReason.UNKNOWN);
                } else {
                    if (result.reason().isPresent()) {
                        c.onError(request, result.reason().get());
                    } else {
                        c.onSuccess(request);
                    }
                }
            });

        };
    log.info("Started");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:MeterManager.java

示例3: activate

import org.onosproject.net.meter.MeterFailReason; //导入依赖的package包/类
@Activate
public void activate() {

    local = clusterService.getLocalNode().id();


    meters = storageService.<MeterKey, MeterData>consistentMapBuilder()
                .withName(METERSTORE)
                .withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API),
                                                 MeterKey.class,
                                                 MeterData.class,
                                                 DefaultMeter.class,
                                                 DefaultBand.class,
                                                 Band.Type.class,
                                                 MeterState.class,
                                                 Meter.Unit.class,
                                                 MeterFailReason.class)).build();

    meters.addListener(mapListener);

    log.info("Started");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:DistributedMeterStore.java

示例4: updateMeter

import org.onosproject.net.meter.MeterFailReason; //导入依赖的package包/类
@Override
public CompletableFuture<MeterStoreResult> updateMeter(Meter meter) {
    CompletableFuture<MeterStoreResult> future = new CompletableFuture<>();
    MeterKey key = MeterKey.key(meter.deviceId(), meter.id());
    futures.put(key, future);

    MeterData data = new MeterData(meter, null, local);
    try {
        if (meters.computeIfPresent(key, (k, v) -> data) == null) {
            future.complete(MeterStoreResult.fail(MeterFailReason.INVALID_METER));
        }
    } catch (StorageException e) {
        future.completeExceptionally(e);
    }
    return future;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:DistributedMeterStore.java

示例5: performMeterOperation

import org.onosproject.net.meter.MeterFailReason; //导入依赖的package包/类
@Override
public void performMeterOperation(DeviceId deviceId, MeterOperation meterOp) {
    Dpid dpid = Dpid.dpid(deviceId.uri());
    OpenFlowSwitch sw = controller.getSwitch(dpid);
    if (sw == null) {
        log.error("Unknown device {}", deviceId);
        providerService.meterOperationFailed(meterOp,
                                             MeterFailReason.UNKNOWN_DEVICE);
        return;
    }

    performOperation(sw, meterOp);

    if (meterOp.type().equals(MeterOperation.Type.REMOVE)) {
        forceMeterStats(deviceId);
    }

}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:19,代码来源:OpenFlowMeterProvider.java

示例6: updateMeter

import org.onosproject.net.meter.MeterFailReason; //导入依赖的package包/类
@Override
public CompletableFuture<MeterStoreResult> updateMeter(Meter meter) {
    CompletableFuture<MeterStoreResult> future = new CompletableFuture<>();
    MeterKey key = MeterKey.key(meter.deviceId(), meter.id());
    futures.put(key, future);

    MeterData data = new MeterData(meter, null, local);
    try {
        if (meters.computeIfPresent(key, (k, v) -> data) == null) {
            future.complete(MeterStoreResult.fail(MeterFailReason.INVALID_METER));
        }
    } catch (StorageException e) {
        futures.remove(key);
        future.completeExceptionally(e);
    }
    return future;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:18,代码来源:DistributedMeterStore.java

示例7: updateMeter

import org.onosproject.net.meter.MeterFailReason; //导入依赖的package包/类
@Override
public CompletableFuture<MeterStoreResult> updateMeter(NetworkId networkId, Meter meter) {
    ConcurrentMap<MeterKey, MeterData> meters = getMetersByNetwork(networkId);
    ConcurrentMap<MeterKey, CompletableFuture<MeterStoreResult>> futures =
            getFuturesByNetwork(networkId);

    CompletableFuture<MeterStoreResult> future = new CompletableFuture<>();
    MeterKey key = MeterKey.key(meter.deviceId(), meter.id());
    futures.put(key, future);

    MeterData data = new MeterData(meter, null, local);
    try {
            if (meters.computeIfPresent(key, (k, v) -> data) == null) {
                    future.complete(MeterStoreResult.fail(MeterFailReason.INVALID_METER));
            }
    } catch (StorageException e) {
            future.completeExceptionally(e);
    }
    return future;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:21,代码来源:SimpleVirtualMeterStore.java

示例8: activate

import org.onosproject.net.meter.MeterFailReason; //导入依赖的package包/类
@Activate
public void activate(ComponentContext context) {
    store.setDelegate(delegate);
    cfgService.registerProperties(getClass());
    eventDispatcher.addSink(MeterEvent.class, listenerRegistry);

    onComplete = (request, result, error) -> {
            request.context().ifPresent(c -> {
                if (error != null) {
                    c.onError(request, MeterFailReason.UNKNOWN);
                } else {
                    if (result.reason().isPresent()) {
                        c.onError(request, result.reason().get());
                    } else {
                        c.onSuccess(request);
                    }
                }
            });

        };

    executorService = newFixedThreadPool(numThreads,
            groupedThreads(GROUP_THREAD_NAME, WORKER_PATTERN, log));
    modified(context);
    log.info("Started");
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:27,代码来源:MeterManager.java

示例9: performMeterOperation

import org.onosproject.net.meter.MeterFailReason; //导入依赖的package包/类
@Override
public void performMeterOperation(DeviceId deviceId, MeterOperations meterOps) {
    Dpid dpid = Dpid.dpid(deviceId.uri());
    OpenFlowSwitch sw = controller.getSwitch(dpid);
    if (sw == null) {
        log.error("Unknown device {}", deviceId);
        meterOps.operations().forEach(op ->
                                              providerService.meterOperationFailed(op,
                                                                                   MeterFailReason.UNKNOWN_DEVICE)
        );
        return;
    }

    meterOps.operations().forEach(op -> performOperation(sw, op));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:OpenFlowMeterProvider.java

示例10: VirtualNetworkMeterManager

import org.onosproject.net.meter.MeterFailReason; //导入依赖的package包/类
/**
 * Creates a new VirtualNetworkMeterManager object.
 *
 * @param manager virtual network manager service
 * @param networkId a virtual network identifier
 */
public VirtualNetworkMeterManager(VirtualNetworkService manager,
                                  NetworkId networkId) {
    super(manager, networkId, MeterEvent.class);

    coreStorageService = serviceDirectory.get(StorageService.class);
    providerRegistryService =
            serviceDirectory.get(VirtualProviderRegistryService.class);

    store = serviceDirectory.get(VirtualNetworkMeterStore.class);
    store.setDelegate(networkId, this.storeDelegate);

    innerProviderService = new InternalMeterProviderService();
    providerRegistryService.registerProviderService(networkId(), innerProviderService);


    onComplete = (request, result, error) -> {
        request.context().ifPresent(c -> {
            if (error != null) {
                c.onError(request, MeterFailReason.UNKNOWN);
            } else {
                if (result.reason().isPresent()) {
                    c.onError(request, result.reason().get());
                } else {
                    c.onSuccess(request);
                }
            }
        });

    };

    log.info("Started");
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:39,代码来源:VirtualNetworkMeterManager.java

示例11: activate

import org.onosproject.net.meter.MeterFailReason; //导入依赖的package包/类
@Activate
public void activate() {
    providerRegistryService.registerProvider(this);
    internalMeterListener = new InternalMeterListener();

    idGenerator = getIdGenerator();

    pendingOperations = CacheBuilder.newBuilder()
            .expireAfterWrite(TIMEOUT, TimeUnit.SECONDS)
            .removalListener(
                    (RemovalNotification<Long, VirtualMeterOperation>
                             notification) -> {
                if (notification.getCause() == RemovalCause.EXPIRED) {
                    NetworkId networkId = notification.getValue().networkId();
                    MeterOperation op = notification.getValue().operation();

                    VirtualMeterProviderService providerService =
                            (VirtualMeterProviderService) providerRegistryService
                                    .getProviderService(networkId,
                                                        VirtualMeterProvider.class);

                    providerService.meterOperationFailed(op,
                                                         MeterFailReason.TIMEOUT);
                }
            }).build();

    meterService.addListener(internalMeterListener);

    log.info("Started");
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:31,代码来源:DefaultVirtualMeterProvider.java

示例12: performOperation

import org.onosproject.net.meter.MeterFailReason; //导入依赖的package包/类
private void performOperation(NetworkId networkId, DeviceId deviceId,
                              MeterOperation op) {

    VirtualMeterOperation vOp = new VirtualMeterOperation(networkId, op);
    pendingOperations.put(idGenerator.getNewId(), vOp);

    switch (op.type()) {
        case ADD:
            //TODO: devirtualize + submit
            break;
        case REMOVE:
            //TODO: devirtualize + withdraw
            break;
        case MODIFY:
            //TODO: devitualize + withdraw and submit
            break;
        default:
            log.warn("Unknown Meter command {}; not sending anything",
                     op.type());
            VirtualMeterProviderService providerService =
                    (VirtualMeterProviderService) providerRegistryService
                            .getProviderService(networkId,
                                                VirtualMeterProvider.class);
            providerService.meterOperationFailed(op,
                                                 MeterFailReason.UNKNOWN_COMMAND);
    }

}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:29,代码来源:DefaultVirtualMeterProvider.java

示例13: activate

import org.onosproject.net.meter.MeterFailReason; //导入依赖的package包/类
@Activate
public void activate() {
    local = clusterService.getLocalNode().id();

    meters = storageService.<MeterKey, MeterData>consistentMapBuilder()
                .withName(METERSTORE)
                .withSerializer(serializer).build();

    meters.addListener(mapListener);

    meterFeatures = storageService.<MeterFeaturesKey, MeterFeatures>consistentMapBuilder()
            .withName(METERFEATURESSTORE)
            .withSerializer(Serializer.using(KryoNamespaces.API,
                                             MeterFeaturesKey.class,
                                             MeterFeatures.class,
                                             DefaultMeterFeatures.class,
                                             Band.Type.class,
                                             Meter.Unit.class,
                                             MeterFailReason.class,
                                             MeterFeaturesFlag.class)).build();

    // Init the set of the available ids
    availableMeterIds = new DefaultDistributedSet<>(storageService.<MeterKey>setBuilder()
            .withName(AVAILABLEMETERIDSTORE)
            .withSerializer(Serializer.using(KryoNamespaces.API,
                                             MeterKey.class)).build(),
            DistributedPrimitive.DEFAULT_OPERATION_TIMEOUT_MILLIS);

    // Init atomic map counters
    meterIdGenerators = storageService.<DeviceId>atomicCounterMapBuilder()
            .withName(METERIDSTORE)
            .withSerializer(Serializer.using(KryoNamespaces.API)).build();

    log.info("Started");
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:36,代码来源:DistributedMeterStore.java

示例14: failedMeter

import org.onosproject.net.meter.MeterFailReason; //导入依赖的package包/类
@Override
public void failedMeter(NetworkId networkId, MeterOperation op, MeterFailReason reason) {
    ConcurrentMap<MeterKey, MeterData> meters = getMetersByNetwork(networkId);

    MeterKey key = MeterKey.key(op.meter().deviceId(), op.meter().id());
    meters.computeIfPresent(key, (k, v) ->
            new MeterData(v.meter(), reason, v.origin()));
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:9,代码来源:SimpleVirtualMeterStore.java

示例15: signalMeterError

import org.onosproject.net.meter.MeterFailReason; //导入依赖的package包/类
private void signalMeterError(OFMeterModFailedErrorMsg meterError,
                              MeterOperation op) {
    switch (meterError.getCode()) {
        case UNKNOWN:
            providerService.meterOperationFailed(op,
                                                 MeterFailReason.UNKNOWN_DEVICE);
            break;
        case METER_EXISTS:
            providerService.meterOperationFailed(op,
                                                 MeterFailReason.EXISTING_METER);
            break;
        case INVALID_METER:
            providerService.meterOperationFailed(op,
                                                 MeterFailReason.INVALID_METER);
            break;
        case UNKNOWN_METER:
            providerService.meterOperationFailed(op,
                                                 MeterFailReason.UNKNOWN);
            break;
        case BAD_COMMAND:
            providerService.meterOperationFailed(op,
                                                 MeterFailReason.UNKNOWN_COMMAND);
            break;
        case BAD_FLAGS:
            providerService.meterOperationFailed(op,
                                                 MeterFailReason.UNKNOWN_FLAGS);
            break;
        case BAD_RATE:
            providerService.meterOperationFailed(op,
                                                 MeterFailReason.BAD_RATE);
            break;
        case BAD_BURST:
            providerService.meterOperationFailed(op,
                                                 MeterFailReason.BAD_BURST);
            break;
        case BAD_BAND:
            providerService.meterOperationFailed(op,
                                                 MeterFailReason.BAD_BAND);
            break;
        case BAD_BAND_VALUE:
            providerService.meterOperationFailed(op,
                                                 MeterFailReason.BAD_BAND_VALUE);
            break;
        case OUT_OF_METERS:
            providerService.meterOperationFailed(op,
                                                 MeterFailReason.OUT_OF_METERS);
            break;
        case OUT_OF_BANDS:
            providerService.meterOperationFailed(op,
                                                 MeterFailReason.OUT_OF_BANDS);
            break;
        default:
            providerService.meterOperationFailed(op,
                                                 MeterFailReason.UNKNOWN);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:57,代码来源:OpenFlowMeterProvider.java


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