Skip to content

Command Reference

sat edited this page Sep 17, 2025 · 1 revision

Command Reference

This page provides a complete reference for all dot2net commands and their options.

Global Usage

dot2net [COMMAND] [OPTIONS] <topology.dot>

Arguments:

  • <topology.dot> - Network topology file in DOT format (required)

Common Options:

  • -c, --config <file> - Configuration YAML file (default: input.yaml)
  • -v, --verbose - Enable verbose output

Important: Always run dot2net from the directory containing your configuration files, as the tool references files relative to the current working directory.

Commands

build - Generate Configuration Files

Generates configuration files based on the input topology and configuration templates.

dot2net build [OPTIONS] <topology.dot>

Examples:

# Basic usage (uses input.yaml by default)
dot2net build input.dot

# Specify custom config file
dot2net build -c custom.yaml input.dot

# With verbose output
dot2net build -v input.dot

# With CPU profiling
dot2net build -p profile.out input.dot

Example with ospf_simple scenario:

cd example/ospf_simple/
dot2net build -c input.yaml input.dot

This generates:

  • Node directories: r1/, r2/, r3/ containing device-specific configuration files
  • TiNET deployment: spec.yaml for TiNET network emulation
  • Containerlab deployment: topo.yaml for Containerlab container-based labs

Generated files for each router include:

r1/frr.conf    # FRR routing daemon configuration
r1/daemons     # FRR daemon startup configuration
r1/vtysh.conf  # FRR CLI configuration

Sample r1/frr.conf content:

ip forwarding
!
router ospf
 ospf router-id 10.0.255.1
 network 10.0.0.0/24 area 0
!
interface net0
 ip address 10.0.0.1/24
!

Options

Flag Alias Default Description
--config -c input.yaml Specify the configuration YAML file
--dir -d commands Directory name for per-device configuration files
--profile -p (empty) Profile CPU performance and output to specified file
--verbose -v false Enable verbose output

Output:

  • Node-specific configuration directories (e.g., r1/, r2/, r3/)
  • Platform-specific deployment files (spec.yaml for TiNET, topo.yaml for Containerlab)

params - List Available Parameters

Lists all parameters available for use in configuration templates.

dot2net params [OPTIONS] <topology.dot>

Examples:

# Show basic parameters
dot2net params input.dot

# Show all parameters including relative ones
dot2net params -a input.dot

# Output to file
dot2net params input.dot > params.txt

Example with ospf_simple scenario:

cd example/ospf_simple/
dot2net params -c input.yaml input.dot

Sample output (excerpt):

network:ospf_simple {{ .name }} = ospf_simple
node:r1 {{ .image }} = quay.io/frrouting/frr:8.5.4
node:r1 {{ .ip_loopback }} = 10.0.255.1
node:r1 {{ .kind }} = linux
node:r1 {{ .name }} = r1
interface:r1.net0 {{ .conn_name }} = conn0
interface:r1.net0 {{ .ip_addr }} = 10.0.0.1
interface:r1.net0 {{ .ip_net }} = 10.0.0.0/24
interface:r1.net0 {{ .ip_plen }} = 24
interface:r1.net0 {{ .name }} = net0
interface:r1.net0 {{ .node_name }} = r1
interface:r1.net0 {{ .node_ip_loopback }} = 10.0.255.1

This shows how parameters are automatically assigned:

  • IP addresses: Loopback (10.0.255.x) and interface IPs (10.0.0.x/24)
  • Cross-object references: {{ .conn_name }}, {{ .node_name }}, etc.
  • Platform-specific parameters: Container bind mounts, image specifications

Options

Flag Alias Default Description
--config -c input.yaml Specify the configuration YAML file
--all -a false Show all parameters including relative ones
--verbose -v false Enable verbose output

Output Format:

network {{ .network_name }} = example_network
node:r1 {{ .name }} = r1
node:r1 {{ .ip_loopback }} = 192.168.1.1

visual - Visualize IP Address Assignment

Generates a DOT file showing IP address assignments for visualization.

dot2net visual [OPTIONS] <topology.dot>

Examples:

# Generate visualization and create PDF
dot2net visual input.dot | dot -Tpdf > addr.pdf

# Visualize specific layer only
dot2net visual -l ipv4 input.dot > ipv4_layout.dot

# SVG output
dot2net visual input.dot | dot -Tsvg > addr.svg

Example with ospf_simple scenario:

cd example/ospf_simple/
dot2net visual -c input.yaml input.dot

Sample output:

digraph G {
	r1->r2 [ dir=none, headlabel="net0\n10.0.0.2", label="10.0.0.0/24", taillabel="net0\n10.0.0.1" ];
	r2->r3 [ dir=none, headlabel="net0\n10.0.1.2", label="10.0.1.0/24", taillabel="net1\n10.0.1.1" ];
	r1 [ label="r1\nlo: 10.0.255.1" ];
	r2 [ label="r2\nlo: 10.0.255.2" ];
	r3 [ label="r3\nlo: 10.0.255.3" ];
}

This DOT output shows:

  • Node labels: Router names with loopback IP addresses
  • Edge labels: Interface names and IP addresses on both ends
  • Network labels: Subnet information for each link (10.0.0.0/24, 10.0.1.0/24)

Generate a visual network diagram:

dot2net visual -c input.yaml input.dot | dot -Tpdf > ospf_network.pdf

Options

Flag Alias Default Description
--config -c input.yaml Specify the configuration YAML file
--layer -l (all layers) Specify layer name to visualize
--verbose -v false Enable verbose output

Requirements: GraphViz must be installed to generate visual output files.


data - Export Parameter Data

Outputs all calculated parameters in JSON format for external processing.

dot2net data [OPTIONS] <topology.dot>

Examples:

# Export to JSON file
dot2net data input.dot > network_data.json

# Use with jq for processing
dot2net data input.dot | jq '.nodes[].name'

Example with ospf_simple scenario:

cd example/ospf_simple/
dot2net data -c input.yaml input.dot

Sample output (excerpt):

{
  "name": "ospf_simple",
  "nodes": [
    {
      "name": "r1",
      "params": {
        "image": "quay.io/frrouting/frr:8.5.4",
        "ip_loopback": "10.0.255.1",
        "kind": "linux",
        "name": "r1"
      },
      "interfaces": [
        {
          "name": "net0",
          "params": {
            "conn_name": "conn0",
            "ip_addr": "10.0.0.1",
            "ip_net": "10.0.0.0/24",
            "ip_plen": "24",
            "node_name": "r1",
            "node_ip_loopback": "10.0.255.1"
          }
        }
      ]
    }
  ]
}

Extract specific information with jq:

# Get all node names
dot2net data -c input.yaml input.dot | jq -r '.nodes[].name'

# Get all IP addresses
dot2net data -c input.yaml input.dot | jq -r '.nodes[].interfaces[].params.ip_addr'

# Get network topology summary
dot2net data -c input.yaml input.dot | jq '{network: .name, node_count: (.nodes | length)}'

Options

Flag Alias Default Description
--config -c input.yaml Specify the configuration YAML file

files - List Generated Files

Shows what files would be generated by the build command without actually creating them.

dot2net files [OPTIONS] <topology.dot>

Examples:

# List all files that would be generated
dot2net files input.dot

# With verbose details
dot2net files -v input.dot

Example with ospf_simple scenario:

cd example/ospf_simple/
dot2net files -c input.yaml input.dot

Sample output:

r1/daemons
r1/frr.conf
r1/vtysh.conf
r2/daemons
r2/frr.conf
r2/vtysh.conf
r3/daemons
r3/frr.conf
r3/vtysh.conf
spec.yaml
topo.yaml

This shows all files that would be created by dot2net build:

  • Node configuration directories: One per router (r1/, r2/, r3/)
  • FRR configuration files: frr.conf, daemons, vtysh.conf for each router
  • Platform deployment files: spec.yaml (TiNET), topo.yaml (Containerlab)

Options

Flag Alias Default Description
--config -c input.yaml Specify the configuration YAML file
--verbose -v false Enable verbose output

clean - Delete Generated Files

Removes configuration files that were generated by previous build commands.

dot2net clean [OPTIONS] <topology.dot>

Examples:

# Delete all generated files
dot2net clean input.dot

# Preview what would be deleted (dry run)
dot2net clean --dry-run input.dot

# With verbose output
dot2net clean -v input.dot

Example with ospf_simple scenario:

cd example/ospf_simple/
dot2net clean --dry-run -c input.yaml input.dot

Sample output:

Would delete: r1/daemons
Would delete: r1/frr.conf
Would delete: r1/vtysh.conf
Would delete: r2/daemons
Would delete: r2/frr.conf
Would delete: r2/vtysh.conf
Would delete: r3/daemons
Would delete: r3/frr.conf
Would delete: r3/vtysh.conf
Would delete: spec.yaml
Would delete: topo.yaml

Actually delete the files:

dot2net clean -c input.yaml input.dot

The --dry-run option is especially useful for:

  • Verification: Checking what files would be affected before deletion
  • Safety: Avoiding accidental deletion of important files
  • Debugging: Understanding what files dot2net considers "generated"

Options

Flag Alias Default Description
--config -c input.yaml Specify the configuration YAML file
--verbose -v false Enable verbose output
--dry-run false Show what would be deleted without actually deleting

Common Workflows

Development Workflow

# 1. Design and test
dot2net files input.dot                         # Preview generated files
dot2net params input.dot                        # Check parameter assignments
dot2net build -v input.dot                      # Generate with verbose output

# 2. Deploy and test
sudo containerlab deploy --topo topo.yaml       # Deploy with Containerlab
# or
tinet up -c spec.yaml | sudo sh -x              # Deploy with TiNET

# 3. Cleanup
dot2net clean input.dot                         # Remove generated files

Debugging Workflow

# Check parameter assignments
dot2net params -a input.dot > debug_params.txt

# Generate with detailed output
dot2net build -v input.dot 2> debug_build.log

# Visualize IP assignments
dot2net visual input.dot | dot -Tpdf > debug_layout.pdf

Exit Codes

  • 0: Success
  • 1: General error (invalid arguments, file not found, configuration conflicts, etc.)

Notes

  • The DOT topology file is always required as a positional argument
  • Configuration files are referenced relative to the current working directory
  • Use --verbose flag for detailed output when troubleshooting
  • The --dry-run option for clean command is useful for safely previewing deletions
  • Default configuration file name is input.yaml to match project conventions

Clone this wiki locally