netconv-core 0.1.0

Vendor-agnostic IR (intermediate representation) types and traits for network device configuration conversion. Used by ios-config and the netconv renderers.
Documentation
  • Coverage
  • 6.54%
    31 out of 474 items documented0 out of 101 items with examples
  • Size
  • Source code size: 45.01 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 5.45 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • casablanque-code/netconv
    3 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • casablanque-code

netconv-core

Vendor-agnostic IR (intermediate representation) types and traits for network device configuration conversion — the shared foundation that ios-config (parser) and the netconv-render-* crates (renderers) are built on.

What's in it

  • ir — the typed NetworkConfig model (interfaces, routing, ACLs, NAT, VLANs, and more) that a vendor-specific parser fills in and a vendor-specific renderer reads back out. Vendor-neutral by design: the same NetworkConfig value can, in principle, come from any parser and go to any renderer.
  • traits::ConfigParser / traits::ConfigRenderer — the two traits a parser and a renderer implement, plus convert() / convert_with_profile(), which wire a ConfigParser + a ConfigRenderer together into a single parse → render pipeline.
  • report::ConversionReport — collects what a parser didn't recognize and what a renderer had to skip or handle manually, instead of either silently dropping input or silently emitting something wrong.
  • profile::DeviceProfile — the L2Switch / L3Router split, and detect_domain_mismatches(), which flags IR content that doesn't belong to the profile being converted for (e.g. routing config found while converting for an L2 switch profile) before a renderer gets a chance to render it anyway.

Example

use netconv_core::{ConfigParser, ConfigRenderer, convert};

fn run<P: ConfigParser, R: ConfigRenderer>(parser: &P, renderer: &R, raw: &str) {
    let output = convert(parser, renderer, raw).expect("conversion failed");
    println!("{}", output.config_text);
    if !output.report.items.is_empty() {
        eprintln!("{} item(s) need review", output.report.items.len());
    }
}

This crate has no parser or renderer of its own — see ios-config for an implementation of ConfigParser, or the main netconv repository for the CLI, web UI, and renderers.

License

MIT