netlab Plugins

netlab supports dynamically loadable plugins, allowing you to implement custom data model transformations or other functionality without adding nerd knobs to the core topology transformation. You can use plugins shipped with netlab or write your own plugins:

Using Plugins

Plugins needed by a topology file are listed in the plugin top-level element, for example:

plugin: [ bgp.session ]

module: [ ospf, bgp ]

netlab searches for plugins in the plugin search path (defaults.paths.plugin: current directory, topology directory, ~/.netlab, and /etc/netlab) before trying the plugins shipped with netlab. See Developing Plugins for more details.

You can specify additional (system-wide) plugins in system defaults (defaults.plugin) or as a CLI parameter in netlab create or netlab up commands.

The plugin and defaults.plugin values can also be dictionaries. The dictionary keys are plugin names; netlab skips the plugins with the value set to False and converts the dictionary into a list of plugin names. Use dictionaries to add plugins with environment variables or CLI settings without overwriting the plugins specified elsewhere, for example:

$ export NETLAB_PLUGIN_MULTILAB=True
$ export NETLAB_PLUGIN_BGP_SESSION=True
$ netlab up -s plugin.files=True

Warning

You cannot add plugins with environment variables or CLI settings to a list of plugins. For example, netlab up -s plugin.files=True fails if the lab topology uses plugin: [ bgp.session ], and NETLAB_PLUGIN_MULTILAB=True fails if your user defaults use plugin: [ files ].

netlab also loads the plugins required by the external tools and the devices used in the lab topology.

Plugins can define their own netlab attributes that you can use to configure plugin-provided functionality. For example, the BGP sessions plugin defines bgp.password attribute that can be used to enable MD5 authentication of EBGP sessions:

---
provider: clab
defaults.device: eos
module: [ bgp ]
plugin: [ bgp.session ]

nodes:
  r1:
    bgp.as: 65101
  r2:
    bgp.as: 65000

links:
- r1:
  r2:
  bgp.password: Test

Plugins providing support for additional networking features usually rely on Jinja2 templates to configure those features, limiting their use to a subset of supported platforms. Please check the plugin documentation for more details.

netlab Built-In Plugins

These plugins are included with netlab and can be used in all lab topologies:

More Information