Create Config Tool
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
- Use argparse and argcomplete. Both are provided in the DDS.
- Use lxml and if possible ddci_xml.py which aids managing XSD versioning.
- Make sure you have a well documented XSD
- This aids the config tool development by automating input parsing tasks
- Most IDEs have tools that provide help when editing the XML.
- All tools evolve or die. Consider how your data might evolve.
- Have a versioned XSD.
- Encode the (major/minor) version in the namespace.
- The conversion of one version of an input XML to another is called "upconverting".
- (Try to?) Track the source file of data.
- This both assists the CVT and also helps the user to know where data came from.
- 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.
- .s file helps to show the intermediate structure.
- .s file aids tests that need to inject faults/end conditions.
- 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.
- 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.