Closed Kendaii closed 1 year ago
Not a dumb question and you can look at how the CLI checks the reply type, similarly. I agree it is a bit unexpected that you have to "manually" check the reply type but it seemed redundant to add some special function or something like that. You can be certain that the returned reply is valid so the DFS loop is not needed, the ok
reply can only have that single element I believe.
Thank you for your quick response, if anybody has the same question here is the answer (I was not too far) :
if (!strncmp(LYD_NAME(lyd_child(envelope)), "ok", 2))
printf("RESPONSE IS OK\n");
I'm working on a client and server NETCONF both using libnetconf2 & libyang. Everything is working fine but on the client side, I find difficult to distinguish success rpc-reply :
from error :
RPC methods are custom and do not send any output data (
op
is empty). I can't use libyang XPath methods to validate message as I understand that rpc-reply definition is NETCONF specific and do not appears in any yang file.For now I iterate over envelope data to find an
ok
tag as follow, but maybe there is a better way than that :I apologize in advance if my question is dumb but I couldn't find an answer in documentation or github issues.