[CONTROLLER-1364] Can not invoke zero argument RPC exposed by a Netconf device mounted on ODL using Restconf Created: 09/Jun/15  Updated: 17/Jun/15  Resolved: 17/Jun/15

Status: Verified
Project: controller
Component/s: restconf
Affects Version/s: Lithium
Fix Version/s: None

Type: Bug
Reporter: Balaji Varadaraju Assignee: Vaclav Demcak
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Issue Links:
Duplicate
is duplicated by CONTROLLER-1242 calling RESTCONF RPC requires Content... Resolved
External issue ID: 3650
Priority: Normal

 Description   

If I invoke an RPC that takes zero arguments exposed by a Netconf device, I am getting the error below. This is not the case with the RPCs that takes some input arguments.

java.lang.NullPointerException
at org.opendaylight.controller.sal.rest.impl.NormalizedNodeJsonBodyWriter.writeTo(NormalizedNodeJsonBodyWriter.java:72)
at org.opendaylight.controller.sal.rest.impl.NormalizedNodeJsonBodyWriter.writeTo(NormalizedNodeJsonBodyWriter.java:45)
at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1479)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1496)
at org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:247)
at org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:210)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1467)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:69)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:240)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:75)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:745)



 Comments   
Comment by Balaji Varadaraju [ 09/Jun/15 ]

Wanted to add this is a zero input RPC but it provides some output. So looks like we have an error while processing the output.

Comment by Tom Pantelis [ 10/Jun/15 ]

I assume it's getting into the RestconfImpl#invokeRpc method that takes the "noPayload" string.

final ContainerSchemaNode rpcDataSchemaNode =
SchemaContextUtil.getRpcDataSchema(schemaContext,
rpc.getOutput().getPath());
resultNodeSchema = rpcDataSchemaNode.getDataChildByName(
result.getResult().getNodeType());

It seems that resultNodeSchema is null. However I don't understand why this code is needed when the RpcDefinition was already found earlier. Why doesn't it just use that RpcDefinition for resultNodeSchema? The NormalizedNodeXmlBodyWriter and NormalizedNodeJsonBodyWriter check for schemaPath instanceof RpcDefinition and use the output schema path.

Comment by Tony Tkacik [ 10/Jun/15 ]

Seems as left-over of some refactor:

first call:
final ContainerSchemaNode rpcDataSchemaNode =
SchemaContextUtil.getRpcDataSchema(schemaContext,
rpc.getOutput().getPath());

Should return rpc/output container

Second call: tries to look up output in rpc/output container instead of RPC.

So it seems the resultNodeSchema should be simply = rpc.getOutput()

resultNodeSchema = rpcDataSchemaNode.getDataChildByName(
result.getResult().getNodeType());

Will try to replicate and verify.

Comment by Tom Pantelis [ 10/Jun/15 ]

Actually when I tried it with a no-input rpc with output, the code path was not thru the "noPayload" method but thru the NormalizedNodeContext ("with payload") method and getData() was null. The rpc worked correctly.

I'll debug it with Bala to see the code path for his failed mounted rpc.

Comment by Vaclav Demcak [ 15/Jun/15 ]

https://git.opendaylight.org/gerrit/#/c/22573/

Generated at Wed Feb 07 19:55:21 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.