[CONTROLLER-556] Restconf RPC operations (POST /restconf/operations/<moduleName>:<rpcName>) will not handle the errors set in the RpcResult and returns Status 204 (No Content) Created: 10/Jun/14  Updated: 25/Jul/23  Due: 26/Jun/14  Resolved: 25/Jun/14

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

Type: Bug
Reporter: Mallikarjun Assignee: Jozef Gloncak
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Windows
Platform: PC


External issue ID: 1179

 Description   

Problem:
Restconf RPC operations (POST /restconf/operations/<moduleName>:<rpcName>) will not handle the errors set in the RpcResult and returns Status 204 (No Content).

I have my RPC implementation not to throw exceptions in case of failure but return the result for RPC with errors and successful flag set accordingly.

For example, my RPC returns the following.
return Futures.immediateFuture(Rpcs.<output> getRpcResult(isSuccessful, output, errors));

In case of failures, I am setting the isSuccessful to false and adding the RpcError to the errors collection with error code and cause etc. But, the restconf response for the RPC is Status 204 (No Content). It looks like restconf may not be looking at the errors in the RpcResult and just looking at the output.



 Comments   
Comment by Jozef Gloncak [ 23/Jun/14 ]

I investigated code. In artifact sal-rest-connector there is RestconfImpl.callRpc which is handling calls which you mentioned

POST /restconf/operations/<moduleName>:<rpcName>

This method is calling checkRpcSuccessAndThrowException method which check whether RpcResult instance is|isn't true. If it is false then also collection of errors is checked and RestconfDocumentedException is raised accordingly.

There are also tests which checks that returning code in case when RpcResult.isSuccessful == false is 500:

  • RestPostOperationTest.postOperationsStatusCodes.

Additionally raising of RestconfDocumentedException is tested in InvokeRpcMethodTest testing class under tests:

  • testInvokeRpcWithNoPayloadRpc_FailWithRpcError()
  • testInvokeRpcWithNoPayloadRpc_FailNoErrors()

Currently from my point of view I can't reproduce the error which you have mentioned. So if your problem still persist please provide more details or steps which have to be done to reproduce this problem.

Comment by Jozef Gloncak [ 23/Jun/14 ]

Test for checking of returning value when rpcResult contains collection errors was added
https://git.opendaylight.org/gerrit/#/c/8236/

Comment by Tony Tkacik [ 25/Jun/14 ]

Please reopen with simple minimalistic code, which will trigger behaviour which you are describing.

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