netlab

Installation Guides

  • Installation
  • Supported Platforms

Using the Tools

  • Tutorials
  • Lab Topology Overview
  • CLI Overview
  • Addressing Tutorial
  • Defining and Using VRFs
  • External Connectivity

Reference Materials

  • netlab Command Reference
  • Lab Topology Reference
  • List of Configuration Modules
  • netlab Plugins
  • Output Formats
  • Customize netlab

Release Notes

  • Release Notes
  • Platform Caveats

Developers

  • Contributor Guidelines
  • Developing Plugins
  • Implementation Notes
    • Deploying Device Configurations
    • Initial Device Configuration
    • BFD Configuration Templates
    • Configuring BGP
    • First-Hop Gateway Configuration Templates
    • MPLS-Related Configuration Templates
      • Enabling MPLS Support on a Device
      • Template Architecture
    • Configuring OSPF
    • Configuring OSPF Areas
    • Configuring RIPv2/RIPng
    • Generic Routing Tools Configuration Templates
    • Configuring VLANs
    • Configuring VRFs
  • Advanced Topics
  • Roadmap Proposals
netlab

MPLS-Related Configuration Templates

  • Home
  • Implementation Notes
  • MPLS-Related Configuration Templates
  • View page source

MPLS-Related Configuration Templates

This document describes how to create configuration templates for the mpls configuration module to implement LDP, MPLS/VPN, 6PE, or BGP-LU.

Enabling MPLS Support on a Device

To enable MPLS features on a device, add the mpls dictionary to the device YAML file (netsim/devices/<device>.yml). Enable individual features within that file, for example:

mpls:
  vpn: true

Template Architecture

The MPLS configuration uses a two-tier template structure. The templates should be stored in the netsim/ansible/templates/mpls/ directory. Feature-specific templates can also be stored within the netsim/ansible/templates/mpls/<platform> directory (example: IOS XR).

Main MPLS Template

The <platform>.j2 template (e.g., eos.j2) includes templates for MPLS sub-features based on ldp or mpls node variables:

{% if ldp is defined %}
{%   include '<platform>.ldp.j2' +%}
{% endif %}
{% if mpls.bgp is defined %}
{%   include '<platform>.bgp-lu.j2' +%}
{% endif %}
{% if mpls.vpn is defined %}
{%   include '<platform>.mplsvpn.j2' +%}
{% endif %}
{% if mpls['6pe'] is defined %}
{%   include '<platform>.6pe.j2' +%}
{% endif %}

Tip

The <platform> is the value of the netlab_device_type or ansible_network_os variable.

Configuring MPLS Features

  • MPLS LDP Configuration Templates
  • MPLS/VPN Configuration Templates
  • MPLS 6PE Configuration Templates
Previous Next

© Copyright 2020–2025 Ivan Pepelnjak, Jeroen van Bemmel, Stefano Sasso, Dan Partelly, and other contributors. Powered by Sphinx, sphinx-rtd-theme and sphinx-rtd-dark-mode. Hosted on Cloudflare Pages.

>