ConfD User Community

Is there a way to get the schema tree structure from Confd?

When the client send the schema netconf request to confd

<rpc message-id="101"
     xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <get>
    <filter type="subtree">
      <netconf-state xmlns=
      "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
        <schemas/>
      </netconf-state>
    </filter>
  </get>
</rpc>

The confd will response with all sachems (maybe part of based on Confd configuration) it currently loaded.
Then the specific schema can be get thru “get-schema” request, e.g:

   <rpc message-id="101"
     xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <get-schema
     xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
       <identifier>foo</identifier>
       <version>1.0</version>
       <format>xsd</format>
     </get-schema>
   </rpc>

Then this schema contents (which should be content of this yang file) will be response.
However, these two responses just provide the raw schema to client. If client need to get the tree structure of all schemas (the tree structure loaded in Confd memory, can be shown in confd_cli), we still need some tools to parse the schema. E.g.: ( pyang -f tree )

In this case, since Confd already has the schema tree structure in its memory (which I think Confd build this tree structure in memory after it load compiled fxs files), I wonder whether there is a way to request the Confd to response the completed schema tree structure to client, e.g. in XML format (I think the tree structure can be easily represented as a XML file)?

If not, whether Tailf will consider adding this functionality in future release ? If not, why ?

Thanks in advance.

I can’t comment on if or why it will or will not be added. But I’d say it’s fairly easy to implement very simple get-tree action yourself: just pre-render all YANG modules, store them in a directory on your device and a short shell script can serve them as a response to the action invocation.

Another possibility, especially in case the “combined” schema of all modules including augments and deviations is wanted, might be to use (at runtime) the schema that can be loaded via e.g. confd_load_schemas() - which is precisely the “combined” schema that ConfD uses internally, although not all the details of the ConfD-internal schema are present.

See the USING SCHEMA INFORMATION section in the confd_types(3) man page for the details - and perhaps the ‘confd_cmd -c dump_schema’ command for “inspiration” (the implementation source can be found in $CONFD_DIR/src/confd/tools/confd_cmd.c).

Thank you for the opinions!