Overview
Module to produce text files using templates. TTR targets to implement common work flow:
Above approach is fairly simple but powerful enough to address various use cases where structured data need to be transformed in a textual form understandable by targeted system.
TTR uses plugins to load data and templates, render and return results.
Where:
data plugins - load data from various format and transform it in a list of dictionaries
processor plugins - optional step, but can be used to process data before rendering
validation plugins - optional step, used to validate data before rendering it
template loaders - retrieve template content from various sources (files, directories etc.)
renderes - iterate over list of dictionaries data and render each item with template
returners - return rendering results to various destinations, e.g. save to file system
In addition, TTR comes with a collection of Jinja2 templates to help with common use cases, such as generating configuration for network devices interfaces or BGP peers.
On the base level TTR takes list of dictionaries, renders each dictionary with template
defined in template_name_key
and saves rendered data in results dictionary keyed by
result_name_key
. Because of that each dictionary item must contain template_name_key
and result_name_key
keys.
Various plugins can be used to load data in a list of dictionaries with other plugins helping to process and validate it, render and save results.