Fortinet black logo
7.0.0

Example project template

Example project template

Here we are going to complete the above steps for our example project.

  1. Define the LAN summary and the loopback summary:
        {% set lo_summary = '10.200.0.0/14' %}
        {% set lan_summary = '10.0.0.0/8' %}
        

    Additionally, enable ADVPN across the regions:

        {% set multireg_advpn = true %}
        
  2. Define the two regions:
        {% set regions = {
            'West': {
              'as': '65001',
              'lan_summary': '10.0.0.0/14',
              'lo_summary': '10.200.1.0/24',
              'hubs': [ 'site1-H1', 'site1-H2' ]
            },
            'East': {
              'as': '65002',
              'lan_summary': '10.4.0.0/14',
              'lo_summary': '10.200.2.0/24',
              'hubs': [ 'site2-H1' ]
            }
          }
        %}
        
  3. Define the two device profiles:
        {% set profiles = {
    
            'Silver': {
              'interfaces': [
                {
                  'name': 'port1',
                  'role': 'wan',
                  'ol_type': 'ISP1',
                  'ip': 'dhcp'
                },
                {
                  'name': 'port4',
                  'role': 'wan',
                  'ol_type': 'MPLS',
                  'ip': mpls_wan_ip
                },
                {
                  'name': 'port5',
                  'role': 'lan',
                  'ip': lan_ip
                }
              ]
            },
    
            'Gold': {
              'interfaces': [
                {
                  'name': 'port1',
                  'role': 'wan',
                  'ol_type': 'ISP1',
                  'ip': 'dhcp'
                },
                {
                  'name': 'port2',
                  'role': 'wan',
                  'ol_type': 'ISP2',
                  'ip': 'dhcp'
                },
                {
                  'name': 'port4',
                  'role': 'wan',
                  'ol_type': 'MPLS',
                  'ip': mpls_wan_ip
                },
                {
                  'name': 'port5',
                  'role': 'lan',
                  'ip': lan_ip
                }
              ]
            }
    
          }
        %}
        

    Notes:

    • In our example project, all the Internet links receive their connectivity information from the DHCP servers. Hence, we use the keyword dhcp.
    • The links connecting to the MPLS network, on the other hand, do not use DHCP. Instead, their underlay IP addresses will be defined on a per-device basis, using FortiManager meta field mpls_wan_ip.
  4. Define the Hubs:
        {% set hubs = {
    
            'site1-H1': {
              'lo_bgp': '10.200.1.253',
              'overlays': {
                'ISP1': {
                  'wan_ip': '100.64.1.1',
                  'network_id': '11'
                },
                'ISP2': {
                  'wan_ip': '100.64.1.9',
                  'network_id': '12'
                },
                'MPLS': {
                  'wan_ip': '172.16.1.5',
                  'network_id': '13'
                }
              }
            },
    
            'site1-H2': {
              'lo_bgp': '10.200.1.254',
              'overlays': {
                'ISP1': {
                  'wan_ip': '100.64.2.1',
                  'network_id': '21'
                },
                'ISP2': {
                  'wan_ip': '100.64.2.9',
                  'network_id': '22'
                },
                'MPLS': {
                  'wan_ip': '172.16.2.5',
                  'network_id': '23'
                }
              }
            },
    
            'site2-H1': {
              'lo_bgp': '10.200.2.253',
              'overlays': {
                'ISP1': {
                  'wan_ip': '100.64.4.1',
                  'network_id': '41'
                },
                'MPLS': {
                  'wan_ip': '172.16.4.5',
                  'network_id': '43'
                }
              }
            }
    
          }
        %}
        

    Notes:

    • The Hub names correspond to those referred in the regions dictionary (using hubs lists).
    • The overlay names correspond to those referred in the device profiles dictionary (using ol_type parameter)

Whenever you edit your Jinja templates, it is a good idea to validate the syntax. Many online services provide syntax validation, such as j2live (https://j2live.ttl255.com/).

Simply copy and paste the entire template to the online service, and click Render. The Project template file will not produce any output, so if you see an empty result, this means you do not have any syntax errors. If you have a syntax error (such as a missing closing bracket), the rendering will fail.

Example project template

Here we are going to complete the above steps for our example project.

  1. Define the LAN summary and the loopback summary:
        {% set lo_summary = '10.200.0.0/14' %}
        {% set lan_summary = '10.0.0.0/8' %}
        

    Additionally, enable ADVPN across the regions:

        {% set multireg_advpn = true %}
        
  2. Define the two regions:
        {% set regions = {
            'West': {
              'as': '65001',
              'lan_summary': '10.0.0.0/14',
              'lo_summary': '10.200.1.0/24',
              'hubs': [ 'site1-H1', 'site1-H2' ]
            },
            'East': {
              'as': '65002',
              'lan_summary': '10.4.0.0/14',
              'lo_summary': '10.200.2.0/24',
              'hubs': [ 'site2-H1' ]
            }
          }
        %}
        
  3. Define the two device profiles:
        {% set profiles = {
    
            'Silver': {
              'interfaces': [
                {
                  'name': 'port1',
                  'role': 'wan',
                  'ol_type': 'ISP1',
                  'ip': 'dhcp'
                },
                {
                  'name': 'port4',
                  'role': 'wan',
                  'ol_type': 'MPLS',
                  'ip': mpls_wan_ip
                },
                {
                  'name': 'port5',
                  'role': 'lan',
                  'ip': lan_ip
                }
              ]
            },
    
            'Gold': {
              'interfaces': [
                {
                  'name': 'port1',
                  'role': 'wan',
                  'ol_type': 'ISP1',
                  'ip': 'dhcp'
                },
                {
                  'name': 'port2',
                  'role': 'wan',
                  'ol_type': 'ISP2',
                  'ip': 'dhcp'
                },
                {
                  'name': 'port4',
                  'role': 'wan',
                  'ol_type': 'MPLS',
                  'ip': mpls_wan_ip
                },
                {
                  'name': 'port5',
                  'role': 'lan',
                  'ip': lan_ip
                }
              ]
            }
    
          }
        %}
        

    Notes:

    • In our example project, all the Internet links receive their connectivity information from the DHCP servers. Hence, we use the keyword dhcp.
    • The links connecting to the MPLS network, on the other hand, do not use DHCP. Instead, their underlay IP addresses will be defined on a per-device basis, using FortiManager meta field mpls_wan_ip.
  4. Define the Hubs:
        {% set hubs = {
    
            'site1-H1': {
              'lo_bgp': '10.200.1.253',
              'overlays': {
                'ISP1': {
                  'wan_ip': '100.64.1.1',
                  'network_id': '11'
                },
                'ISP2': {
                  'wan_ip': '100.64.1.9',
                  'network_id': '12'
                },
                'MPLS': {
                  'wan_ip': '172.16.1.5',
                  'network_id': '13'
                }
              }
            },
    
            'site1-H2': {
              'lo_bgp': '10.200.1.254',
              'overlays': {
                'ISP1': {
                  'wan_ip': '100.64.2.1',
                  'network_id': '21'
                },
                'ISP2': {
                  'wan_ip': '100.64.2.9',
                  'network_id': '22'
                },
                'MPLS': {
                  'wan_ip': '172.16.2.5',
                  'network_id': '23'
                }
              }
            },
    
            'site2-H1': {
              'lo_bgp': '10.200.2.253',
              'overlays': {
                'ISP1': {
                  'wan_ip': '100.64.4.1',
                  'network_id': '41'
                },
                'MPLS': {
                  'wan_ip': '172.16.4.5',
                  'network_id': '43'
                }
              }
            }
    
          }
        %}
        

    Notes:

    • The Hub names correspond to those referred in the regions dictionary (using hubs lists).
    • The overlay names correspond to those referred in the device profiles dictionary (using ol_type parameter)

Whenever you edit your Jinja templates, it is a good idea to validate the syntax. Many online services provide syntax validation, such as j2live (https://j2live.ttl255.com/).

Simply copy and paste the entire template to the online service, and click Render. The Project template file will not produce any output, so if you see an empty result, this means you do not have any syntax errors. If you have a syntax error (such as a missing closing bracket), the rendering will fail.