Skip to main content

EVPN Ninja - VXLAN/EVPN fabric calculator for VNI allocation, fabric planning, EVPN parameters, MTU calculation

Project description

EVPN Ninja Logo

EVPN Ninja

The Ultimate VXLAN/EVPN Fabric Planning & Configuration Tool

PyPI PyPI Downloads GitHub Downloads

Python 3.10+ License: MIT

FeaturesInstallationQuick StartCommandsVendorsLab Export


Overview

EVPN Ninja is a powerful cross-platform CLI tool designed for network engineers to plan, calculate, and generate configurations for VXLAN/EVPN data center fabrics. Whether you're designing a small campus network or a large-scale multi-tenant datacenter, EVPN Ninja has you covered.

┌─────────────────────────────────────────────────────────────────┐
│  Plan → Calculate → Generate → Deploy                          │
│                                                                 │
│  ┌───────┐    ┌───────────┐    ┌──────────┐    ┌───────────┐  │
│  │Fabric │ => │ IP Plans  │ => │  Configs │ => │Containerlab│ │
│  │Design │    │ VNI/ASN   │    │ 18 Vendors│   │EVE-NG/GNS3│  │
│  └───────┘    └───────────┘    └──────────┘    └───────────┘  │
└─────────────────────────────────────────────────────────────────┘

✨ Features

Calculators

Calculator Description
MTU Calculate VXLAN encapsulation overhead with detailed layer-by-layer breakdown
VNI Allocation Plan VNI assignments using VLAN-based, tenant-based, or sequential schemes
Fabric Parameters Generate complete IP addressing plans for leaf-spine topologies
EVPN Parameters Calculate RD/RT values and generate production-ready vendor configs
eBGP Underlay Design RFC 7938 compliant eBGP underlay with ASN allocation
Multicast Groups Plan multicast group assignments for BUM traffic replication
Route Reflector Calculate BGP RR placement and cluster configurations
Bandwidth Estimate fabric bandwidth and oversubscription ratios
Multi-homing Generate ESI, LACP, and ES-RT for EVPN multi-homing
Topology Visualize fabric topology in ASCII or Graphviz DOT format

Key Capabilities

  • 18 Vendor Support — Generate configs for Arista, Cisco, Juniper, Nokia, and 14 more vendors
  • Lab Export — Export to Containerlab, EVE-NG, and GNS3 for instant lab deployment
  • Presets — Built-in presets for small, medium, and large datacenters
  • Config File — Save your defaults in ~/.evpn-ninja.yaml
  • Multiple Outputs — Table, JSON, or YAML output for automation
  • IP Validation — Automatic overlap and capacity checks for IP networks
  • Interactive Mode — Guided wizard for beginners

📦 Installation

From PyPI

pip install evpn-ninja

From Source

git clone https://github.com/ashimov/evpn-ninja.git
cd evpn-ninja
pip install -e .

Standalone Binary

Download prebuilt binaries from GitHub Releases:

Platform File
Linux (x64) evpn-ninja-linux-amd64
macOS (Intel) evpn-ninja-macos-amd64
macOS (Apple Silicon) evpn-ninja-macos-arm64
Windows (x64) evpn-ninja-windows-amd64.exe
# Linux/macOS: make executable and run
chmod +x evpn-ninja-*
./evpn-ninja-linux-amd64 --help

Shell Completion

# Bash
evpn-ninja completion bash > ~/.evpn-ninja-complete.bash
echo "source ~/.evpn-ninja-complete.bash" >> ~/.bashrc

# Zsh
evpn-ninja completion zsh > ~/.evpn-ninja-complete.zsh
echo "source ~/.evpn-ninja-complete.zsh" >> ~/.zshrc

# Fish
evpn-ninja completion fish > ~/.config/fish/completions/evpn-ninja.fish

🚀 Quick Start

# Show all available commands
evpn-ninja --help

# Use a preset for quick calculations
evpn-ninja --preset large-dc fabric

# Calculate MTU requirements
evpn-ninja mtu --payload 1500 --underlay ipv4

# Generate EVPN configs for multiple vendors
evpn-ninja evpn --as 65000 --loopback 10.0.0.1 --l2-vni 10010 --vendor arista --vendor cisco-nxos

# Export to Containerlab for testing
evpn-ninja export containerlab --spines 2 --leaves 4 --platform eos --output-dir ./lab

# Interactive guided mode
evpn-ninja interactive

📖 Commands

MTU Calculator

Calculate the required underlay MTU for VXLAN encapsulation with a detailed breakdown of each layer.

evpn-ninja mtu --payload 1500 --underlay ipv4 --outer-vlan 1
                              VXLAN MTU Breakdown
┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Layer          ┃ Size (bytes) ┃ Description                                ┃
┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Outer Ethernet │ 14           │ Dst MAC + Src MAC + EtherType              │
│ Outer VLAN     │ 4            │ 802.1Q tag                                 │
│ Outer IPv4     │ 20           │ Standard IPv4 header                       │
│ UDP            │ 8            │ Source port + Dest port (4789) + Length    │
│ VXLAN Header   │ 8            │ Flags + Reserved + VNI + Reserved          │
│ Inner Ethernet │ 14           │ Dst MAC + Src MAC + EtherType              │
│ Inner Payload  │ 1500         │ Original L3 packet (IP + data)             │
└────────────────┴──────────────┴────────────────────────────────────────────┘

╭─────────────────────────────── Summary ────────────────────────────────╮
│   Required MTU        1554 bytes                                       │
│   Recommended MTU     1600 bytes                                       │
╰────────────────────────────────────────────────────────────────────────╯

VNI Allocation

Plan VNI assignments using multiple allocation schemes.

# VLAN-based scheme
evpn-ninja vni --scheme vlan-based --base-vni 10000 --start-vlan 100 --count 5

# Tenant-based scheme
evpn-ninja vni --scheme tenant-based --tenant-id 5 --start-vlan 100 --count 3

# Output as JSON for automation
evpn-ninja vni --scheme vlan-based --base-vni 10000 --count 10 --output json

Fabric Parameters

Generate complete IP addressing plans and resource estimates for leaf-spine fabrics.

evpn-ninja fabric --vteps 8 --spines 4 --vnis 500 --hosts 100 \
  --loopback-net 10.0.0.0/24 \
  --vtep-net 10.0.1.0/24 \
  --p2p-net 10.0.100.0/22

Features:

  • Router loopback allocation
  • VTEP (NVE) loopback allocation
  • P2P /31 link addressing
  • Resource estimates (MAC entries, EVPN routes, BGP sessions)
  • Automatic IP overlap and capacity validation

EVPN Parameters

Calculate RD/RT values and generate vendor-specific configurations.

# L2 VNI only
evpn-ninja evpn --as 65000 --loopback 10.0.0.1 --l2-vni 10010 --vlan 10 --vendor arista

# L2 + L3 VNI (symmetric IRB)
evpn-ninja evpn --as 65000 --loopback 10.0.0.1 \
  --l2-vni 10010 --vlan 10 \
  --l3-vni 50000 --vrf TENANT-A \
  --vendor arista --vendor cisco-nxos --vendor juniper

eBGP Underlay

Design RFC 7938 compliant eBGP underlay with automatic ASN allocation.

evpn-ninja ebgp --spines 4 --leaves 16 --scheme private-4byte --p2p-net 10.0.100.0/22

ASN Schemes:

  • private-2byte — 64512-65534
  • private-4byte — 4200000000+ (recommended)
  • custom — Specify base ASN

Multi-homing

Calculate EVPN multi-homing parameters including ESI generation.

evpn-ninja multihoming --es-count 4 --peers 2 --mode active-active --vendor arista

Features:

  • ESI Type-0, Type-1 (LACP), Type-3 (MAC-based)
  • LACP system ID configuration
  • DF election algorithm settings
  • Vendor configs for Arista, Cisco, Juniper

Route Reflector

Calculate BGP Route Reflector placement for EVPN overlay.

evpn-ninja rr --clients 16 --placement spine --redundancy pair

Bandwidth Calculator

Estimate fabric bandwidth and oversubscription ratios.

evpn-ninja bandwidth --leaves 8 --spines 4 \
  --uplinks 4 --uplink-speed 100g --downlinks 48 --downlink-speed 25g

🏭 Supported Vendors

EVPN Ninja generates production-ready configurations for 18 vendors:

Vendor Platform Vendor Platform
Arista EOS Nokia SR Linux
Cisco NX-OS Dell OS10
Cisco IOS-XE Cumulus Linux
Cisco IOS-XR SONiC SONiC NOS
Juniper Junos Extreme EXOS
Huawei CE Series HPE Aruba CX
MikroTik RouterOS 7 H3C Comware
VyOS VyOS 1.4+ ZTE ZXROS
Fortinet FortiOS Mellanox Onyx
# Generate config for specific vendor
evpn-ninja evpn --as 65000 --loopback 10.0.0.1 --l2-vni 10010 --vendor nokia-srlinux

# Generate for multiple vendors at once
evpn-ninja evpn --as 65000 --loopback 10.0.0.1 --l2-vni 10010 \
  --vendor arista --vendor cisco-nxos --vendor juniper

🧪 Lab Export

Export your fabric design directly to network simulators for testing.

Containerlab

evpn-ninja export containerlab \
  --spines 2 --leaves 4 \
  --platform eos \
  --lab-name my-fabric \
  --include-hosts \
  --output-dir ./containerlab

# Deploy the lab
cd containerlab && make deploy

EVE-NG

evpn-ninja export eve-ng \
  --spines 2 --leaves 4 \
  --platform nxos \
  --lab-name evpn-test \
  --output-dir ./eve-ng

GNS3

evpn-ninja export gns3 \
  --spines 2 --leaves 4 \
  --platform eos \
  --lab-name gns3-fabric \
  --output-dir ./gns3

Export All Formats

evpn-ninja export all --spines 2 --leaves 4 --output-dir ./automation

This creates:

automation/
├── ansible/
│   ├── inventory.yaml
│   └── group_vars/
├── nornir/
│   ├── inventory/
│   └── config.yaml
├── containerlab/
│   ├── my-fabric.clab.yml
│   ├── configs/
│   └── Makefile
├── eve-ng/
│   └── my-fabric.unl
└── gns3/
    └── my-fabric.gns3

⚙️ Configuration

Config File

Create a config file at ~/.evpn-ninja.yaml to set your defaults:

defaults:
  mtu:
    payload_size: 1500
    underlay_type: ipv4
  fabric:
    spine_count: 2
    vtep_count: 4
    loopback_network: "10.0.0.0/24"
    vtep_loopback_network: "10.0.1.0/24"
  evpn:
    bgp_as: 65000
    vendors:
      - arista
      - cisco-nxos

output:
  format: table
  no_color: false

presets:
  my-dc:
    fabric:
      spine_count: 4
      vtep_count: 32
      vni_count: 1000
    ebgp:
      scheme: private-4byte
# Initialize default config
evpn-ninja config init

# Show current config
evpn-ninja config show

# Use custom config file
evpn-ninja --config /path/to/config.yaml fabric

Built-in Presets

# List available presets
evpn-ninja --list-presets

# Use a preset
evpn-ninja --preset large-dc fabric
evpn-ninja --preset small-dc ebgp
Preset Spines Leaves VNIs Description
small-dc 2 4 100 Small datacenter
medium-dc 2 16 500 Medium datacenter
large-dc 4 64 4000 Large datacenter
multi-tenant - - - Multi-tenant with L3VNI per tenant
campus 2 8 50 Campus network

📤 Output Formats

All commands support multiple output formats:

# Pretty tables (default)
evpn-ninja fabric --vteps 4 --spines 2 --output table

# JSON for automation/scripting
evpn-ninja fabric --vteps 4 --spines 2 --output json

# YAML for config files
evpn-ninja fabric --vteps 4 --spines 2 --output yaml

# Save to file
evpn-ninja fabric --vteps 4 --spines 2 --output json --save fabric.json

🛠️ Development

# Clone repository
git clone https://github.com/ashimov/evpn-ninja.git
cd evpn-ninja

# Install with dev dependencies
pip install -e ".[dev]"

# Run linter
ruff check src/

# Run formatter
ruff format src/

# Run type checker
mypy src/

# Run tests
pytest

# Run all checks
ruff check src/ && ruff format src/ && mypy src/ && pytest

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


👤 Author

Berik Ashimov


Built with ❤️ for the network engineering community

Web VersionReport BugRequest Feature

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evpn_ninja-1.0.1.tar.gz (92.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

evpn_ninja-1.0.1-py3-none-any.whl (71.2 kB view details)

Uploaded Python 3

File details

Details for the file evpn_ninja-1.0.1.tar.gz.

File metadata

  • Download URL: evpn_ninja-1.0.1.tar.gz
  • Upload date:
  • Size: 92.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for evpn_ninja-1.0.1.tar.gz
Algorithm Hash digest
SHA256 121bf91ea838cc1f4d121df86c6cc9fc85c5a762bd96e4b006c9f7d4fcb76343
MD5 8e05ccd1c5897ba0afb80a596504c70c
BLAKE2b-256 13c45694cd0a14c8071b5fc9fcbcaab3264413e643756425501400bf0291eed5

See more details on using hashes here.

Provenance

The following attestation bundles were made for evpn_ninja-1.0.1.tar.gz:

Publisher: publish.yml on ashimov/evpn-ninja

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file evpn_ninja-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: evpn_ninja-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 71.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for evpn_ninja-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3877f5745be15377a61fabf7708cbebb0b1f55f305809291bcc4c4a963315d74
MD5 673cb5a982f3c0b484396b05dc14162a
BLAKE2b-256 b799ba125dca70ecb57aea7341e6b939bca35a695da04f408a08b4ead229faab

See more details on using hashes here.

Provenance

The following attestation bundles were made for evpn_ninja-1.0.1-py3-none-any.whl:

Publisher: publish.yml on ashimov/evpn-ninja

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page