Search in sources :

Example 1 with BatchChoice

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.BatchChoice in project openflowplugin by opendaylight.

the class FlatBatchUtil method detectBatchStepType.

@VisibleForTesting
static <T extends BatchChoice> BatchStepType detectBatchStepType(final T batchCase) {
    final BatchStepType type;
    final Class<? extends DataContainer> implementedInterface = batchCase.getImplementedInterface();
    if (FlatBatchAddFlowCase.class.equals(implementedInterface)) {
        type = BatchStepType.FLOW_ADD;
    } else if (FlatBatchRemoveFlowCase.class.equals(implementedInterface)) {
        type = BatchStepType.FLOW_REMOVE;
    } else if (FlatBatchUpdateFlowCase.class.equals(implementedInterface)) {
        type = BatchStepType.FLOW_UPDATE;
    } else if (FlatBatchAddGroupCase.class.equals(implementedInterface)) {
        type = BatchStepType.GROUP_ADD;
    } else if (FlatBatchRemoveGroupCase.class.equals(implementedInterface)) {
        type = BatchStepType.GROUP_REMOVE;
    } else if (FlatBatchUpdateGroupCase.class.equals(implementedInterface)) {
        type = BatchStepType.GROUP_UPDATE;
    } else if (FlatBatchAddMeterCase.class.equals(implementedInterface)) {
        type = BatchStepType.METER_ADD;
    } else if (FlatBatchRemoveMeterCase.class.equals(implementedInterface)) {
        type = BatchStepType.METER_REMOVE;
    } else if (FlatBatchUpdateMeterCase.class.equals(implementedInterface)) {
        type = BatchStepType.METER_UPDATE;
    } else {
        throw new IllegalArgumentException("Unsupported batch obtained: " + implementedInterface);
    }
    return type;
}
Also used : FlatBatchRemoveMeterCase(org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.FlatBatchRemoveMeterCase) FlatBatchRemoveFlowCase(org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.FlatBatchRemoveFlowCase) FlatBatchAddGroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.FlatBatchAddGroupCase) BatchStepType(org.opendaylight.openflowplugin.impl.services.batch.BatchStepType) FlatBatchUpdateGroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.FlatBatchUpdateGroupCase) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 2 with BatchChoice

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.BatchChoice in project openflowplugin by opendaylight.

the class SyncPlanPushStrategyFlatBatchImpl method decrementBatchFailuresCounters.

private static void decrementBatchFailuresCounters(final List<BatchFailure> batchFailures, final Map<Range<Integer>, Batch> batchMap, final SyncCrudCounters counters) {
    for (BatchFailure batchFailure : batchFailures) {
        for (Map.Entry<Range<Integer>, Batch> rangeBatchEntry : batchMap.entrySet()) {
            if (rangeBatchEntry.getKey().contains(batchFailure.getBatchOrder())) {
                // get type and decrease
                final BatchChoice batchChoice = rangeBatchEntry.getValue().getBatchChoice();
                decrementCounters(batchChoice, counters);
                break;
            }
        }
    }
}
Also used : BatchFailure(org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.output.BatchFailure) BatchChoice(org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.BatchChoice) Batch(org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.Batch) Range(com.google.common.collect.Range) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Range (com.google.common.collect.Range)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 BatchStepType (org.opendaylight.openflowplugin.impl.services.batch.BatchStepType)1 Batch (org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.Batch)1 BatchChoice (org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.BatchChoice)1 FlatBatchAddGroupCase (org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.FlatBatchAddGroupCase)1 FlatBatchRemoveFlowCase (org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.FlatBatchRemoveFlowCase)1 FlatBatchRemoveMeterCase (org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.FlatBatchRemoveMeterCase)1 FlatBatchUpdateGroupCase (org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.FlatBatchUpdateGroupCase)1 BatchFailure (org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.output.BatchFailure)1