SSH Template Parser icon

SSH Template Parser

Parse network device output using TextFSM templates. Extract structured data from SSH command outputs with pre-built templates for Aruba, Cisco, and other vendors.

Overview

The SSH Template Parser node is designed to parse network device command outputs using TextFSM templates. It extracts structured data from raw SSH command output text, which is typically unstructured, by applying pre-built or custom templates for various vendors like Aruba, Cisco, Juniper, and generic devices.

This node is beneficial in scenarios where network engineers or automation workflows need to transform raw CLI output into structured JSON data for further processing, reporting, or integration with other systems. For example, it can parse the output of "show interfaces" commands from different network devices and convert them into a consistent JSON format.

The Create Template operation specifically allows users to create new parsing templates either by filling out a form (defining states and regex patterns) or by providing a full template definition as JSON. This enables customization and extension of parsing capabilities for new commands or devices.


Properties

Name Meaning
Template Source Choose how to provide the template: via a form interface ("Form") or by directly inputting the template JSON ("JSON").
Template Name The name of the new template being created. Required when using the form method.
Vendor Select the vendor for which the template applies. Options are Aruba, Cisco, Juniper, or Generic.
Device OS Optional string specifying the device operating system related to the template.
Command The command string that this template is designed to parse.
States A collection of states defining the parsing logic. Each state has:
- State Name: Identifier for the state.
- Patterns: One or more regex patterns with options:
- Regex: The regular expression.
- Flags: Regex flags.
- Emit On Match: Whether to emit a record on match.
- Transition To: Next state after matching.
- Map (JSON): Optional JSON mapping for extracted groups.

| Template JSON | The full template definition as JSON text. Used when "Template Source" is set to "JSON". Allows uploading or creating templates by pasting JSON directly. |


Output

When creating a template, the node returns a JSON object indicating success and details about the stored template:

{
  "ok": true,
  "id": "<template_id>",
  "name": "<template_name>"
}
  • ok: Boolean indicating if the operation succeeded.
  • id: Unique identifier of the created or updated template.
  • name: Name of the template.

No binary data output is involved in this operation.


Dependencies

  • Requires access to the internal Template Manager service that handles storing, retrieving, and managing TextFSM templates.
  • No external API keys or services are needed for template creation.
  • The node depends on the TextFSM engine implementation bundled internally to build and validate templates.

Troubleshooting

  • Invalid JSON Error: When providing template JSON, if the JSON is malformed, the node throws an error "Invalid JSON: <error message>". Ensure the JSON syntax is correct before submitting.
  • Missing Required Fields: When using the form method, required fields such as "Template Name" must be provided; otherwise, the node will not proceed.
  • Unsupported Operation: If an unsupported operation value is passed, the node throws "Unsupported operation: <operation>".
  • Template Storage Issues: If the template manager fails to save or update a template, the node may throw errors related to storage or validation. Check that the template structure conforms to expected schema.

Links and References

  • TextFSM GitHub Repository – Original TextFSM project for understanding template syntax.
  • n8n Documentation on Custom Nodes – For guidance on creating and managing nodes in n8n.
  • Network Automation Forums and Communities – For examples and best practices on parsing network device outputs.

This summary covers the Create Template operation of the SSH Template Parser node, focusing on its input properties, output, and usage context.

Discussion