# klevernet/cisco_config_parser architecture

> Architecture diagram of the GitHub repository klevernet/cisco_config_parser, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/klevernet/cisco_config_parser
- Repository: https://github.com/klevernet/cisco_config_parser

## Overview

This is a Cisco running-configuration parsing library, not a device-management service. A caller supplies configuration text to ConfigParser; platform detection and specialized parsers produce structured objects or the whole-device dictionary/JSON-able model. Distinct branches cover interfaces, routing, policy/configuration sections, generic hierarchy and custom searches, plus cross-reference validation. The README documents broader section support than the sampled implementations show; those branches are represented at their supported directory paths without asserting unsampled internal calls.

Main entry points: [`cisco_config_parser/parser/parser.py`](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/parser/parser.py) (ConfigParser), [`cisco_config_parser/layer2_interface/l2_interface_parser.py`](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer2_interface/l2_interface_parser.py) (Layer 2 interfaces), [`cisco_config_parser/layer3_interface/l3_interface_parser.py`](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer3_interface/l3_interface_parser.py) (Layer 3 interfaces), [`cisco_config_parser/parent_child/parent_child_parser.py`](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/parent_child/parent_child_parser.py) (Parent-child search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Parser entry"]
  node_configparser["ConfigParser<br/>[parser.py]"]
  node_platform_regex["Platform detection regex<br/>[ios_regex.py]"]
  node_whole_model["Device model<br/>[parser.py]"]
end

subgraph group_interfaces["Interfaces"]
  node_l2_parser["Layer 2 interfaces"]
  node_l2_sections["L2 field parsing"]
  node_l2_objects["L2 interface objects"]
  node_l2_separator["L2 section splitting"]
  node_l3_parser["Layer 3 interfaces"]
  node_l3_sections["L3 field parsing"]
  node_l3_objects["L3 interface objects"]
  node_l3_separator["L3 section splitting"]
end

subgraph group_configuration["Configuration parsing"]
  node_parentchild["Parent-child search"]
  node_parentchild_obj["Parent-child objects"]
  node_parentchild_separator["Parent-child splitting"]
  node_global_search["Global search<br/>[global_parser.py]"]
  node_global_obj["VLAN and banner objects<br/>[global_obj.py]"]
  node_global_separator["Global section splitting"]
  node_configtree["ConfigTree hierarchy<br/>[config_tree.py]"]
  node_regex["Shared regex definitions<br/>[common_regex.py]"]
  node_legacy["Legacy parser<br/>[old_parse.py]"]
end

subgraph group_routing["Routing protocols"]
  node_routing["Platform routing parsers"]
  node_ios_routing_obj["IOS routing objects<br/>[rtp_ios_rtp_obj.py]"]
end

subgraph group_sections["Sections and validation"]
  node_section_parsers["Configuration sections"]
  node_section_obj["Section objects<br/>[section_obj.py]"]
  node_xref["Cross-reference validation<br/>[xref.py]"]
end

node_caller(("Automation caller"))

node_caller -->|"supplies config"| node_configparser
node_configparser -->|"detects platform"| node_platform_regex
node_configparser -->|"dispatches parsing"| node_l2_parser
node_configparser -->|"dispatches parsing"| node_l3_parser
node_configparser -->|"dispatches search"| node_parentchild
node_configparser -->|"dispatches parsing"| node_global_search
node_configparser -->|"selects platform parser"| node_routing
node_configparser -->|"dispatches sections"| node_section_parsers
node_configparser -->|"builds model"| node_whole_model
node_whole_model -->|"optionally includes"| node_configtree
node_l2_parser -->|"splits interfaces"| node_l2_separator
node_l2_parser -->|"parses custom fields"| node_l2_sections
node_l2_parser -->|"creates objects"| node_l2_objects
node_l3_parser -->|"splits interfaces"| node_l3_separator
node_l3_parser -->|"parses fields"| node_l3_sections
node_l3_parser -->|"creates objects"| node_l3_objects
node_parentchild -->|"splits sections"| node_parentchild_separator
node_parentchild -->|"creates objects"| node_parentchild_obj
node_global_search -->|"finds VLAN sections"| node_global_separator
node_global_search -->|"creates objects"| node_global_obj
node_routing -->|"uses IOS objects"| node_ios_routing_obj
node_section_parsers -->|"builds section objects"| node_section_obj
node_xref -->|"scans hierarchy"| node_configtree
node_legacy -->|"uses IOS patterns"| node_regex

click node_configparser "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/parser/parser.py"
click node_platform_regex "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/parser_regex/ios_regex.py"
click node_whole_model "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/parser/parser.py"
click node_l2_parser "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer2_interface/l2_interface_parser.py"
click node_l2_sections "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer2_interface/l2_section_parser.py"
click node_l2_objects "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer2_interface/l2_interface_obj.py"
click node_l2_separator "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer2_interface/l2_interface_separator.py"
click node_l3_parser "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer3_interface/l3_interface_parser.py"
click node_l3_sections "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer3_interface/l3_section_parser.py"
click node_l3_objects "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer3_interface/l3_interface_obj.py"
click node_l3_separator "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer3_interface/l3_interface_separator.py"
click node_parentchild "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/parent_child/parent_child_parser.py"
click node_parentchild_obj "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/parent_child/parent_child_obj.py"
click node_parentchild_separator "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/parent_child/parent_child_separator.py"
click node_global_search "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/global_search/global_parser.py"
click node_global_obj "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/global_search/global_obj.py"
click node_global_separator "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/global_search/global_separator.py"
click node_configtree "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/config_tree/config_tree.py"
click node_regex "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/parser_regex/common_regex.py"
click node_legacy "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/old_version/old_parse.py"
click node_routing "https://github.com/klevernet/cisco_config_parser/tree/main/cisco_config_parser/routing_protocol"
click node_ios_routing_obj "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/routing_protocol/ios/rtp_ios_rtp_obj.py"
click node_section_parsers "https://github.com/klevernet/cisco_config_parser/tree/main/cisco_config_parser/sections"
click node_section_obj "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/sections/section_obj.py"
click node_xref "https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/sections/xref.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_configparser,node_platform_regex,node_whole_model toneBlue
class node_l2_parser,node_l2_sections,node_l2_objects,node_l2_separator,node_l3_parser,node_l3_sections,node_l3_objects,node_l3_separator toneAmber
class node_parentchild,node_parentchild_obj,node_parentchild_separator,node_global_search,node_global_obj,node_global_separator,node_configtree,node_regex,node_legacy toneMint
class node_routing,node_ios_routing_obj toneRose
class node_section_parsers,node_section_obj,node_xref,node_caller toneIndigo
```

## Components

### Parser entry

- [ConfigParser](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/parser/parser.py): `cisco_config_parser/parser/parser.py`
- [Platform detection regex](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/parser_regex/ios_regex.py): `cisco_config_parser/parser_regex/ios_regex.py`
- [Device model](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/parser/parser.py): `cisco_config_parser/parser/parser.py`

### Interfaces

- [Layer 2 interfaces](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer2_interface/l2_interface_parser.py): `cisco_config_parser/layer2_interface/l2_interface_parser.py`
- [L2 field parsing](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer2_interface/l2_section_parser.py): `cisco_config_parser/layer2_interface/l2_section_parser.py`
- [L2 interface objects](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer2_interface/l2_interface_obj.py): `cisco_config_parser/layer2_interface/l2_interface_obj.py`
- [L2 section splitting](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer2_interface/l2_interface_separator.py): `cisco_config_parser/layer2_interface/l2_interface_separator.py`
- [Layer 3 interfaces](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer3_interface/l3_interface_parser.py): `cisco_config_parser/layer3_interface/l3_interface_parser.py`
- [L3 field parsing](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer3_interface/l3_section_parser.py): `cisco_config_parser/layer3_interface/l3_section_parser.py`
- [L3 interface objects](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer3_interface/l3_interface_obj.py): `cisco_config_parser/layer3_interface/l3_interface_obj.py`
- [L3 section splitting](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/layer3_interface/l3_interface_separator.py): `cisco_config_parser/layer3_interface/l3_interface_separator.py`

### Configuration parsing

- [Parent-child search](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/parent_child/parent_child_parser.py): `cisco_config_parser/parent_child/parent_child_parser.py`
- [Parent-child objects](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/parent_child/parent_child_obj.py): `cisco_config_parser/parent_child/parent_child_obj.py`
- [Parent-child splitting](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/parent_child/parent_child_separator.py): `cisco_config_parser/parent_child/parent_child_separator.py`
- [Global search](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/global_search/global_parser.py): `cisco_config_parser/global_search/global_parser.py`
- [VLAN and banner objects](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/global_search/global_obj.py): `cisco_config_parser/global_search/global_obj.py`
- [Global section splitting](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/global_search/global_separator.py): `cisco_config_parser/global_search/global_separator.py`
- [ConfigTree hierarchy](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/config_tree/config_tree.py): `cisco_config_parser/config_tree/config_tree.py`
- [Shared regex definitions](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/parser_regex/common_regex.py): `cisco_config_parser/parser_regex/common_regex.py`
- [Legacy parser](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/old_version/old_parse.py): `cisco_config_parser/old_version/old_parse.py`

### Routing protocols

- [Platform routing parsers](https://github.com/klevernet/cisco_config_parser/tree/main/cisco_config_parser/routing_protocol): `cisco_config_parser/routing_protocol`
- [IOS routing objects](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/routing_protocol/ios/rtp_ios_rtp_obj.py): `cisco_config_parser/routing_protocol/ios/rtp_ios_rtp_obj.py`

### Sections and validation

- [Configuration sections](https://github.com/klevernet/cisco_config_parser/tree/main/cisco_config_parser/sections): `cisco_config_parser/sections`
- [Section objects](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/sections/section_obj.py): `cisco_config_parser/sections/section_obj.py`
- [Cross-reference validation](https://github.com/klevernet/cisco_config_parser/blob/main/cisco_config_parser/sections/xref.py): `cisco_config_parser/sections/xref.py`

### Other components

- **Automation caller**

## Connections

- Automation caller → ConfigParser: supplies config
- ConfigParser → Platform detection regex: detects platform (evidence: `cisco_config_parser/parser/parser.py`)
- ConfigParser → Layer 2 interfaces: dispatches parsing (evidence: `cisco_config_parser/parser/parser.py`)
- ConfigParser → Layer 3 interfaces: dispatches parsing (evidence: `cisco_config_parser/parser/parser.py`)
- ConfigParser → Parent-child search: dispatches search (evidence: `cisco_config_parser/parser/parser.py`)
- ConfigParser → Global search: dispatches parsing (evidence: `cisco_config_parser/parser/parser.py`)
- ConfigParser → Platform routing parsers: selects platform parser (evidence: `cisco_config_parser/parser/parser.py`)
- ConfigParser → Configuration sections: dispatches sections (evidence: `cisco_config_parser/parser/parser.py`)
- ConfigParser → Device model: builds model (evidence: `cisco_config_parser/parser/parser.py`)
- Device model → ConfigTree hierarchy: optionally includes (evidence: `cisco_config_parser/parser/parser.py`)
- Layer 2 interfaces → L2 section splitting: splits interfaces (evidence: `cisco_config_parser/layer2_interface/l2_interface_parser.py`)
- Layer 2 interfaces → L2 field parsing: parses custom fields (evidence: `cisco_config_parser/layer2_interface/l2_interface_parser.py`)
- Layer 2 interfaces → L2 interface objects: creates objects (evidence: `cisco_config_parser/layer2_interface/l2_interface_parser.py`)
- Layer 3 interfaces → L3 section splitting: splits interfaces (evidence: `cisco_config_parser/layer3_interface/l3_interface_parser.py`)
- Layer 3 interfaces → L3 field parsing: parses fields (evidence: `cisco_config_parser/layer3_interface/l3_interface_parser.py`)
- Layer 3 interfaces → L3 interface objects: creates objects (evidence: `cisco_config_parser/layer3_interface/l3_interface_parser.py`)
- Parent-child search → Parent-child splitting: splits sections (evidence: `cisco_config_parser/parent_child/parent_child_parser.py`)
- Parent-child search → Parent-child objects: creates objects (evidence: `cisco_config_parser/parent_child/parent_child_parser.py`)
- Global search → Global section splitting: finds VLAN sections (evidence: `cisco_config_parser/global_search/global_parser.py`)
- Global search → VLAN and banner objects: creates objects (evidence: `cisco_config_parser/global_search/global_parser.py`)
- Platform routing parsers → IOS routing objects: uses IOS objects (evidence: `cisco_config_parser/routing_protocol/ios/rtp_bgp.py`)
- Configuration sections → Section objects: builds section objects (evidence: `cisco_config_parser/sections/netflow.py`)
- Cross-reference validation → ConfigTree hierarchy: scans hierarchy (evidence: `cisco_config_parser/sections/xref.py`)
- Legacy parser → Shared regex definitions: uses IOS patterns (evidence: `cisco_config_parser/old_version/old_parse.py`)
