ConfD User Community

Why does this action encoder function work?


I am working in a project which I try to use tailf. JNC package. I try to create action request and I can see JNC has the API : NetconfSession.action().
When I dig into the function and I can see there is an encoding function : encode_action().

void encode_action(Transport out, Element data) throws JNCException {
        final String prefix = Element.defaultPrefixes.nsToPrefix(Capabilities.NS_ACTIONS);
        final String act = mk_prefix_colon(prefix);
        final String xmlnsAttr = mk_xmlns_attr(prefix, Capabilities.NS_ACTIONS);
        out.println("<" + act + "action " + xmlnsAttr + ">");
        out.print("<" + act + "data>");
        out.println("</" + act + "data>");
        out.println("</" + act + "action>");

But the request xml tag inside this function doesn’t comply with the netconf action XML Encoding Rule

But I try and it actually work with confd 6.6.1. Any idea why ? Is there any other version of XML encoding rule for “action” ?


Any idea how the action encoder can work?


This is the encoding required by tailf:action custom extension. The old standard YANG 1.0 (RFC 6020) defined only rpc for custom RPCs, and they could be used only on the top level; ConfD introduced the extension to allow custom RPCs to be defined anywhere in the data model. The requirements of tailf:action and action are almost identical, one notable difference is the XML encoding, but ConfD obviously accepts the standard as well as the custom variant.


Thank you for explanation. OK, this explain why this encoder also works for “action”.
Since this a custom RPCs in Confd extension, is that possible later version Confd won’t accept the custom variant any more ?


The custom tailf:action is going to stay for long and the corresponding encoding too, that’s for sure. The question is if developers do not decide to require that the encoding matches the actual data model, so if you are using 1.1 models with the standard action, you might lose ability to invoke actions with JNC (or maybe not, I really do not know). On the other hand: JNC is open source, and as far as I can tell, it should not be difficult to add a method NetconfSession.rfc_action or something along these lines. I’m pretty sure such contribution would be more than welcome by the maintainer.