{#
TITLE | Device Name Configuration Template |
VERSION | Version Number |
PUBLICATION DATE | Date of Publication |
CATEGORY | Configuration Template |
STATUS | Draft, Proposed, Accepted, Deprecated |
#}
{#
Table of Contents
#}
{#
This section must include one paragraph defining the function of this class of device.
#}
{#
Any information necessary for the proper configuration and installation of this device in the network which would not be represented in the config file itself would go here. If no notes are needed, then this section should include “Not Applicable”.
#}
{#
Any variables necessary to form the configuration will be explained in this section. Variables will be surrounded two curly braces and a space on either side. Variable names will formatted as any combination of lower case letters, numbers and underscores. They must start with a letter. Variable names must have four characters at a minimum and at most 24 characters.
Examples:
#}
{#
#} This is an example of a configuration template.
Although it should be kept to a minimum, commenting is allowed within a configuration. There are two types of comments that will be supported in the templates; comments that will appear in the network device configuration and comments that will not. Comments that should not appear in the network device should begin with “{#” and end with “#}”. These comments will be visible in the template, but will not be displayed in the generated configuration.
{# This is a comment that will not appear on the device. #}
Comments that need to appear on the devices themselves, should use the vendor specific commenting format. For example, Juniper templates can include “/*” and “*/” to allow comments to appear in the device configuration.
/* This is an example comment that will appear on a Juniper device. */
Some configurations will require repeated portions of the configuration. This is possible with a variable where the value is a list. This is an example loop from a Juniper configuration.
{% for dns_server in dns_servers %}
ip name-server {{ dns_server }}
{% endfor %}
Repeated configuration sections may also be required with multiple, related variables. This is also possible using a mapping (aka a dictionary in Python). This is an example loop from an Arista configuration using a mapping.
{% for snmp_server, snmp_comm in snmp_servers.iteritems() %}
snmp-server host {{ tac_server }} version 2c {{ snmp_comm }}
{% endfor %}
There may also be cases where specific commands need to be alternated across a pair of devices or more generally across the network. This can be supported with if statements. This is an eample for alternating the primary TACACS server between a pair of Juniper devices.
{% if even(mgmt_ip.split('.')) %}
{% for tac_server in tacacs_servers %}
tacacs-server host {{ tac_server }} timeout 1
{% endfor %}
{% else %}
{% for tac_server in reverse(tacacs_servers) %}
tacacs-server host {{ tac_server }} timeout 1
{% endfor %}
{% endif %}
Additional examples of supported syntax will be included as required configuration complexity increases.
This is the end of the example configuration. {#
Revision History
Revision | Updater | Date | Comment |
0.1 | Eileen Watson | 02/17/2014 | Initial version |
#}