Project

General

Profile

Feature #2964

Updated by Junxiao Shi almost 9 years ago

Develop `infoedit`, a programmatic INFO-format configuration file editor for use in [[IntegrationTests]]. 

 **Background** 

 Many scenario requires editing the NFD configuration file. 
 There are two approaches: 

 * Embed a complete NFD configuration file in the scenario code. 
     * Benefit: The complete configuration file is visible. 
     * Drawback: It's not obvious what are the significant changes that differ from the default configuration. 
     * Drawback: When NFD configuration file introduces a backwards-incompatible change, scenarios designed in this way will be broken. 
 * Use an `awk` or `sed` script to modify the default configuration file. 
     * Benefit: It's easy to see what changes are needed. 
     * Drawback: To perform a complex modification, the script gets tricky and becomes unreadable. 
     * Drawback: Neither `awk` nor `sed` understands INFO format, so the script isn't robust to formatting changes. 

 **Feature** 

 This feature is to develop `infoedit`, a command line utility that programmatically edits a configuration file. 

 Command line options: 

 * `-f file`: specifies a file to edit 
 * `-s path`: specifies a property-tree path to modify 
 * `-v value`: used with `-s path`, sets the value at the path 
 * `-d path`: deletes all subtrees matching the path 
 * `-a path`: adds a subtree at the path; the subtree is read from stdin 
 * `-r path`: replaces a subtree at the path; equivalent to `-d path` followed by `-a path` 

 Every invocation performs one edit. 
 The file is modified in place. 
 To perform multiple edits, invoke the utility multiple times on the same file. 

 Sample command lines: 

 ``` 
 ./infoedit -f nfd.conf -s general.user -v ndn.user 
 ./infoedit -f nfd.conf -s tables.strategy_choice./site -v /localhost/nfd/strategy/broadcast 
 ./infoedit -f nfd.conf -d tables.strategy_choice./ 
 ./infoedit -f nfd.conf -d authorizations 
 ./infoedit -f nfd.conf -a rib.localhost_security <<<EOT 
   trust-anchor 
   { 
     type any 
   } 
 EOT 
 ``` 

 **Placement** 

 `infoedit` design is tailored to integration tests. 
 It should live in integration-tests repository, and compiled in a step of `install_apps.py`.

Back