[NETCONF-794] RESTCONF provide wrong DOMDataTreeIdentifier path for Actions when is invoke Created: 27/Jul/21  Updated: 06/Aug/21  Resolved: 06/Aug/21

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

Type: Bug Priority: Medium
Reporter: Peter Suna Assignee: Ivan Hrasko
Resolution: Won't Do Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When Action is invoked through RESTCONF, it will provide wrong DOMDataTreeIdentifier path for specific Action. This path will point to the parent of called Action.

https://github.com/opendaylight/mdsal/blob/master/dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/DOMRpcRouter.java#L546
entry.getImplementations(path).get(0).invokeAction(type, path, input)

path = DOMDataTreeIdentifier{datastore=OPERATIONAL, root=/(instance:identifier:module?revision=2014-01-17)cont/cont1}

Registered implementation key is:
DOMDataTreeIdentifier{datastore=OPERATIONAL, root=/(instance:identifier:module?revision=2014-01-17)cont/cont1/reset}



 Comments   
Comment by Ivan Hrasko [ 05/Aug/21 ]

According to javadoc of org.opendaylight.mdsal.dom.api.DOMActionService#invokeAction
the path argument expects the "DOMDataTreeIdentifier of parent data node which action attached to".

In the next iteration of test patch we were able to register and invoke the Reset action.
But we have found a problem in processing of the action result - there is a mismatch
between RpcResult returned by:

org.opendaylight.yangtools.yang.binding.Action#invoke

and DOMActionResult expected by:
org.opendaylight.mdsal.dom.api.DOMActionImplementation#invokeAction

There are two possibilities:
1. we have to create DOMActionResult from returned RpcResult in:

org.opendaylight.restconf.nb.rfc8040.rests.utils.ActionResultFactory

2. we have to rework org.opendaylight.yangtools.yang.binding.Action class
and possibly other things as well in msal and yangtools.

Comment by Ivan Hrasko [ 06/Aug/21 ]

In the third iteration of test we have found a way how to translate RpcResult into DOMActionResult using codec.

It a responsibility of action implementation to do so.

Comment by Ivan Hrasko [ 06/Aug/21 ]

During testing we have found only issue that exception is thrown when action output is empty. This behavior is not according to RFC 8040 which states that in case of rpc/action with no output response with status code 204 and empty body should be returned without any errors.

Comment by Ivan Hrasko [ 06/Aug/21 ]

This bug is invalid. We have created another one for the problem when action has no output: https://jira.opendaylight.org/browse/NETCONF-799.

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