Propagate action logical datastore type 54/83754/2
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 19 Aug 2019 12:01:27 +0000 (14:01 +0200)
committerRobert Varga <nite@hq.sk>
Tue, 20 Aug 2019 12:06:04 +0000 (12:06 +0000)
Unlike RFC7950 and related specifications, actions are generalized
in ODL to work on any datastore type, as otherwise internal cooperation
could not work on onything but operational datastore.

This patch correctly propagates the invocation datastore type, so that
invoking actions on top of config datastore becomes possible.

JIRA: CONTROLLER-1894
Change-Id: I20f340bee0321a446a07d701650d6dac57057ee6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/ExecuteAction.java

index 5f9d99f698688d58d483ff751f02061a610908b9..6d19d9c7edf2151b1bf55196b62225ed8ddec34c 100644 (file)
@@ -75,7 +75,7 @@ public final class ExecuteAction extends AbstractExecute<@NonNull ContainerNode>
         public void writeExternal(final ObjectOutput out) throws IOException {
             try (NormalizedNodeDataOutput stream = NormalizedNodeInputOutput.newDataOutput(out)) {
                 stream.writeSchemaPath(executeAction.getType());
-                // FIXME: deal with data store types?
+                executeAction.getPath().getDatastoreType().writeTo(out);
                 stream.writeYangInstanceIdentifier(executeAction.getPath().getRootIdentifier());
                 stream.writeOptionalNormalizedNode(executeAction.getInput());
             }
@@ -85,11 +85,11 @@ public final class ExecuteAction extends AbstractExecute<@NonNull ContainerNode>
         public void readExternal(final ObjectInput in) throws IOException {
             final NormalizedNodeDataInput stream = NormalizedNodeInputOutput.newDataInput(in);
             final SchemaPath name = stream.readSchemaPath();
+            final LogicalDatastoreType type = LogicalDatastoreType.readFrom(in);
             final YangInstanceIdentifier path = stream.readYangInstanceIdentifier();
             final ContainerNode input = (ContainerNode) stream.readOptionalNormalizedNode().orElse(null);
 
-            executeAction = new ExecuteAction(name, new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, path),
-                input);
+            executeAction = new ExecuteAction(name, new DOMDataTreeIdentifier(type, path), input);
         }
 
         private Object readResolve() {