Skip to content

Include | Topology Syntax Guide

Michael Albert edited this page Jun 15, 2017 · 1 revision

Include is used to reference other topologies located in files other than the current file. It can only be used at the top of a topology file (before the name of the topology is declared). The names listed in includes are file names (omitting the .yaml). Included files must be in the same directory as the topology being run, or in a sub-directory called "include" in the same directory as the topology file. So to reference the SimpleTop topology located in the simpleTop.yaml file, you would:

include: simpleTop

To reference multiple files, use a sequence:

includes:
  - nodeTemplate #includes nodeTemplate.yaml
  - simpleTop

Make sure when using the included templates for topologies, nodes, and links, that the name you use matches that declared within the file (when on is explicitly declared).

For example, if a topology file is named simpleTop.yaml and the name SimpleTop is used like below, reference it as SimpleTop. If no explicit name is declared, the name is implicitly the filename (minus .yaml).

SimpleTop:
  nodes:
    - node1:
        iface: eth0
include: simpleTop #read in simpleTop.yaml
AdvancedTop:
  topologies:
    - top1:
        template: SimpleTop #name used in simpleTop.yaml