use of org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.Batch 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;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.Batch in project bgpcep by opendaylight.
the class AppPeerBenchmark method addRoute.
private long addRoute(final Ipv4Prefix ipv4Prefix, final Ipv4Address nextHop, final long count, final long batch) {
final AttributesBuilder attributesBuilder = new AttributesBuilder();
attributesBuilder.setCNextHop(new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(new Ipv4Address(nextHop)).build()).build());
attributesBuilder.setMultiExitDisc(MED);
attributesBuilder.setLocalPref(LOC_PREF);
attributesBuilder.setOrigin(ORIGIN);
attributesBuilder.setAsPath(AS_PATH);
final Attributes attributes = attributesBuilder.build();
return processRoutes(ipv4Prefix, count, batch, attributes);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.Batch in project bgpcep by opendaylight.
the class AdjRibOutListener method processRouteChange.
private void processRouteChange(final DataTreeCandidateNode route) {
final Update update;
switch(route.getModificationType()) {
case UNMODIFIED:
LOG.debug("Skipping unmodified route {}", route.getIdentifier());
return;
case DELETE:
case DISAPPEARED:
// FIXME: we can batch deletions into a single batch
update = withdraw((MapEntryNode) route.getDataBefore().get());
LOG.debug("Withdrawing routes {}", update);
break;
case APPEARED:
case SUBTREE_MODIFIED:
case WRITE:
update = advertise((MapEntryNode) route.getDataAfter().get());
LOG.debug("Advertising routes {}", update);
break;
default:
LOG.warn("Ignoring unhandled modification type {}", route.getModificationType());
return;
}
this.session.write(update);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.Batch in project netvirt by opendaylight.
the class ElanL2GatewayUtils method deleteElanMacsFromL2GatewayDevice.
/**
* Delete elan macs from L2 gateway device.<br>
* This includes deleting ELAN mac table entries plus external device
* UcastLocalMacs which are part of the same ELAN.
*
* @param hwvtepNodeId
* the hwvtepNodeId
* @param elanName
* the elan name
* @return the listenable future
*/
public ListenableFuture<Void> deleteElanMacsFromL2GatewayDevice(String hwvtepNodeId, String elanName) {
String logicalSwitch = getLogicalSwitchFromElan(elanName);
List<MacAddress> lstElanMacs = getRemoteUcastMacs(new NodeId(hwvtepNodeId), logicalSwitch, LogicalDatastoreType.CONFIGURATION);
ListenableFuture<Void> future = HwvtepUtils.deleteRemoteUcastMacs(broker, new NodeId(hwvtepNodeId), logicalSwitch, lstElanMacs);
Futures.addCallback(future, new FutureCallback<Void>() {
@Override
public void onSuccess(Void noarg) {
LOG.trace("Successful in batch deletion of elan [{}] macs from l2gw device [{}]", elanName, hwvtepNodeId);
}
@Override
public void onFailure(Throwable error) {
LOG.warn("Failed during batch delete of elan {} macs from l2gw device {}. " + "Retrying with sequential deletes.", elanName, hwvtepNodeId, error);
if (lstElanMacs != null && !lstElanMacs.isEmpty()) {
for (MacAddress mac : lstElanMacs) {
HwvtepUtils.deleteRemoteUcastMac(broker, new NodeId(hwvtepNodeId), logicalSwitch, mac);
}
}
}
}, MoreExecutors.directExecutor());
if (LOG.isDebugEnabled()) {
List<String> elanMacs = lstElanMacs.stream().map(MacAddress::getValue).collect(Collectors.toList());
LOG.debug("Deleting elan [{}] macs from node [{}]. Deleted macs = {}", elanName, hwvtepNodeId, elanMacs);
}
return future;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.Batch 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;
}
}
}
}
Aggregations