[CONTROLLER-925] Race condition when adding a RPC implementation with an output Created: 07/Oct/14  Updated: 19/Jan/15  Resolved: 19/Jan/15

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

Type: Bug
Reporter: Sharon Aicler Assignee: Jan Hajnar
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Attachments: Zip Archive sal-example.zip    
External issue ID: 2157

 Description   

When you add a RPC Service Implementer that contains an output reply, there is no error. However, when you try to use this RPC you get a message it does not exist.

When doing the following lines in your module's "createInstance" method:
"getRpcRegistryDependency().addRpcIplementation(Service class,implementer)"
No error is thrown, however when you try to use the RPC call you get a reply error is the Rest Client that this method is not implemented. Putting this registration inside a thread that sleeps for 15 seconds before doing the line above solves the issue.



 Comments   
Comment by Sharon Aicler [ 07/Oct/14 ]

unzip the project under md-sal, it will create the "sal-example" directory.
"mvn clean install"
the configuration file for "configure/initial" dir in under "src/main/resources"

once the controller is up, to invoke the rpc please use the following:

url:
http://localhost:8080/restconf/operations/example:create-rec
body:
{
"input" :

{ "example:name" : "hello", "example:family":"world" }

}

you should get an error that this method is not implemented.

to make it work:
go to MyExampleModule and unmark line 36 (the sleep of 10 seconds inside the thread).
if you compile and install the new jar, the RPC will work

Comment by Sharon Aicler [ 07/Oct/14 ]

Attachment sal-example.zip has been added with description: An example project that reproduce the issue

Comment by Tony Tkacik [ 08/Oct/14 ]

The registration of RPC to DOM broker in org.opendaylight.controller.sal.binding.impl.connect.dom.DomToBindingRpcForwarder

uses org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl#getRpcQNamesFor(...,...) to retrieve QNames.

THis method should block thread and wait for schema if unavailable, but currently it returns empty set if schema is still not present, which prevents exposing RPCs to DOM Broker and by extension to Restconf and Clustering.

Comment by Jan Hajnar [ 12/Nov/14 ]

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

Comment by Jan Hajnar [ 12/Nov/14 ]

Please ignore the change above

fix:
https://git.opendaylight.org/gerrit/#/c/12786/

Comment by Robert Varga [ 08/Dec/14 ]

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

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