[NETCONF-782] RestconfDocumentedExceptionMapper unable to map exceptions from mounted devices when path points to a module not in the global SchemaContext Created: 01/Jun/21  Updated: 19/Sep/23  Resolved: 15/Sep/23

Status: Resolved
Project: netconf
Component/s: restconf-nb
Affects Version/s: None
Fix Version/s: 7.0.0

Type: Bug Priority: Medium
Reporter: Tomas Cere Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Blocks
is blocked by MDSAL-665 Document yang-ext:mount extension Resolved
is blocked by NETCONF-783 Use yang-ext:mount in NETCONF topology Resolved
is blocked by YANGTOOLS-1295 Add support for yang-ext:mount instan... Resolved
Duplicate
is duplicated by NETCONF-1130 (devices) POST returns 500 on data al... Resolved
Relates
relates to YANGTOOLS-1012 Improve RFC8528/RFC8525 parsing inter... Confirmed
relates to YANGTOOLS-1267 Add support for parsing JSON containi... Confirmed

 Description   

Found while testing fix for NETCONF-777.

Looks like exception mapper cannot serialize error response when module present on a mounted device is not present in the global schema context.

When deleting non-existent data on a device we should get a response like:

{
    "errors": {
        "error": [
            {
                "error-path": "/cars:cars",
                "error-type": "protocol",
                "error-tag": "data-missing",
                "error-message": "Data does not exist"
            }
        ]
    }
}

Instead we get a response with status 500 and an exception in karaf log that the error-path element cannot be serialized:

2021-06-01T11:01:06,718 | ERROR | qtp2140523289-441 | ServerRuntime$Responder          | 179 - org.glassfish.jersey.core.jersey-server - 2.27.0 | An exception has been thrown from an exception mapper class org.opendaylight.restconf.nb.rfc8040.jersey.providers.errors.RestconfDocumentedExceptionMapper.
java.lang.IllegalArgumentException: Invalid input /(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:cars?revision=2014-03-13)cars: schema for argument (urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:cars?revision=2014-03-13)cars (after ) not found
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:459) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.util.AbstractStringInstanceIdentifierCodec.serializeImpl(AbstractStringInstanceIdentifierCodec.java:41) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.util.AbstractStringInstanceIdentifierCodec.serializeImpl(AbstractStringInstanceIdentifierCodec.java:31) ~[bundleFile:?]
	at org.opendaylight.yangtools.concepts.AbstractCodec.serialize(AbstractCodec.java:34) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.codec.gson.JSONInstanceIdentifierCodec.writeValue(JSONInstanceIdentifierCodec.java:74) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.codec.gson.JSONInstanceIdentifierCodec.writeValue(JSONInstanceIdentifierCodec.java:25) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter.writeValue(JSONNormalizedNodeStreamWriter.java:431) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter.scalarValue(JSONNormalizedNodeStreamWriter.java:413) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.api.schema.stream.ForwardingNormalizedNodeStreamWriter.scalarValue(ForwardingNormalizedNodeStreamWriter.java:112) ~[bundleFile:?]
	at org.opendaylight.restconf.nb.rfc8040.jersey.providers.errors.StreamWriterWithDisabledValidation.scalarValue(StreamWriterWithDisabledValidation.java:59) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter.wasProcessAsSimpleNode(NormalizedNodeWriter.java:147) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter.write(NormalizedNodeWriter.java:107) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter.writeChildren(NormalizedNodeWriter.java:190) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter.wasProcessedAsCompositeNode(NormalizedNodeWriter.java:219) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter.write(NormalizedNodeWriter.java:103) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter.writeChildren(NormalizedNodeWriter.java:190) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter.wasProcessedAsCompositeNode(NormalizedNodeWriter.java:234) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter.write(NormalizedNodeWriter.java:103) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter.writeChildren(NormalizedNodeWriter.java:190) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter.wasProcessedAsCompositeNode(NormalizedNodeWriter.java:206) ~[bundleFile:?]
	at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter.write(NormalizedNodeWriter.java:103) ~[bundleFile:?]
	at org.opendaylight.restconf.nb.rfc8040.jersey.providers.errors.RestconfDocumentedExceptionMapper.writeNormalizedNode(RestconfDocumentedExceptionMapper.java:206) ~[bundleFile:?]
	at org.opendaylight.restconf.nb.rfc8040.jersey.providers.errors.RestconfDocumentedExceptionMapper.serializeErrorsContainerToJson(RestconfDocumentedExceptionMapper.java:181) ~[bundleFile:?]
	at org.opendaylight.restconf.nb.rfc8040.jersey.providers.errors.RestconfDocumentedExceptionMapper.toResponse(RestconfDocumentedExceptionMapper.java:105) ~[bundleFile:?]
	at org.opendaylight.restconf.nb.rfc8040.jersey.providers.errors.RestconfDocumentedExceptionMapper.toResponse(RestconfDocumentedExceptionMapper.java:58) ~[bundleFile:?]
	at org.glassfish.jersey.server.ServerRuntime$Responder.mapException(ServerRuntime.java:552) ~[?:?]
	at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:427) ~[?:?]
	at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:285) ~[?:?]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272) ~[?:?]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268) ~[?:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:316) ~[?:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:298) ~[?:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:268) ~[?:?]
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:289) ~[?:?]
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:256) ~[?:?]
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:703) ~[?:?]
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:416) ~[?:?]
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:370) ~[?:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389) ~[?:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:342) ~[?:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:229) ~[?:?]
	at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1443) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:791) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1626) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:319) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:273) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[bundleFile:9.4.38.v20210224]
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) ~[?:?]
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) ~[?:?]
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) ~[?:?]
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) ~[?:?]
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) ~[?:?]
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) ~[?:?]
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) ~[?:?]
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) ~[?:?]
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) ~[?:?]
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) ~[?:?]
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) ~[?:?]
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) ~[?:?]
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:228) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548) ~[bundleFile:9.4.38.v20210224]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) ~[bundleFile:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:602) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435) ~[bundleFile:9.4.38.v20210224]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:294) ~[bundleFile:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[bundleFile:9.4.38.v20210224]
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:82) ~[bundleFile:?]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.server.Server.handle(Server.java:516) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633) [bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380) [bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:279) [bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) [bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) [bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) [bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) [bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) [bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:383) [bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882) [bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036) [bundleFile:9.4.38.v20210224]
	at java.lang.Thread.run(Thread.java:834) [?:?]
	Suppressed: java.io.IOException: Unexpected root context JSONStreamWriterObjectContext{}
		at org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter.closeWriter(JSONNormalizedNodeStreamWriter.java:402) ~[bundleFile:?]
		at org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter$Exclusive.close(JSONNormalizedNodeStreamWriter.java:66) ~[bundleFile:?]
		at org.opendaylight.yangtools.yang.data.api.schema.stream.ForwardingNormalizedNodeStreamWriter.close(ForwardingNormalizedNodeStreamWriter.java:122) ~[bundleFile:?]
		at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter.close(NormalizedNodeWriter.java:122) ~[bundleFile:?]
		at org.opendaylight.restconf.nb.rfc8040.jersey.providers.errors.RestconfDocumentedExceptionMapper.writeNormalizedNode(RestconfDocumentedExceptionMapper.java:205) ~[bundleFile:?]
		at org.opendaylight.restconf.nb.rfc8040.jersey.providers.errors.RestconfDocumentedExceptionMapper.serializeErrorsContainerToJson(RestconfDocumentedExceptionMapper.java:181) ~[bundleFile:?]
		at org.opendaylight.restconf.nb.rfc8040.jersey.providers.errors.RestconfDocumentedExceptionMapper.toResponse(RestconfDocumentedExceptionMapper.java:105) ~[bundleFile:?]
		at org.opendaylight.restconf.nb.rfc8040.jersey.providers.errors.RestconfDocumentedExceptionMapper.toResponse(RestconfDocumentedExceptionMapper.java:58) ~[bundleFile:?]
		at org.glassfish.jersey.server.ServerRuntime$Responder.mapException(ServerRuntime.java:552) ~[?:?]
		at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:427) ~[?:?]
		at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:285) ~[?:?]
		at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272) ~[?:?]
		at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268) ~[?:?]
		at org.glassfish.jersey.internal.Errors.process(Errors.java:316) ~[?:?]
		at org.glassfish.jersey.internal.Errors.process(Errors.java:298) ~[?:?]
		at org.glassfish.jersey.internal.Errors.process(Errors.java:268) ~[?:?]
		at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:289) ~[?:?]
		at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:256) ~[?:?]
		at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:703) ~[?:?]
		at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:416) ~[?:?]
		at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:370) ~[?:?]
		at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389) ~[?:?]
		at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:342) ~[?:?]
		at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:229) ~[?:?]
		at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1443) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:791) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1626) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:319) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:273) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[bundleFile:9.4.38.v20210224]
		at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) ~[?:?]
		at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) ~[?:?]
		at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) ~[?:?]
		at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) ~[?:?]
		at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) ~[?:?]
		at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) ~[?:?]
		at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) ~[?:?]
		at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) ~[?:?]
		at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) ~[?:?]
		at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) ~[?:?]
		at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) ~[?:?]
		at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) ~[?:?]
		at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:228) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548) ~[bundleFile:9.4.38.v20210224]
		at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) ~[bundleFile:?]
		at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:602) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435) ~[bundleFile:9.4.38.v20210224]
		at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:294) ~[bundleFile:?]
		at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[bundleFile:9.4.38.v20210224]
		at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:82) ~[bundleFile:?]
		at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.server.Server.handle(Server.java:516) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388) ~[bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633) [bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380) [bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:279) [bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) [bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) [bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) [bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) [bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) [bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:383) [bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882) [bundleFile:9.4.38.v20210224]
		at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036) [bundleFile:9.4.38.v20210224]

It looks like the json stream writer used in the exception mapper is using global schema context while serializing the path and if it doesnt contain the module from the device it fails.



 Comments   
Comment by Robert Varga [ 09/Jun/21 ]

This is actually a bit more complicated than it seems. The problem is really the fact the instance identifier is in the device scope, so really we should be reconstituting it to include the leading part, including yang-ext:mount, I think. The trouble with that is, of course, JSON/XML codecs do not support that sort of a mountpoint and probably do not integrate with InstanceIdentifier codec.

Comment by Robert Varga [ 28/Oct/21 ]

So this is error reporting of a well-known construct, which we need to be translating to an anydata value.
What RESTCONF should be doing here is creating a NormalizableAnydataNode, which is backed by whatever we have received from the device.
Once a conforming (JSON is not, I think) yang-data-codec-* hits this anydata node, it will invoke it with whatever EffectiveModelContext knowledge it has. When this happens, we should prepend the instance identifier with the DOMMountPoint identifier we have executed on, including the container where ext:mount is placed.
The second part of the trick is that the model which hosts yang-ext:mount must be enriched with an RFC8528 extension.
The finale is that when talking to the XML/JSON codec, we also supply it with a MountPointContext, which supplies the device's EffectiveModelContext when asked for a MountPoint.

With this, the identifier will be stitched without there being a yang-ext:mount-point thing in the picture.

Comment by Robert Varga [ 15/Sep/23 ]

The solution would be overly-complex. The document we are serving is a controller NB thing and the caller knows the mountpoint prefix – so they should supply that themselves.
If we were to prepend the paths, it would make it seem like we support operations across devices (i.e. YANG patch), when we do not.

Generated at Wed Feb 07 20:15:53 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.