Skip to content

Custom Structured Configuration

Custom AVD Structured Configuration

With Custom Structured Configuration the user can override built-in eos_designs functionality or add extra knobs to be picked up by eos_cli_config_gen role. There are multiple ways of supplying Custom Structured Configuration and they can all be combined.

structured_config in eos_designs data models

This feature enables the user to supply structured_config on various levels in the eos_designs data model.

Connected Endpoints

All relevant structured_config sections will be merged.

< connected_endpoints_keys.key >:
  < endpoint_1 >:
    adapters:
      - <...>
        # Custom structured config added under ethernet_interfaces.<interface> for eos_cli_config_gen
        structured_config: < dictionary >
        port_channel:
          # Custom structured config added under port_channel_interfaces.<interface> for eos_cli_config_gen
          structured_config: < dictionary >

See Connected Endpoints

Fabric Topology

Only the most specific structured_config key will be used

< node_type_key >:
  defaults:
    # Custom structured config for eos_cli_config_gen
    structured_config: < dictionary >
  nodes:
    < node >:
      # Custom structured config for eos_cli_config_gen
      structured_config: < dictionary >
  node_groups:
    < node_group >:
      # Custom structured config for eos_cli_config_gen
      structured_config: < dictionary >
      nodes:
        < node >:
          # Custom structured config for eos_cli_config_gen
          # Overrides the setting on node_group level.
          structured_config: < dictionary >

See Fabric Topology

Network Services (a.k.a. “tenants”)

All relevant structured_config sections will be merged. Note that setting structured_config under svi.nodes will override the setting on svi.

tenants:
  vrfs:
    < vrf >:
      # Custom structured config for eos_cli_config_gen
      structured_config: < dictionary >
      bgp:
        # Custom structured config added under router_bgp.vrfs.<vrf> for eos_cli_config_gen
        structured_config: < dictionary >
      svis:
        < vlan >:
          # Custom structured config added under vlan_interfaces.<interface> for eos_cli_config_gen
          structured_config: < dictionary >
          nodes:
            < node >:
              # Custom structured config added under vlan_interfaces.<interface> for eos_cli_config_gen
              # Overrides the setting on SVI level.
              structured_config: < dictionary >

See Network Services

All structured_config knobs honor the list_merge strategy set in custom_structured_configuration_list_merge described in the next section.

custom_structured_configuration

Custom EOS Structured Configuration keys can be set on any group or host_var level using the name of the corresponding eos_cli_config_gen key prefixed with content of custom_structured_configuration_prefix. The content of Custom Structured Configuration variables will be combined with the structured config generated by the eos_designs role. By default Lists are replaced and Dictionaries are updated. The combine is done recursively, so it is possible to update a sub-key of a variable set by eos_designs role already. The List-merge strategy can be changed using custom_structured_configuration_list_merge variable using any value accepted by list_merge on the Ansible Combine filter.

Variables and Options
custom_structured_configuration_prefix: < variable_prefix, default -> "custom_structured_configuration_" >
#or
custom_structured_configuration_prefix: [ < variable_prefix_1 > , < variable_prefix_2 > , < variable_prefix_3 > ]

custom_structured_configuration_list_merge: < replace (default) | append | keep | prepend | append_rp | prepend_rp >
Examples
Example using default prefix
custom_structured_configuration_name_server:
  nodes:
    - 10.2.3.4
custom_structured_configuration_ethernet_interfaces:
  Ethernet4000:
    description: My test
    ip_address: 10.1.2.3/12
    shutdown: false
    type: routed
    mtu: 1500
    peer: MY-own-peer
    peer_interface: Ethernet123
    peer_type: my_precious

In this example the contents of the name_server.nodes variable in the Structured Configuration will be replaced by the list [ 10.2.3.4 ] and Ethernet4000 will be added to the ethernet_interfaces dictionary in the Structured Configuration.

custom_structured_configuration_prefix allows the user to customize the prefix for Custom Structured Configuration variables. Default value is custom_structured_configuration_. Remember to include any delimiter like the last _ in this case. It is possible to specify a list of prefixes, which will all be merged one by one. The order of merge will start from beginning of the list, which means that keys defined in the later prefixes will be able to override keys defined in previous ones.

custom_structured_configuration_prefix: < variable_prefix, default -> "custom_structured_configuration_" >
#or
custom_structured_configuration_prefix: [ < variable_prefix_1 > , < variable_prefix_2 > , < variable_prefix_3 > ]
Example using multiple prefixes:
custom_structured_configuration_prefix: [ my_dci_ , my_special_dci_ ]

my_dci_ethernet_interfaces:
  Ethernet4000:
    description: My test
    ip_address: 10.1.2.3/12
    shutdown: false
    type: routed
    mtu: 1500
    peer: MY-own-peer
    peer_interface: Ethernet123
    peer_type: my_precious

my_special_dci_ethernet_interfaces:
  Ethernet4000:
    ip_address: 10.3.2.1/21

In this example Ethernet4000 will be added to the ethernet_interfaces dictionary in the Structured Configuration and the ip_address will be 10.3.2.1/21 since ip_adddress was overridden on the later custom_structured_configuration_prefix

Example with append list_merge strategy:
name_servers:
  - 10.10.10.10
  - 10.10.10.11

custom_structured_configuration_list_merge: append
custom_structured_configuration_list_prefix: [ override_ ]

override_name_server:
  nodes:
  - 10.10.10.12

In this example the name_servers variable will be read by eos_designs templates and the name_server structured configuration will be generated accordingly. The override_name_server.nodes list will be appended to name_server.nodes list resulting in:

name_server:
  source:
    vrf: MGMT
  nodes:
  - 10.10.10.10
  - 10.10.10.11
  - 10.10.10.12

Last update: October 20, 2021
Back to top