Switch NFD configuration file format
The INFO format currently in use for NFD config files is specific to the Boost Property Tree library, instead of being in a standard format. As such, we have had to develop a specific tool (infoedit) to programmatically edit config files in integration tests. Therefore, it would be good to switch to a more popular and standardized format, such as TOML, YAML, or JSON.
Updated by Eric Newberry 3 months ago
Davide Pesavento wrote:
Eric Newberry wrote:
One concern with TOML is that there doesn't appear to be any command-line tool to edit TOML files as of yet.
I see. This one must be newer than the article I read saying there was none. This one looks like it's written in Rust, which would add another dependency for the integration tests, although I imagine it would be not terribly difficult to write our own tool in C++ or Python (but that doesn't resolve the existing issue with INFO that I mentioned in the issue description). I also found one written in Node: https://github.com/chrisdickinson/toml-cli
However, since such a tool is available, my preference is also for TOML - I think it has the most readable syntax of the three and can handle nested sections.
Updated by Junxiao Shi 3 months ago
Given all three languages are JSON compatible, you should always provide a JSON schema, and NFD should validate the document against the JSON schema before proceeding.
Using schema validation can eliminate a lot of complexities in parsing, such as "negative port number", "string as port number", "prefix propagation and /localhop/nfd/rib cannot be enabled at the same time".
There's no way to insert comments in standard JSON.
JSON with comments can be an option.
Editing TOML on command line doesn't require compiling tools during deployment:
tomljsonfrom go-toml to convert TOML to JSON.
- Use jq to edit JSON.
jsontomlfrom go-toml to convert JSON to TOML.
jq has Ubuntu packages.
go-toml can be pre-compiled once and anyone can
wget them. Go binaries are statically linked and will work on all versions of Linux or macOS.
A drawback of TOML is that, JSON document is not valid TOML document, so that tools that produce JSON must be filtered through
YAML is a classical configuration format.
Its benefit is that, machine generated configuration files can use JSON, and all YAML parsers will accept them.
However, YAML is too complicated and human can make mistakes.