cliscrape

** Phase 1: Core Parsing Engine

← Back to Network Automation ← Back to Projects

Concept

Network automation relies on parsing unstructured CLI output from devices. TextFSM handles this but suffers from Python’s GIL limitations and slow regex execution. This Rust-based parser replicates TextFSM’s state-machine semantics with native performance — parse massive show tech-support outputs in milliseconds, not seconds.


Key Features

TextFSM Compatibility

Full support for the TextFSM grammar. Use existing community templates (ntc-templates library) without modification. The parser translates .textfsm files into the internal FSM representation, enabling seamless migration from Python-based workflows.

State Machine Engine

Finite state machine processes text line-by-line with typed variables, state transitions, and actions (Next, Continue, Record, Clear). Pre-compiled regex patterns with fast dispatching via RegexSet.

TUI Debugger

Interactive template development environment showing real-time FSM state transitions, variable captures, and match visualization. See which line matched which rule and why — eliminates “regex soup” debugging.

Modern Template Format

Structured YAML/TOML templates as an alternative to TextFSM’s positional DSL:

values:
  interface: \S+
  ip_address: \d+\.\d+\.\d+\.\d+|unassigned
  status: up|down|administratively down
  protocol: up|down

states:
  Start:
    - match: ^${interface}\s+${ip_address}\s+\S+\s+\S+\s+${status}\s+${protocol}
      action: Record

Performance

Rust’s zero-cost abstractions and compiled regex engine deliver 10-50x faster parsing compared to Python TextFSM. Fully parallelizable across multiple files without GIL contention. Instant startup (compiled binary) vs. interpreted Python overhead.


Architecture

Core Components:

Memory Management:


Use Cases


Current Status

Phase 1 in progress — project scaffolding complete, defining lexer/parser for TextFSM files. Roadmap: FSM execution engine → CLI implementation → TUI debugger → modern YAML/TOML template support.


Tech Stack

Component Technology
Language Rust
Regex regex crate
TUI ratatui + crossterm
Parsing Custom lexer/parser
Templates TextFSM + YAML/TOML

← Back to Network Automation ← Back to Projects