A Rust-based multi-vendor network configuration translator, topology synthesizer, static verification engine, and Containerlab network emulation orchestrator.
- English User Guide & Samples:
docs/en/how-to-use.md - Japanese User Guide (使い方ガイド・サンプル解説):
docs/ja/how-to-use-ja.md - Design Memo (EN):
docs/en/netsim-design-memo.md - Design Memo (JA):
docs/ja/netsim-design-memo-ja.md - Samples Directory:
examples/
crates/ir: Vendor-independent Intermediate Representation data models (DeviceConfig,Interface,OspfProcess,IsisProcess,PrefixList,PolicyDefinition,InterfaceVxlanConfig,SegmentRoutingConfig,SrV6Config) aligned with IETF YANG models.crates/parse-ios: Cisco IOS configuration parser built withwinnow.crates/parse-junos: Junos set-format configuration parser built withwinnow.crates/parse-eos: Arista EOS configuration parser built withwinnow.crates/parse-iosxr: Cisco IOS XR configuration parser built withwinnow.crates/parse-frr: FRRouting / SONiC configuration parser built withwinnow.crates/parse-srlinux: Nokia SR Linux YANG-modeled JSON configuration parser (serde_json).crates/parse-sros: Nokia SR OS configuration parser built withwinnow: classic CLI (indented hierarchicalconfigure) plus MD-CLI brace-style (infooutput) and flat (admin save) formats, auto-detected.crates/topology: Network topology inference engine calculating point-to-point links and multi-access LAN bridge segments across devices.crates/emit-zebra: zebra-rs YAML configuration emitter conforming to authoritative zebra-rs YANG/YAML schema.crates/emit-frr: FRRouting (frr.confanddaemons) configuration emitter for multi-engine container emulation.crates/emit-holo: Holo routing daemon (holod) configuration emitter producing RFC 7951 JSON (ietf-system,ietf-interfaces,ietf-routing/ietf-ospf) forconvert --engine holo.crates/emit-srlinux: Nokia SR Linux configuration JSON emitter; the exact inverse of theparse-srlinuxsubset (hostname, interfaces/addresses, default network-instance OSPFv2/OSPFv3, BGP groups/neighbors, static routes via next-hop-groups), with parse->emit->parse round-trip tests over the real parser fixtures.crates/emit-junos: Junosset-format configuration emitter; the exact inverse of theparse-junossubset (hostname, interfaces/units with inet/inet6, OSPF/OSPFv3, IS-IS, BGP groups/neighbors, static routes, prefix/community lists, policy-statements, EVPN/VXLAN, SRv6), with parse->emit->parse round-trip tests over the parser fixtures. The output doubles as the startup-config for Containerlab's vrnetlab Junos kinds (juniper_vjunosrouter,juniper_vmx), which apply flatset-format files at boot.crates/emit-eos: Arista EOS configuration emitter; the exact inverse of theparse-eossubset (hostname, interfaces with IPv4/IPv6, OSPF/OSPFv3, IS-IS, BGP peer groups/neighbors/networks incl. the EVPN address family, static routes, prefix/community lists, route-maps, VXLAN, SRv6 locators), with parse->emit->parse round-trip tests over the parser fixtures. The output doubles as the startup-config for Containerlab'sarista_ceoskind (cEOS-lab), which copies it to the node'sflash/startup-config.crates/reachability: Static reachability graph solver, consistency analyzer, intent assertion engine, and Batfish vendor-independent format exporter.crates/emit-clab: Containerlab topology generator emitting*.clab.ymldefinitions with deterministic interface mappings, multi-engine support, and platform-driven native NOS kinds (see the kind table undergen-labbelow).crates/import-netbox: NetBox REST API / snapshot importer mapping DCIM devices, interfaces and cables plus IPAM IP addresses into IR devices and explicit links (pure mapping layer shared by the live-API and offline snapshot paths).crates/netsim-cli: Unified command-line interface providingconvert,validate-holo,gen-lab,check,verify(alias:test), andnetbox importsubcommands.crates/validate-yang: Automated IETF YANG schema validation and drift testing engine backed bylibyang(yang3andholo-yang).examples/: Synthetic example configurations demonstrating multi-device network topologies (e.g.,examples/ospf-3routers,examples/mixed-5vendors,examples/mixed-5vendors-ipv6).
- Rust toolchain: 1.80+ (
rustup default stable) - C Compiler & CMake:
gcc/clang,cmake - PCRE2 development library:
libpcre2-dev(Debian/Ubuntu) orpcre2-devel(RHEL/CentOS) - Containerlab: (optional, for deploying emulation environments) Install guide
- Docker: (optional, required by Containerlab)
- Container images:
quay.io/frrouting/frr:10.2.0orzebra-rs:latest
To translate a single vendor configuration file into a target engine configuration (zebra YAML or frr.conf):
# Cisco IOS to zebra-rs YAML cargo run --bin netsim -- convert \ --vendor ios \ --engine zebra \ --in examples/ospf-3routers/R1.cfg \ --out R1.zebra.yaml # Cisco IOS to FRRouting configuration cargo run --bin netsim -- convert \ --vendor ios \ --engine frr \ --in examples/ospf-3routers/R1.cfg \ --out R1.frr.conf # Junos set-format cargo run --bin netsim -- convert \ --vendor junos \ --in examples/mixed-ios-junos/junos-r2.set \ --out junos-r2.zebra.yaml # Arista EOS cargo run --bin netsim -- convert \ --vendor eos \ --in examples/mixed-3vendors/arista-r3.cfg \ --out arista-r3.zebra.yaml # Cisco IOS XR cargo run --bin netsim -- convert \ --vendor iosxr \ --in examples/mixed-4vendors/iosxr-r4.cfg \ --out iosxr-r4.zebra.yaml # FRRouting / SONiC cargo run --bin netsim -- convert \ --vendor frr \ --in examples/mixed-5vendors/frr-r5.cfg \ --out frr-r5.zebra.yaml
Options:
--vendor <ios|junos|eos|iosxr|frr|srlinux|sros>: Input vendor configuration format (default:ios). Nokia hintssr-linux/sr-osare also accepted.--engine <zebra|frr|holo>: Target runtime engine (zebra,frr, orholofor single-device Holo JSON viaconvert; default:zebra).--in <FILE>: Path to the input vendor configuration file.--out <FILE>: Destination path for the generated configuration file.--validate-yang: With--engine holo, validate the generated JSON against the IETF YANG schemas (Holo's deviation modules applied) before writing it; the conversion fails and no output is written when the document is schema-invalid. Existing Holo JSON files can be checked withnetsim validate-holo --in <FILE>. Schema validity does not guarantee thatholodwill accept or apply the configuration at runtime.
The gen-lab command processes a folder containing multiple router configurations (.cfg, .set, .conf, or .txt), automatically identifies the vendor for each file, infers point-to-point links and shared multi-access LAN segments, emits all node configurations, builds a Containerlab topology definition, and produces a diagnostic report.
# 3-router Cisco IOS OSPF triangle cargo run --bin netsim -- gen-lab \ --configs ./examples/ospf-3routers/ \ --out ./lab-ospf/ \ --lab-name ospf-lab # 2-router Cisco IOS eBGP peering cargo run --bin netsim -- gen-lab \ --configs ./examples/ebgp-2routers/ \ --out ./lab-ebgp/ \ --lab-name ebgp-lab # Mixed 5-vendor Cisco IOS, Junos, Arista EOS, Cisco IOS XR, and FRRouting topology cargo run --bin netsim -- gen-lab \ --configs ./examples/mixed-5vendors/ \ --out ./lab-mixed5/ \ --engine frr \ --lab-name mixed-lab
Generated Output Structure:
lab-mixed5/
├── arista-r3_frr.conf
├── arista-r3_daemons
├── cisco-r1_frr.conf
├── cisco-r1_daemons
├── topology.clab.yml # Containerlab topology file
└── report.md # Diagnostic markdown report
Native Containerlab kinds: every parser records the source platform in the IR (ios, ios-xr, junos, eos, frr, sr-linux, sr-os; the NetBox importer stores its detected platform in the same field, using the same canonical strings). gen-lab selects each node's Containerlab kind from that platform:
| IR platform | Containerlab kind | Image | Startup config |
|---|---|---|---|
sr-linux |
nokia_srlinux |
ghcr.io/nokia/srlinux:latest (public registry) |
Generated: <hostname>.srlinux.json written by emit-srlinux and referenced via startup-config: |
sr-os |
nokia_sros |
vrnetlab/vr-sros:latest |
None yet |
eos |
arista_ceos |
ceos:latest |
Generated: <hostname>.eos.cfg written by emit-eos and referenced via startup-config: |
junos |
juniper_vjunosrouter |
vrnetlab/juniper_vjunos-router:latest |
Generated: <hostname>.junos.set written by emit-junos (flat set format, the form the vrnetlab Junos kinds apply) and referenced via startup-config: |
ios |
cisco_csr1000v |
vrnetlab/vr-csr:latest |
None yet |
ios-xr |
cisco_xrd |
ios-xr/xrd-control-plane:latest |
None yet |
frr |
linux + FRR engine |
quay.io/frrouting/frr:10.2.0 |
Engine config (frr.conf/daemons) |
| (none / other) | linux + selected engine |
engine image | Engine config |
Kind names and image conventions follow Containerlab's own kind documentation. Notes:
- Only the SR Linux image is publicly pullable. Every other native image must be supplied by the user: SR OS / IOS CSR1000v images are built with vrnetlab from the user's own vendor software (the SR OS image in particular is NOT publicly distributed and cannot be redistributed), the Junos image is built with vrnetlab from the vJunos-router QCOW2, which Juniper offers as a free download (no account or license required) from its support portal, cEOS-lab is downloaded from Arista (account required) and imported with
docker importasceos:<version>, and XRd is downloaded from Cisco (active service account required; the image carries the nameios-xr/xrd-control-plane:<version>). IOS XR uses the container-native XRd kind rather than the XRv9k VM kind because XRd is Containerlab's documented container option for IOS XR and needs no QEMU layer. Each affected node produces an explicit warning in the generated topology output and inreport.md. - No startup-config is generated yet for SR OS / IOS / IOS XR (there is no IR->vendor emitter for them in this repo), so those nodes boot with their default configuration; this is also stated in the per-node warnings. EOS nodes get a generated
<hostname>.eos.cfgviaemit-eos(the exact inverse of theparse-eossubset); per the Containerlab cEOS documentation, thearista_ceoskind copies that file to the node'sflash/startup-configand boots with it instead of Containerlab's generated default config, so the default template's management boilerplate (admin user, eAPI/NETCONF services, Ma0 DHCP) is not part of the generated file — the generated config covers the device configuration the source config described. Junos nodes use the free vJunos-router kind (juniper_vjunosrouter) by default; if you have a licensed vMX image instead, change the node'skind:tojuniper_vmxandimage:to yourvrnetlab/vr-vmximage in the generated topology file — the generatedset-format startup-config applies to both kinds. - FRR intentionally stays a
linuxnode running the FRR engine: FRR is a Linux routing daemon, not a NOS container image. Devices without a platform likewise keep the engine-drivenlinuxbehavior, and mixed native + engine topologies in one lab are supported. Engine config files are still generated for every device, but native-kind nodes do not bind them. - Forcing engine simulation (
--force-engine): engine simulation is netsim's primary path — it runs paid-NOS configurations (IOS, Junos, IOS XR, …) on the free Rust engines (zebra-rs / FRR) without any vendor image. Native kinds are for when you do have the NOS image (including the free editions: SR Linux, cEOS-lab, vJunos). Pass--force-enginetogen-labto emit every node as alinuxcontainer running the selected engine — engine config bound, sequentialethNlink endpoints, no native startup-configs — regardless of platform.report.mdthen records that engine mode was forced and lists each platform whose native kind was overridden.
Link endpoint names: link endpoints are named after each node's real interfaces, using the endpoint naming convention Containerlab documents for the node's kind (some kinds — nokia_srlinux, cisco_xrd — reject plain ethN names, so the old sequential labels could make a native lab fail containerlab deploy):
| IR platform | IR interface name | Endpoint in topology file |
|---|---|---|
sr-linux |
ethernet-1/1 (subinterface suffix .0 stripped) |
e1-1 |
sr-linux |
ethernet-1/3/1 (breakout port) |
e1-3-1 |
sr-os |
port binding 1/1/1 (interface to-r1) |
1/1/1 (verbatim; only the simplified 1/1/X alias is documented for the vrnetlab SR OS kind) |
sr-os |
port binding 1/1/1:12 (VLAN-tagged) |
1/1/1 (the physical port) |
eos |
Ethernet1 / Ethernet1/1 |
eth1 / eth1_1 |
junos |
ge-0/0/0.0 (unit suffix stripped) |
ge-0/0/0 |
ios |
GigabitEthernet2 |
Gi2 |
ios-xr |
GigabitEthernet0/0/0/0 |
Gi0-0-0-0 |
frr / (none / other) |
any | sequential ethN (unchanged) |
Endpoint naming rules:
- Management interfaces never become link endpoints (SR Linux
mgmt0, CSR1000vGigabitEthernet1/Gi1, Junosfxp0/em0, EOSManagement*/Ma0, IOS XRMgmtEth*): a link using one is omitted, with a warning inreport.md. - SR OS endpoints come from the recorded port binding: SR OS router interfaces have logical names (
to-r1), so parse-sros records each interface'sportstatement in the IR (Interface::port) and the endpoint is derived from that binding. The fallback below therefore only applies to SR OS interfaces with no binding in the config (e.g. the system interface), a binding that is not a1/1/Xport, or — for NetBox-imported devices, whose interface names are port names — an unconvertible name. - LAG-bound SR OS interfaces fall back too: a binding of
lag-Ncannot be named as a vr-sros endpoint, so the interface uses itsethNlabel with a warning that says it is LAG-bound. - Unconvertible names fall back to the sequential
ethNlabel with a warning — e.g. IOSGigabitEthernet0/0(CSR1000v has no slot/port form), Junos interfaces outside FPC 0/PIC 0, or the SR OS cases above (the vrnetlab SR OS docs prescribe theethXscheme for such cases). A name is never invented silently. - Collisions fall back too: if two interfaces of one node map to the same endpoint (e.g. subinterfaces
ethernet-1/1.0andethernet-1/1.1of one SR Linux port), the later one uses itsethNlabel, with a warning. - Labs whose nodes are all
linuxkind (or platform-less) produce byte-identical output to before this naming was introduced.
Run fast static mathematical reachability checking, subnet consistency analysis, VTEP/SRv6 verification, and Batfish snapshot export prior to Containerlab deployment:
# Check static reachability and validate intent assertions across configurations: cargo run --bin netsim -- check --configs ./examples/ospf-3routers/ # Check with Batfish vendor-independent format export: cargo run --bin netsim -- check \ --configs ./examples/ospf-3routers/ \ --export-batfish ./batfish-snapshot.json
The verify command (aliased to test) automates the entire lifecycle:
- Deploys the Containerlab topology (
containerlab deploy -t topology.clab.yml). - Polls
vtyctl show ip route/vtysh -c 'show ip route'on all nodes until routing protocols converge (or timeout). - Executes automated data-plane ping tests across all inferred device loopbacks (both IPv4 & IPv6).
- Validates operational assertions defined in
intent.yml(e.g.assert: ping r1 -> r5 loopback). - Automatically tears down the lab (
containerlab destroy -t topology.clab.yml --cleanup).
# Verify generated lab in ./lab-ospf/ with automated convergence check and loopback pings cargo run --bin netsim -- verify --lab-dir ./lab-ospf/ --sudo # Run static-only verification without deploying containers cargo run --bin netsim -- verify --lab-dir ./lab-ospf/ --static-only
Instead of vendor configuration files, a network can be imported from
NetBox (DCIM devices/interfaces/cables + IPAM IP addresses) and then
reproduced with the usual gen-lab pipeline. The importer writes one IR
JSON file per device plus a netbox-topology.json (explicit links from
cables, and the detected platform per device), and a
netbox-import-report.md listing anything that could not be mapped.
# Live API (token read from the NETBOX_TOKEN environment variable; never logged) NETBOX_TOKEN=... cargo run --bin netsim -- netbox import \ --url https://netbox.example.com --site lab --out ./netbox-lab/ # Or offline, from a snapshot directory with devices.json / interfaces.json / # cables.json / ip-addresses.json payloads cargo run --bin netsim -- netbox import --from-dir ./snapshot/ --out ./netbox-lab/ # Reproduce the imported network in Containerlab (cables = explicit links) cargo run --bin netsim -- gen-lab \ --configs ./netbox-lab/ --links ./netbox-lab/netbox-topology.json \ --out ./lab-netbox/ --lab-name netbox-lab
Platform (OS) detection per device uses, in order: a per-device or slug
override from --platform-map <file> ({"slugs": {...}, "devices": {...}}),
the NetBox platform slug, the platform's NAPALM driver name (only
present in payloads from NetBox <= 3.5; removed in NetBox 3.6 and never
part of the platform object embedded in device responses), and finally
inference from the device-type manufacturer + model (e.g. Nokia 7220 IXR
-> sr-linux, Nokia 7750 SR -> sr-os). Devices whose platform cannot be
determined are reported and emitted without a platform. The detected
platform is stored on each IR device (same canonical strings the
parsers produce), so gen-lab boots the imported devices as native
Containerlab kinds per the table in the gen-lab section above —
e.g. sr-linux devices become nokia_srlinux nodes with a generated
SR Linux startup-config, while sr-os devices become nokia_sros
nodes whose vrnetlab-style image the user must build themselves (it
cannot be redistributed).
# Single assertion shorthand: assert: ping R1 -> R3 loopback # Multiple assertions: assertions: - ping R2 -> R1 loopback - ping R3 -> R2 loopback - ping R1 -> 1.1.1.1 - route R1 has 10.0.23.0/24
- Cisco IOS: Interfaces (IPv4/IPv6, VXLAN), OSPFv2, OSPFv3, IS-IS, BGP (peer groups, route reflectors, EVPN), SRv6 locators, prefix-lists, community-lists, route-maps.
- Junos: Set format syntax (
interfaces ... family inet/inet6/iso,routing-options static route,protocols ospf/ospf3/isis/bgp, EVPN/VXLAN, policy-statements). - Arista EOS: Interfaces (IPv4/IPv6, Vxlan), OSPFv2/OSPFv3, IS-IS, BGP, EVPN, SRv6 locators, prefix-lists, community-lists, route-maps.
- Cisco IOS XR: Hierarchical interface blocks, OSPF areas/interfaces, IS-IS, BGP EVPN, SRv6 locators and uSID, prefix-sets, RPL route-policies.
- FRRouting / SONiC: Interfaces, OSPFv2/OSPF6, IS-IS, BGP, EVPN, SRv6, prefix-lists, community-lists, route-maps.
- Nokia SR Linux: YANG JSON (
interface/subinterfaceIPv4/IPv6 addresses,systemhostname, default network-instance OSPFv2/OSPFv3 areas, BGP groups/neighbors, static routes via next-hop-groups). Non-default network-instances (VRFs) and other sections are reported as unsupported. Verified against real published configurations (an SR Linux v25.10.1 device-saved startup config, containerlab's clos02 example, and Nokia's documented static-route model — static routes sit directly undernetwork-instancewith a flatroutelist); seecrates/parse-srlinux/tests/fixtures/README.md. - Nokia SR OS (classic CLI + MD-CLI): Classic indented
configurehierarchy and flattened one-line statements: system name, router interfaces (IPv4/IPv6 incl. theipv6sub-block, description, shutdown, and theportbinding, recorded verbatim in the IR — plain1/1/1, VLAN-tagged1/1/1:12, orlag-1), OSPF/OSPFv3 areas/interfaces (passive, metric; router-id may be on theospfline), static-route-entry and legacy one-linestatic-route, BGP groups/neighbors. Unrecognized blocks in a realadmin display-configdump are reported once and skipped as a unit. Verified against real published display-config output (TiMOS-B-13.0.R1 / 14.0.R4). MD-CLI configurations are also supported and auto-detected, in both renderings: brace style (configure { ... }, theinfo/admin show configurationoutput) and flat style (one/configure ...statement per line, as written byadmin save). Both map the same subset to the same IR: system name; router interfaces (ipv4 primary address+prefix-length,ipv6 addressentries, description,admin-stateas the shutdown equivalent, theportbinding); router-id / autonomous-system;ospf/ospf3instance lists with areas and area interfaces (passive,metric);bgpgroups and neighbors (neighbors sit directly underbgpand reference their group with agroupleaf);static-routeswithnext-hop(black-hole and indirect routes are reported, as in classic mode). MD shapes were verified against Nokia's published SR OS 26.x YANG models (github.com/nokia/7x50_YangModels,sros_26.10) and real published MD-CLI samples (Nokia MD-CLI guide excerpts; device-saved files from srl-labs/sros-anysec-macsec-lab, TiMOS-C-23.10.R1); seecrates/parse-sros/tests/fixtures/README.md. A golden test asserts that the same network written in classic CLI, MD brace style and MD flat style produces identical IR.
Emitters: zebra (zebra-rs YAML), frr (FRRouting), and holo (Holo daemon RFC 7951 JSON: system hostname, interfaces, OSPFv2/OSPFv3, static routes; BGP/IS-IS/SR/policy features are reported as warnings rather than emitted with unverified keys). Holo output can be validated against the YANG schemas it is generated for — see --validate-yang above and the validate-holo subcommand.
Run the automated test suite locally:
cargo fmt --all -- --check
cargo test --workspace
cargo clippy --workspace --all-targets -- -D warnings