Creating Reports with Custom Output Formats

The report output module uses its parameter as the name of a Jinja2 formatting template that is used to create a custom report. For example, netlab create -o report:addressing creates an IP addressing report.

The report output module tries to use the defaults.outputs.report.rname topology setting (rname is the report name). If that fails, it tries to read the Jinja2 template from rname.j2 file in reports subdirectory of current directory, user netlab directory (~/.netlab), system netlab directory (/etc/netlab) and netlab package directory.

Built-In Reports

netlab ships with the following built-in reports:

  • addressing – Node/interface addressing report in text format

  • addressing.html – Node/interface and link/interface addressing report in HTML format

  • addressing.node.html – Node/interface addressing report in HTML format

  • addressing.link.html – Link/interface addressing report in HTML format

Note

The netlab show reports command displays up-to-date list of available system reports

Generating HTML reports

If a report name includes .html, netlab assumes the template generates HTML markup and adds HTML wrapper generated from page.html.j2 to the generated text. The page.html.j2 template included with netlab contains the head and body HTML tags and a simple CSS style definition.

If you want to customize the HTML reports, add page.html.j2 to one of the user directories the reports module searches when trying to locate the template file (see above). Your HTML wrapper might include inline CSS (using the style tag) or a link to an external stylesheet.