Fortinet black logo

New Features

Improved CLI templates with validation and preview functions

Copy Link
Copy Doc ID 722c6141-8e83-11ec-9fd1-fa163e15d75b:260251
Download PDF

Improved CLI templates with validation and preview functions

Improved CLI templates with Validation and Preview functions, to perform verification of the template before installation. Metadata variables used in CLI templates (including Jinja variables) can be imported/exported from/to a JSON file.

This topic includes the following sections:

Note

For an example of how these features can be used while configuring SD-WAN, IPsec and BGP for branch offices using the CLI template, see the following: Branch configuration using FortiManager Jinja2 CLI templates

CLI template validation

To validate CLI templates:
  1. Go to Device Manager > Provisioning Templates > CLI Templates.
  2. Right-click on a CLI template, and select Validate from the menu.

    The Validate CLI Template dialog appears.
  3. Once the template validation finishes, detected errors are displayed, and you can check the error for details. For example, variables missed.
  4. Click View Validation Result. In the Validation Results dialog, you can input the value for the missing variable.
  5. When the CLI template passes validation, you can preview the script by clicking the View Validation Result.

    In the Validation Result dialog, click Preview Script. You can review the script details in the Preview CLI Template dialog.

Import/export metadata variables

To export metadata variables into JSON files:
  1. Go to Policy & Objects > Object Configurations > Metadata Variables.
  2. Select the More menu from the toolbar, and click Export Metadata Variables. All metadata variables in this ADOM will be exported into a JSON file.
    In this example, there are three metadata variables in the ADOM sdwanOverlay: branch_id, internet_int1, and internet_int2.

    After exporting these metadata variables, the metadata_variable.json file includes the following content:

    {

    "adom": "sdwanOverlay",

    "variables": [

    {

    "name": "branch_id",

    "mapping": [

    {

    "device": "Branch1",

    "vdom": "",

    "value": "1"

    },

    {

    "device": "Branch3",

    "vdom": "",

    "value": "3"

    },

    {

    "device": "Branch4",

    "vdom": "",

    "value": "4"

    },

    {

    "device": "Branch5",

    "vdom": "",

    "value": "5"

    },

    {

    "device": "BranchA1",

    "vdom": "",

    "value": "1"

    }

    ]

    },

    {

    "name": "internet_int1",

    "value": "port2"

    },

    {

    "name": "internet_int2",

    "value": "port3"

    }

    ]

    }

To import metadata variables:
  1. Go to Policy & Objects > Object Configurations > Metadata Variables.
  2. Select the More menu from the toolbar, and click Import Metadata Variables.
  3. Browse and select the file to be imported. Wait for the file upload to complete, and click Import.

Improved CLI templates with validation and preview functions

Improved CLI templates with Validation and Preview functions, to perform verification of the template before installation. Metadata variables used in CLI templates (including Jinja variables) can be imported/exported from/to a JSON file.

This topic includes the following sections:

Note

For an example of how these features can be used while configuring SD-WAN, IPsec and BGP for branch offices using the CLI template, see the following: Branch configuration using FortiManager Jinja2 CLI templates

CLI template validation

To validate CLI templates:
  1. Go to Device Manager > Provisioning Templates > CLI Templates.
  2. Right-click on a CLI template, and select Validate from the menu.

    The Validate CLI Template dialog appears.
  3. Once the template validation finishes, detected errors are displayed, and you can check the error for details. For example, variables missed.
  4. Click View Validation Result. In the Validation Results dialog, you can input the value for the missing variable.
  5. When the CLI template passes validation, you can preview the script by clicking the View Validation Result.

    In the Validation Result dialog, click Preview Script. You can review the script details in the Preview CLI Template dialog.

Import/export metadata variables

To export metadata variables into JSON files:
  1. Go to Policy & Objects > Object Configurations > Metadata Variables.
  2. Select the More menu from the toolbar, and click Export Metadata Variables. All metadata variables in this ADOM will be exported into a JSON file.
    In this example, there are three metadata variables in the ADOM sdwanOverlay: branch_id, internet_int1, and internet_int2.

    After exporting these metadata variables, the metadata_variable.json file includes the following content:

    {

    "adom": "sdwanOverlay",

    "variables": [

    {

    "name": "branch_id",

    "mapping": [

    {

    "device": "Branch1",

    "vdom": "",

    "value": "1"

    },

    {

    "device": "Branch3",

    "vdom": "",

    "value": "3"

    },

    {

    "device": "Branch4",

    "vdom": "",

    "value": "4"

    },

    {

    "device": "Branch5",

    "vdom": "",

    "value": "5"

    },

    {

    "device": "BranchA1",

    "vdom": "",

    "value": "1"

    }

    ]

    },

    {

    "name": "internet_int1",

    "value": "port2"

    },

    {

    "name": "internet_int2",

    "value": "port3"

    }

    ]

    }

To import metadata variables:
  1. Go to Policy & Objects > Object Configurations > Metadata Variables.
  2. Select the More menu from the toolbar, and click Import Metadata Variables.
  3. Browse and select the file to be imported. Wait for the file upload to complete, and click Import.