use of org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier in project controller by opendaylight.
the class ShardManager method onPrefixShardRemoved.
private void onPrefixShardRemoved(final PrefixShardRemoved message) {
LOG.debug("{}: onPrefixShardRemoved : {}", persistenceId(), message);
final DOMDataTreeIdentifier prefix = message.getPrefix();
final ShardIdentifier shardId = getShardIdentifier(cluster.getCurrentMemberName(), ClusterUtils.getCleanShardName(prefix.getRootIdentifier()));
configuration.removePrefixShardConfiguration(prefix);
removeShard(shardId);
}
use of org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier in project controller by opendaylight.
the class ConcurrentDOMDataBrokerTest method testExtensions.
@Test
public void testExtensions() {
DistributedDataStore mockConfigStore = mock(DistributedDataStore.class);
DistributedDataStore mockOperStore = mock(DistributedDataStore.class);
try (ConcurrentDOMDataBroker dataBroker = new ConcurrentDOMDataBroker(ImmutableMap.of(LogicalDatastoreType.OPERATIONAL, mockOperStore, LogicalDatastoreType.CONFIGURATION, mockConfigStore), futureExecutor)) {
Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> supportedExtensions = dataBroker.getSupportedExtensions();
assertNotNull(supportedExtensions.get(DOMDataTreeChangeService.class));
DOMDataTreeCommitCohortRegistry cohortRegistry = (DOMDataTreeCommitCohortRegistry) supportedExtensions.get(DOMDataTreeCommitCohortRegistry.class);
assertNotNull(cohortRegistry);
DOMDataTreeCommitCohort mockCohort = mock(DOMDataTreeCommitCohort.class);
DOMDataTreeIdentifier path = new DOMDataTreeIdentifier(org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY);
cohortRegistry.registerCommitCohort(path, mockCohort);
verify(mockConfigStore).registerCommitCohort(path, mockCohort);
}
}
use of org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier in project controller by opendaylight.
the class ShardProxyTransaction method ready.
@Override
public void ready() {
LOG.debug("Readying transaction for shard {}", shardRoot);
Preconditions.checkNotNull(modification, "Attempting to ready an empty transaction.");
cohorts.add(modification.seal());
for (Entry<DOMDataTreeIdentifier, ForeignShardModificationContext> entry : modification.getChildShards().entrySet()) {
cohorts.add(new ForeignShardThreePhaseCommitCohort(entry.getKey(), entry.getValue()));
}
}
use of org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier in project controller by opendaylight.
the class ShardedDataTreeActor method onProducerCreated.
private void onProducerCreated(final ProducerCreated message) {
LOG.debug("Received ProducerCreated: {}", message);
// fastpath if we have no peers
if (resolver.getShardingServicePeerActorAddresses().isEmpty()) {
getSender().tell(new Status.Success(null), noSender());
}
final ActorRef sender = getSender();
final Collection<DOMDataTreeIdentifier> subtrees = message.getSubtrees();
final List<CompletableFuture<Object>> futures = new ArrayList<>();
for (final String address : resolver.getShardingServicePeerActorAddresses()) {
final ActorSelection actorSelection = actorSystem.actorSelection(address);
futures.add(FutureConverters.toJava(actorContext.executeOperationAsync(actorSelection, new NotifyProducerCreated(subtrees), DEFAULT_ASK_TIMEOUT)).toCompletableFuture());
}
final CompletableFuture<Void> combinedFuture = CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()]));
combinedFuture.thenRun(() -> sender.tell(new Success(null), noSender())).exceptionally(throwable -> {
sender.tell(new Status.Failure(throwable), self());
return null;
});
}
use of org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier in project controller by opendaylight.
the class ShardedDataTreeActor method onNotifyProducerCreated.
private void onNotifyProducerCreated(final NotifyProducerCreated message) {
LOG.debug("Received NotifyProducerCreated: {}", message);
final Collection<DOMDataTreeIdentifier> subtrees = message.getSubtrees();
try {
final ActorProducerRegistration registration = new ActorProducerRegistration(shardingService.localCreateProducer(subtrees), subtrees);
subtrees.forEach(id -> idToProducer.put(id, registration));
sender().tell(new Status.Success(null), self());
} catch (final IllegalArgumentException e) {
sender().tell(new Status.Failure(e), getSelf());
}
}
Aggregations