Remove misleading identifier check 78/104378/2
authorIvan Hrasko <ivan.hrasko@pantheon.tech>
Mon, 13 Feb 2023 10:08:35 +0000 (11:08 +0100)
committerRobert Varga <nite@hq.sk>
Tue, 28 Feb 2023 11:25:44 +0000 (11:25 +0000)
Check for presence of mount prefix in request for operation
is misleading. Its fully legal to ask for particular operation
on controller or device.

Remove this check which allows us to invoke requests for particular
operation on controller.

For now the request gives us all operations available on
controller/device and that will be fixed as part of NETCONF-928.

JIRA: NETCONF-929
Change-Id: Ia45ec624640b7b75416071f7675088c2bdab3091
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfOperationsServiceImpl.java

index 5fc5155d4b1c8e08293a7ef11afd4a59c7277b95..1f993eafb85be2681ac5b101038bc8eab6a533fc 100644 (file)
@@ -23,15 +23,11 @@ import org.opendaylight.mdsal.dom.api.DOMMountPoint;
 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
 import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
-import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
 import org.opendaylight.restconf.nb.rfc8040.databind.DatabindProvider;
 import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload;
 import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfOperationsService;
-import org.opendaylight.restconf.nb.rfc8040.utils.RestconfConstants;
 import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier;
 import org.opendaylight.yangtools.yang.common.Empty;
-import org.opendaylight.yangtools.yang.common.ErrorTag;
-import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.builder.DataContainerNodeBuilder;
@@ -78,14 +74,6 @@ public class RestconfOperationsServiceImpl implements RestconfOperationsService
 
     @Override
     public NormalizedNodePayload getOperations(final String identifier, final UriInfo uriInfo) {
-        if (!identifier.contains(RestconfConstants.MOUNT)) {
-            final var errMsg = """
-                    URI has bad format. If operations behind mount point should be showed, URI has to end with %s.
-                    """.formatted(RestconfConstants.MOUNT);
-            LOG.debug("{} for {}", errMsg, identifier);
-            throw new RestconfDocumentedException(errMsg, ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE);
-        }
-
         final InstanceIdentifierContext mountPointIdentifier = ParserIdentifier.toInstanceIdentifier(identifier,
             databindProvider.currentContext().modelContext(), Optional.of(mountPointService));
         final DOMMountPoint mountPoint = mountPointIdentifier.getMountPoint();