Merge "Add blueprint wiring for restconf connector"
authorJakub Morvay <jmorvay@cisco.com>
Tue, 27 Jun 2017 11:37:31 +0000 (11:37 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 27 Jun 2017 11:37:31 +0000 (11:37 +0000)
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/KeepaliveSalFacade.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfBaseOps.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlNormalizedNodeBodyReader.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/jersey/providers/JsonNormalizedNodeBodyReader.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/jersey/providers/XmlNormalizedNodeBodyReader.java

index 2e33b57beb86f484d147b43d3982c74a7d397cd4..917b8241e6c17a6e720edd09da5dce0cc7d98d1c 100644 (file)
@@ -266,7 +266,7 @@ public final class KeepaliveSalFacade implements RemoteDeviceHandler<NetconfSess
      * DOMRpcService proxy that attaches reset-keepalive-task and schedule
      * request-timeout-task to each RPC invocation.
      */
-    private static final class KeepaliveDOMRpcService implements DOMRpcService {
+    public static final class KeepaliveDOMRpcService implements DOMRpcService {
 
         private final DOMRpcService deviceRpc;
         private ResetKeepalive resetKeepaliveTask;
@@ -281,6 +281,10 @@ public final class KeepaliveSalFacade implements RemoteDeviceHandler<NetconfSess
             this.executor = executor;
         }
 
+        public DOMRpcService getDeviceRpc() {
+            return deviceRpc;
+        }
+
         @Nonnull
         @Override
         public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull final SchemaPath type,
index d12a97c8bd4979d7a2f87942f39d5e54d7d11d20..debd460936ecfb524da81fd2385688a47138fd28 100644 (file)
@@ -35,6 +35,7 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
+import org.opendaylight.netconf.sal.connect.netconf.sal.KeepaliveSalFacade.KeepaliveDOMRpcService;
 import org.opendaylight.netconf.sal.connect.netconf.sal.SchemalessNetconfDeviceRpc;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.copy.config.input.target.ConfigTarget;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.edit.config.input.EditContent;
@@ -63,7 +64,9 @@ public final class NetconfBaseOps {
     public NetconfBaseOps(final DOMRpcService rpc, final SchemaContext schemaContext) {
         this.rpc = rpc;
         this.schemaContext = schemaContext;
-        if (rpc instanceof SchemalessNetconfDeviceRpc) {
+
+        if ((rpc instanceof KeepaliveDOMRpcService)
+                && (((KeepaliveDOMRpcService) rpc).getDeviceRpc() instanceof SchemalessNetconfDeviceRpc)) {
             this.transformer = new SchemalessRpcStructureTransformer();
         } else {
             this.transformer = new NetconfRpcStructureTransformer(schemaContext);
index 0f558fa229743c088398f22591363dcbd4d8a9d9..db2b3188322432d0e8768a227c79beea52ee370f 100644 (file)
@@ -169,7 +169,7 @@ public class JsonNormalizedNodeBodyReader
             LOG.debug("Error parsing json input:", exception);
 
             throw new RestconfDocumentedException("Error parsing json input: Failed to create new parse result data. "
-                    + "Are you creating multiple resources/subresources in POST request?");
+                    + "Are you creating multiple resources/subresources in POST request?", exception);
         }
 
         LOG.debug("Error parsing json input", exception);
index 3addde0ae0d9556634e1fd9a7aa9b131dfeea88b..6f248f413f5b967009a436401b01b8b7e149e2ca 100644 (file)
@@ -92,7 +92,7 @@ public class XmlNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsPro
             LOG.debug("Error parsing xml input", e);
 
             throw new RestconfDocumentedException("Error parsing input: " + e.getMessage(), ErrorType.PROTOCOL,
-                    ErrorTag.MALFORMED_MESSAGE);
+                    ErrorTag.MALFORMED_MESSAGE, e);
         }
     }
 
index 72df65958f60a61da6f31058201309e943539bbf..a14cec0d0479c2d3e2340b2b6ec7848872c99be0 100644 (file)
@@ -129,7 +129,7 @@ public class JsonNormalizedNodeBodyReader extends AbstractNormalizedNodeBodyRead
             LOG.debug("Error parsing json input:", exception);
 
             throw new RestconfDocumentedException("Error parsing json input: Failed to create new parse result data. "
-                    + "Are you creating multiple resources/subresources in POST request?");
+                    + "Are you creating multiple resources/subresources in POST request?", exception);
         }
 
         LOG.debug("Error parsing json input", exception);
index e3ace7c02b86ad49f877c4981dfe9fe2a8c994c2..4458995e7766182481eb1554a91bca38efe9ab8b 100644 (file)
@@ -69,7 +69,7 @@ public class XmlNormalizedNodeBodyReader extends AbstractNormalizedNodeBodyReade
             LOG.debug("Error parsing xml input", e);
 
             throw new RestconfDocumentedException("Error parsing input: " + e.getMessage(), ErrorType.PROTOCOL,
-                    ErrorTag.MALFORMED_MESSAGE);
+                    ErrorTag.MALFORMED_MESSAGE, e);
         }
     }