Fortinet white logo
Fortinet white logo

Administration Guide

Validating CLI templates

Validating CLI templates

FortiManager will suggest commands as you type text into the editor. Select a command from the suggestion menu to auto-complete the command. FortiManager may suggest additional commands to use based on the previously entered command. For example, if you type conf, FortiManager will suggest the config command. When config is selected, FortiManager may present additional options related to the config command that can be added (for example, firewall address).

You can click the Validate option at the bottom of the editor to review for syntax errors.

A FortiManager warning message will appear if there are errors detected, and an error icon will indicate the line(s) in the editor that include the error. Hover your mouse over the error icon to review the warning details. FortiManager will present suggested corrections where applicable, and you can click Use Corrected Suggestion to update the command in line. Once corrections have been made in the editor, you can click Validate again to confirm that there are no longer any syntax issues.

Selecting the validation platform

In order to ensure the validated results align with the device platform the commands will be run on, you must choose the correct platform from the Validation device platform dropdown in the editor. Validation will use the syntax from the selected device platform.

Performing validation on change

You can enable the Validate on change field to automatically validate the syntax when making changes in the editor

Validate results of metadata variables used in the template

Template validation can be used to determine if your template is producing the correct output based on the metadata variables used in the template. For more information on meta variables, see ADOM-level metadata variables

To validate the meta variables used in a CLI template:
  1. Go to Device Manager > Provisioning Templates > CLI Templates.
  2. Select a template from the table that is assigned to one or more devices.
  3. In the toolbar, click More > Validate.
    The Validate CLI Template dialog opens and displays each device to which the template is assigned, and the status of the meta variables.
  4. Click View Validation Result to view detailed information, including the meta variable value assigned to each device.
    The following features are available:
    • Click a variable value in the table to edit the value.
    • Click Show Missing Variable Devices Only to filter by devices that are missing variable values.
    • Click Preview Script to view the script that will be installed to the selected device.
    • Click Re-validate to run the validation again.

Validating CLI templates

Validating CLI templates

FortiManager will suggest commands as you type text into the editor. Select a command from the suggestion menu to auto-complete the command. FortiManager may suggest additional commands to use based on the previously entered command. For example, if you type conf, FortiManager will suggest the config command. When config is selected, FortiManager may present additional options related to the config command that can be added (for example, firewall address).

You can click the Validate option at the bottom of the editor to review for syntax errors.

A FortiManager warning message will appear if there are errors detected, and an error icon will indicate the line(s) in the editor that include the error. Hover your mouse over the error icon to review the warning details. FortiManager will present suggested corrections where applicable, and you can click Use Corrected Suggestion to update the command in line. Once corrections have been made in the editor, you can click Validate again to confirm that there are no longer any syntax issues.

Selecting the validation platform

In order to ensure the validated results align with the device platform the commands will be run on, you must choose the correct platform from the Validation device platform dropdown in the editor. Validation will use the syntax from the selected device platform.

Performing validation on change

You can enable the Validate on change field to automatically validate the syntax when making changes in the editor

Validate results of metadata variables used in the template

Template validation can be used to determine if your template is producing the correct output based on the metadata variables used in the template. For more information on meta variables, see ADOM-level metadata variables

To validate the meta variables used in a CLI template:
  1. Go to Device Manager > Provisioning Templates > CLI Templates.
  2. Select a template from the table that is assigned to one or more devices.
  3. In the toolbar, click More > Validate.
    The Validate CLI Template dialog opens and displays each device to which the template is assigned, and the status of the meta variables.
  4. Click View Validation Result to view detailed information, including the meta variable value assigned to each device.
    The following features are available:
    • Click a variable value in the table to edit the value.
    • Click Show Missing Variable Devices Only to filter by devices that are missing variable values.
    • Click Preview Script to view the script that will be installed to the selected device.
    • Click Re-validate to run the validation again.