Revert "Remove SchemaNode#getPath usage from RestconfDataServiceImpl for rfc8040" 71/100171/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 21 Mar 2022 09:12:16 +0000 (10:12 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 21 Mar 2022 09:12:21 +0000 (10:12 +0100)
This reverts commit 60cb992dbb51addce3165a83d4b682047a10957a. The
assumptsions being made are just not correct.

Change-Id: I035677717f4de2d829209480cbd01d47d1c99a6d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfDataServiceImpl.java

index f50951d5d7d641b7a817a2bd54e39eb2aff096d7..bfe5dda8b5296e863f5cdcf24c6e544202b9a692 100644 (file)
@@ -29,7 +29,6 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.concurrent.CancellationException;
 import java.util.concurrent.ExecutionException;
-import java.util.stream.Collectors;
 import javax.ws.rs.Path;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.Status;
@@ -319,23 +318,17 @@ public class RestconfDataServiceImpl implements RestconfDataService {
      */
     public Response invokeAction(final NormalizedNodePayload payload) {
         final InstanceIdentifierContext<?> context = payload.getInstanceIdentifierContext();
-        final DOMMountPoint mountPoint = context.getMountPoint();
-
         final YangInstanceIdentifier yangIIdContext = context.getInstanceIdentifier();
         final NormalizedNode data = payload.getData();
+
         if (yangIIdContext.isEmpty() && !NETCONF_BASE_QNAME.equals(data.getIdentifier().getNodeType())) {
             throw new RestconfDocumentedException("Instance identifier need to contain at least one path argument",
-                    ErrorType.PROTOCOL, ErrorTag.MALFORMED_MESSAGE);
+                ErrorType.PROTOCOL, ErrorTag.MALFORMED_MESSAGE);
         }
 
-        final List<QName> qNames = yangIIdContext.getPathArguments().stream()
-                .filter(arg -> !(arg instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates))
-                .filter(arg -> !(arg instanceof YangInstanceIdentifier.AugmentationIdentifier))
-                .map(PathArgument::getNodeType)
-                .collect(Collectors.toList());
-        qNames.add(context.getSchemaNode().getQName());
-        final Absolute schemaPath = Absolute.of(qNames);
-
+        final DOMMountPoint mountPoint = context.getMountPoint();
+        final Absolute schemaPath = Absolute.of(ImmutableList.copyOf(context.getSchemaNode().getPath()
+            .getPathFromRoot()));
         final DOMActionResult response;
         final EffectiveModelContext schemaContextRef;
         if (mountPoint != null) {