From: Tony Tkacik Date: Tue, 24 Feb 2015 09:39:47 +0000 (+0000) Subject: Merge "Bug 2697: Improvement wrong response handling, missing message" X-Git-Tag: release/lithium~473^2~4 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=e3998d55e33da9f6ecb69da75ecc71a047b6362b;hp=5c008222efa5c0af49cf8a52881a6299b1e249dc Merge "Bug 2697: Improvement wrong response handling, missing message" --- diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/listener/NetconfDeviceCommunicator.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/listener/NetconfDeviceCommunicator.java index 8553820b40..c62f56ac1e 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/listener/NetconfDeviceCommunicator.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/listener/NetconfDeviceCommunicator.java @@ -248,6 +248,10 @@ public class NetconfDeviceCommunicator implements NetconfClientSessionListener, request.future.set( RpcResultBuilder.failed() .withRpcError( NetconfMessageTransformUtil.toRpcError( e ) ).build() ); + + //recursively processing message to eventually find matching request + processMessage(message); + return; } diff --git a/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/listener/NetconfDeviceCommunicatorTest.java b/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/listener/NetconfDeviceCommunicatorTest.java index 68fe87fb60..0ff5e2d3d5 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/listener/NetconfDeviceCommunicatorTest.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/listener/NetconfDeviceCommunicatorTest.java @@ -296,6 +296,27 @@ public class NetconfDeviceCommunicatorTest { return new NetconfMessage( doc ); } + //Test scenario verifying whether missing message is handled + @Test + public void testOnMissingResponseMessage() throws Exception { + + setupSession(); + + String messageID1 = UUID.randomUUID().toString(); + ListenableFuture> resultFuture1 = sendRequest( messageID1 ); + + String messageID2 = UUID.randomUUID().toString(); + ListenableFuture> resultFuture2 = sendRequest( messageID2 ); + + String messageID3 = UUID.randomUUID().toString(); + ListenableFuture> resultFuture3 = sendRequest( messageID3 ); + + //response messages 1,2 are omitted + communicator.onMessage( mockSession, createSuccessResponseMessage( messageID3 ) ); + + verifyResponseMessage( resultFuture3.get(), messageID3 ); + } + @Test public void testOnSuccessfulResponseMessage() throws Exception { setupSession();