JSON output from maapi_save_config

I’m trying to save the output of a call to maapi_save_config in JSON and despite all APIs suggesting the call succeeded I’m not able to actually retrieve any output after calling “recv” on my stream socket. I’m able to successfully call maapi_save_config and retrieve information in all other formats (MAAPI_CONFIG_XML, MAAPI_CONFIG_XML_PRETTY, MAAPI_CONFIG_J, MAAPI_CONFIG_C, MAAPI_CONFIG_C_IOS). Is “MAAPI_CONFIG_JSON” supported in ConfD basic?

JSON output format is supported in ConfD Basic.

You can have a look at the confd_load command: confd_load -F o … saves config in JSON-format.

The source code for confd_load can be found in <confd_dir>/src/confd/tools

But this doesn’t seem to work in ConfD Basic. It could be that since neither REST or WebUI are included in ConfD Basic, that the support for JSON is not included. This does work, as Jonas suggested, in ConfD Premium.

Scratch that. I had an error in my paths and was running ConfD Premium when I thought I was running ConfD Basic…

Correct. If I read this ConfD error message correctly ConfD Basic can’t find the rest_utils Erlang module:

...
** Reason for termination ==
** {'module could not be loaded',
       [{rest_utils,ikeypath2uri,
            [[['http://tail-f.com/ns/example/dhcpd'|dhcp]],
            ...

This module is only available in ConfD Premium.

Thanks for the responses Jonas and Greg. I had a friend run a quick test for me on his version of premium and it looks like the JSON output is much too slow for my needs anyway so I’ll simply operate on XML data.

For the curious: the particular path in his model that he queried took 37s to response for JSON output and only 1.1 for XML. I need my data in JSON but at those speeds it would be faster for me to do the conversion myself.

I believe that according to the benchmark rulebook the curious also deserve a benchmark setup description + YANG model + sample data to be able to reproduce your findings.

Unfortunately the data model is proprietary and since this was an off-the-cuff test on my behalf I have no idea what the sample data looked like. Even if speed weren’t a factor the inconsistency of being able to only retrieve data using JSON (via maapi_save_config) but not set data using JSON (via maapi_load_config) is enough to make me revert to manually doing XML <> JSON conversions myself. If this is merely an oversight in the manual and you can in fact call maapi_load_config with JSON then I might revisit the possibility of using JSON directly. If/when this happens I would be happy to share a more extensive benchmark setup and findings.