use of org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage in project netconf by opendaylight.
the class ActorProxyNetconfServiceFacade method merge.
@Override
public ListenableFuture<? extends DOMRpcResult> merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode data, final Optional<ModifyAction> defaultOperation) {
LOG.debug("{}: Merge {} {} via actor {}", id, store, path, masterActor);
masterActor.tell(new MergeEditConfigRequest(store, new NormalizedNodeMessage(path, data), defaultOperation.orElse(null)), ActorRef.noSender());
return createResult();
}
use of org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage in project netconf by opendaylight.
the class ActorProxyNetconfServiceFacade method replace.
@Override
public ListenableFuture<? extends DOMRpcResult> replace(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode data, final Optional<ModifyAction> defaultOperation) {
LOG.debug("{}: Replace {} {} via actor {}", id, store, path, masterActor);
masterActor.tell(new ReplaceEditConfigRequest(store, new NormalizedNodeMessage(path, data), defaultOperation.orElse(null)), ActorRef.noSender());
return createResult();
}
use of org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage in project netconf by opendaylight.
the class ActorProxyTransactionFacade method put.
@Override
public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode data) {
LOG.debug("{}: Put {} {} via actor {}", id, store, path, masterTxActor);
masterTxActor.tell(new PutRequest(store, new NormalizedNodeMessage(path, data)), ActorRef.noSender());
}
use of org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage in project netconf by opendaylight.
the class ProxyReadWriteTransactionTest method testDelayedMasterActorFuture.
@Test
public void testDelayedMasterActorFuture() throws InterruptedException, TimeoutException, ExecutionException {
final Promise<Object> promise = Futures.promise();
ProxyReadWriteTransaction tx = new ProxyReadWriteTransaction(DEVICE_ID, promise.future(), system.dispatcher(), Timeout.apply(5, TimeUnit.SECONDS));
final ListenableFuture<Optional<NormalizedNode>> read = tx.read(STORE, PATH);
final ListenableFuture<Boolean> exists = tx.exists(STORE, PATH);
tx.put(STORE, PATH, node);
tx.merge(STORE, PATH, node);
tx.delete(STORE, PATH);
final ListenableFuture<?> commit = tx.commit();
promise.success(masterActor.ref());
masterActor.expectMsgClass(ReadRequest.class);
masterActor.reply(new NormalizedNodeMessage(PATH, node));
masterActor.expectMsgClass(ExistsRequest.class);
masterActor.reply(Boolean.TRUE);
masterActor.expectMsgClass(PutRequest.class);
masterActor.expectMsgClass(MergeRequest.class);
masterActor.expectMsgClass(DeleteRequest.class);
masterActor.expectMsgClass(SubmitRequest.class);
masterActor.reply(new Success(null));
read.get(5, TimeUnit.SECONDS).isPresent();
assertTrue(exists.get(5, TimeUnit.SECONDS));
commit.get(5, TimeUnit.SECONDS);
}
use of org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage in project netconf by opendaylight.
the class ProxyReadWriteTransactionTest method testRead.
@Test
public void testRead() throws Exception {
ProxyReadWriteTransaction tx = newSuccessfulProxyTx();
final ListenableFuture<Optional<NormalizedNode>> read = tx.read(STORE, PATH);
final ReadRequest readRequest = masterActor.expectMsgClass(ReadRequest.class);
assertEquals(STORE, readRequest.getStore());
assertEquals(PATH, readRequest.getPath());
masterActor.reply(new NormalizedNodeMessage(PATH, node));
final Optional<NormalizedNode> result = read.get(5, TimeUnit.SECONDS);
assertTrue(result.isPresent());
assertEquals(node, result.get());
}
Aggregations