From: Robert Varga Date: Mon, 21 Mar 2022 09:12:16 +0000 (+0100) Subject: Revert "Remove SchemaNode#getPath usage from RestconfDataServiceImpl for rfc8040" X-Git-Tag: v3.0.0~67 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=netconf.git;a=commitdiff_plain;h=1a12853fe2695cf4124c83aa051b54064a706529 Revert "Remove SchemaNode#getPath usage from RestconfDataServiceImpl for rfc8040" This reverts commit 60cb992dbb51addce3165a83d4b682047a10957a. The assumptsions being made are just not correct. Change-Id: I035677717f4de2d829209480cbd01d47d1c99a6d Signed-off-by: Robert Varga --- diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfDataServiceImpl.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfDataServiceImpl.java index f50951d5d7..bfe5dda8b5 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfDataServiceImpl.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfDataServiceImpl.java @@ -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 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) {