edward6018 / libnetconf

Automatically exported from code.google.com/p/libnetconf
Other
0 stars 0 forks source link

Cannot use list as RPC input for my own module #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Add a new module in netopeer-sl, it defines a RPC with a list as input. eg: 
{ rpc get-port-stats {
     input {
      list port {
        .....
      }
      ....
     }
}

2. Use lnctool to generate transapi and implement the RPC, then build and 
install the module, restart the sshd server.   

3. use netopeer-cli to test the rpc, use user-rpc for test, message is
<get-port-stats xmlns="mynamespace">
<port>something</port>
<port>something otehr</port>
<port>something else</port>
</get-port-stats>

What is the expected output? What do you see instead?
I want to see all the port statistics in my input list, however
i only get the statistics of the last port in the list. 

What version of the product are you using? On what operating system?
some earlier version, Linux.  

Please provide any additional information below.
I checked the root cause, i found codes like this(libnetconf/src/datastore.c, 
line 6111) 
nc_reply* ncds_apply_rpc(ncds_id id, const struct nc_session* session, const 
nc_rpc* rpc)
{
...
   case NC_OP_UNKNOWN:
       ....
       /* copy xmlnode to the input arg list */
   ....
...
}

if the xml nodes are in a node list, the code above will repeat several times 
and the arg[] only stores the last one. 
In my example, only "<port>something else</port>" is  passed to my module, then 
i only got the last port's statistics. 

In my opinion, we should use xmlCopyNodeList instead of xmlCopyNode, and we 
should set the right step while copying, or may occur unexpected error. 

Original issue reported on code.google.com by xunl...@gmail.com on 28 Nov 2014 at 5:05

GoogleCodeExporter commented 9 years ago
Is there any limitation that we cannot use list as RPC input?

Original comment by xunl...@gmail.com on 28 Nov 2014 at 5:08

GoogleCodeExporter commented 9 years ago
There should be no limitation (conforming to 
https://tools.ietf.org/html/rfc6020#section-7.13.2.1), we will fix it.

Original comment by mv6...@gmail.com on 8 Dec 2014 at 8:43

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 293aca1a75ba.

Original comment by mv6...@gmail.com on 9 Dec 2014 at 12:00

GoogleCodeExporter commented 9 years ago
RPC parameters were changed significantly and should enable any parameters. 
Currently found in a separate branch transapiv6, should be merged into the 
master soon.

Original comment by mv6...@gmail.com on 9 Dec 2014 at 12:01