use of org.opendaylight.netconf.topology.singleton.messages.transactions.EmptyReadResponse in project netconf by opendaylight.
the class ProxyNetconfServiceTest method testGetConfigEmpty.
@Test
public void testGetConfigEmpty() throws Exception {
ProxyNetconfService netconf = newSuccessfulProxyNetconfService();
final ListenableFuture<Optional<NormalizedNode>> getConfig = netconf.getConfig(PATH);
masterActor.expectMsgClass(GetConfigRequest.class);
masterActor.reply(new EmptyReadResponse());
final Optional<NormalizedNode> result = getConfig.get(5, TimeUnit.SECONDS);
assertFalse(result.isPresent());
}
use of org.opendaylight.netconf.topology.singleton.messages.transactions.EmptyReadResponse in project netconf by opendaylight.
the class ProxyReadWriteTransactionTest method testReadEmpty.
@Test
public void testReadEmpty() throws Exception {
ProxyReadWriteTransaction tx = newSuccessfulProxyTx();
final ListenableFuture<Optional<NormalizedNode>> read = tx.read(STORE, PATH);
masterActor.expectMsgClass(ReadRequest.class);
masterActor.reply(new EmptyReadResponse());
final Optional<NormalizedNode> result = read.get(5, TimeUnit.SECONDS);
assertFalse(result.isPresent());
}
use of org.opendaylight.netconf.topology.singleton.messages.transactions.EmptyReadResponse in project netconf by opendaylight.
the class ProxyNetconfServiceTest method testGetEmpty.
@Test
public void testGetEmpty() throws Exception {
ProxyNetconfService netconf = newSuccessfulProxyNetconfService();
final ListenableFuture<Optional<NormalizedNode>> get = netconf.get(PATH);
masterActor.expectMsgClass(GetRequest.class);
masterActor.reply(new EmptyReadResponse());
final Optional<NormalizedNode> result = get.get(5, TimeUnit.SECONDS);
assertFalse(result.isPresent());
}
use of org.opendaylight.netconf.topology.singleton.messages.transactions.EmptyReadResponse in project netconf by opendaylight.
the class ActorProxyTransactionFacade method read.
@Override
public FluentFuture<Optional<NormalizedNode>> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
LOG.debug("{}: Read {} {} via actor {}", id, store, path, masterTxActor);
final Future<Object> future = Patterns.ask(masterTxActor, new ReadRequest(store, path), askTimeout);
final SettableFuture<Optional<NormalizedNode>> settableFuture = SettableFuture.create();
future.onComplete(new OnComplete<>() {
@Override
public void onComplete(final Throwable failure, final Object response) {
if (failure != null) {
LOG.debug("{}: Read {} {} failed", id, store, path, failure);
final Throwable processedFailure = processFailure(failure);
if (processedFailure instanceof ReadFailedException) {
settableFuture.setException(processedFailure);
} else {
settableFuture.setException(new ReadFailedException("Read of store " + store + " path " + path + " failed", processedFailure));
}
return;
}
LOG.debug("{}: Read {} {} succeeded: {}", id, store, path, response);
if (response instanceof EmptyReadResponse) {
settableFuture.set(Optional.empty());
return;
}
if (response instanceof NormalizedNodeMessage) {
final NormalizedNodeMessage data = (NormalizedNodeMessage) response;
settableFuture.set(Optional.of(data.getNode()));
}
}
}, executionContext);
return FluentFuture.from(settableFuture);
}
Aggregations