Simulation Intermediate

Network simulation brings your digital twin to life, allowing you to verify protocol behavior, trace packet paths, test access control lists, and measure performance under various conditions.

Simulation Approaches

ApproachToolsBest ForResource Cost
Config AnalysisBatfishRouting verification, ACL testing, complianceLow (CPU only)
EmulationGNS3, EVE-NG, CMLFull protocol behavior, CLI testingHigh (VMs per device)
Packet Simulationns-3, custom enginesPerformance testing, capacity modelingMedium
AI-Based PredictionCustom ML modelsFast approximation, large-scale scenariosLow (inference only)

Batfish for Configuration Analysis

Python
from pybatfish.client.commands import *
from pybatfish.question.bfq import *

# Initialize Batfish with your network snapshot
bf_init_snapshot('./network-configs', name='production')

# Trace a path from source to destination
result = bfq.traceroute(
    startLocation='@enter(core-rtr-01[GigabitEthernet0/0])',
    headers=HeaderConstraints(dstIps='10.0.50.100')
).answer()

# Check for undefined references in configs
issues = bfq.undefinedReferences().answer()

# Verify ACL behavior
acl_result = bfq.searchFilters(
    headers=HeaderConstraints(srcIps='10.0.0.0/8', dstPorts='22'),
    action='permit'
).answer()

Integrating Simulation into CI/CD

Run network simulations automatically when configuration changes are proposed, just like running unit tests for application code. This catches issues before they reach production.

Simulation in CI/CD: Use Batfish in your GitOps pipeline to automatically validate every proposed network config change. If the simulation detects reachability issues or policy violations, block the merge.

Next Step

Learn how to run what-if scenarios to test changes and failure modes safely.

Next: What-If Analysis →