Data Models: Group Variables

Let's learn about some of the group variables that are used in the code configurations.

Introduction

In this chapter, network configurations are converted and split into variables contained inside data models and dynamic templates. First group variables are created at a platform level representing standard configurations for the distribution or access layer. Unique, host-specific information will become host variables. Data models are written in the YAML format.

Jinja2 dynamic templates are introduced at this stage. These templates are used to establish the intent-based, data-driven, golden configuration that is applied to the devices. Jinja2 files are a mix of static text, programmatic logic, and dynamic variables. These variables are called from the group and host variables in the data models. The resulting compiled output is an intent-based golden configuration.

Group variables

Planning data models should take some time. These models are the structures, and ultimately the variables, that will be called by dynamic Jinja2 templates. The structure is important as it will dictate how to use the data logically to create working network device configurations. Another way to think of the group and host variables is to consider them as data dictionaries made up of key-pair values and lists. Templates will access the key-value pairs and iterate over lists.

Remember, the examples of data that should be modeled in the group variables:

  • Standard NTP, IP helper addresses for DHCP, SNMP, or syslog servers
  • Access-control lists at the distribution layer
  • QoS policies either by platform, logical function, or both
  • Banners
  • AAA configurations such as RADIUS or TACACS+ servers
  • Universal secret
  • Standard interfaces
    • VSS configurations for core and distribution
    • Standardized uplinks. For example, port-channel 1 is always used as the uplink between distribution and core
  • Domain name
  • Native VLAN
  • Multicast
  • NetFlow
  • Platform type flag/identifier
  • Other features with common code across a platform

Here are some examples of group_vars for the enterprise network. Remember, the scope of the data model applies to all devices under the group in hosts.

CAMPUS

For example, here is a data model that applies to all devices on the network:

Get hands-on with 1400+ tech skills courses.