Create Config Tool

From DDCIDeos
Jump to navigationJump to search

Suggestions and issues to consider when creating an XML configuration tool.

Typically a configuration tool is needed to convey information, typically in XML format, to an embedded component. To simplify the embedded component the host information is in a binary format suitable to be "read" by the target resident components by just casting a pointer to a C struct to the binary. There are, of course, verification and validation concerns that must be addressed.

Basic Guidance

  1. Use argparse and argcomplete. Both are provided in the DDS.
  2. Use lxml and if possible ddci_xml.py which aids managing XSD versioning.
  3. Make sure you have a well documented XSD
    1. This aids the config tool development by automating input parsing tasks
    2. Most IDEs have tools that provide help when editing the XML.
    3. All tools evolve or die. Consider how your data might evolve.
      1. Have a versioned XSD.
      2. Encode the (major/minor) version in the namespace.
      3. The conversion of one version of an input XML to another is called "upconverting".
  4. (Try to?) Track the source file of data.
    1. This both assists the CVT and also helps the user to know where data came from.
  5. Consider the impact on system integration and cdproc automation.

Generating the Binary

To generate the binary output there are two options: generate .s and use makeconfig, or have the config tool directly generate a binary via cStruct.

  1. .s file helps to show the intermediate structure.
  2. .s file aids tests that need to inject faults/end conditions.
  3. For simple binary output it is fine to use cStruct.

Data Representation

After parsing the XML file, the tool typically needs to do some processing on the input data. How that data is represented in the tool depends on the complexity of the data manipulation.

If the tool is "simple", you are probably better off using lxml findall and xpath to search the XML. If the data manipulation is complex then it is sometimes helpful to parse the data into a database, for example the integration tool uses this approach.

  1. No current guidance on upconverting when using xpath.

When using a database

Avoid parser hooks (that inject new attributes/columns/metadata) because it complicates upconversion

Design for upconvert. Upconvert one version at a time

Configuration Verification Tool

For formal guidance see the cvt-development-howto.

Make sure you know the verification and validation requirements for the generated binary file. DDCI typically provided two two basic types. First kind is a printer that is then compared to an input file or provided to the user to validate. The second kind is a rule based approach to say the file is "good". Sometimes a combination is required.

It is acceptable, sometimes necessary, for a CVT to verify that a different config tool performed correctly in order to assure the respective binary files are mutually consistent.