Expand description
§ios-config
A Cisco IOS show running-config parser that produces a typed intermediate
representation (IR) covering interfaces, routing (OSPF, BGP, static),
ACLs, NAT, VLANs, SNMP, AAA, STP, and more.
§Quick start
use ios_config::parse;
let raw = r#"
hostname CORE-RTR-01
!
interface GigabitEthernet0/0
description WAN
ip address 203.0.113.1 255.255.255.252
no shutdown
!
router ospf 1
router-id 1.1.1.1
network 203.0.113.0 0.0.0.3 area 0
"#;
let config = parse(raw).unwrap();
assert_eq!(config.hostname.as_deref(), Some("CORE-RTR-01"));
assert_eq!(config.interfaces.len(), 1);
assert_eq!(config.routing.ospf.len(), 1);§What gets parsed
| Section | Types |
|---|---|
| Interfaces | GigabitEthernet, FastEthernet, TenGigabitEthernet, Loopback, Vlan, Tunnel, Serial |
| L2 | switchport access/trunk, voice vlan, storm-control, STP per-interface |
| Routing | static routes, OSPF (multi-process), BGP (neighbors, peer-groups, address-families), EIGRP |
| ACL | standard and extended, named and numbered |
| NAT | dynamic, PAT/overload, static |
| Management | NTP, DNS, SNMP, AAA, SSH, line vty, local users, banner |
| Global STP | mode, loopguard, portfast/bpduguard defaults, per-VLAN priority |
| Unknown | unrecognized commands preserved in unknown_blocks |
Structs§
- AaaConfig
aaa new-modelconfiguration.- AaaMethod
- An AAA method list entry.
- Acl
- An IP access control list (standard or extended, named or numbered).
- AclEntry
- A single ACE (access control entry) line.
- BgpAddress
Family - A BGP
address-family <afi> <safi>block. - BgpAggregate
- A
aggregate-address <prefix> …entry. - BgpConfig
- A
router bgp <asn>block. - BgpNeighbor
- A BGP neighbor entry (
neighbor <addr|peer-group> …). - BgpPeer
Group - A BGP peer-group definition.
- Eigrp
Process - A
router eigrp <asn>block. - Global
Stp - Global spanning-tree configuration (
spanning-tree …at global level). - Hsrp
Group - An HSRP group configured on an interface.
- Hsrp
Timers - HSRP hello/hold timers in milliseconds.
- Hsrp
Track standby <id> track <object> decrement <n>- Interface
- A single
interface …block. - Interface
Name - Parsed and normalized interface name.
- Interface
Ospf - Per-interface OSPF parameters (
ip ospf …). - Interface
Stp - Per-interface spanning-tree settings.
- IpAddress
- An IPv4 address/prefix assigned to an interface.
- L2Config
- Layer-2 switchport configuration.
- LineVty
line vty 0 4(or0 15) configuration block.- Local
User - A local user account defined by
username … privilege … secret/password …. - Logging
Config - Logging subsystem configuration.
- NatPool
- An
ip nat pool <name> …definition. - NatRule
- A NAT rule (
ip nat inside source …). - NatStatic
Entry - A static NAT mapping (
ip nat inside source static …). - Network
Config - Root object returned by the
ios_config::parsefunction. - NtpServer
- An
ntp server …entry. - Ospf
Area Config - Per-area OSPF configuration.
- Ospf
Default Originate default-information originateparameters.- Ospf
IfTimers - OSPF interface hello/dead timers (seconds).
- Ospf
Network - A
network <addr> <wildcard> area <id>statement. - Ospf
Process - A
router ospf <pid>process block. - Ospf
Redistribute - A
redistribute <source> …statement inside a routing process. - Routing
Config - All routing configuration parsed from the config.
- Snmp
Community - An
snmp-server community <name> RO|RWentry. - Snmp
Config snmp-serverconfiguration.- SshConfig
ip sshconfiguration.- Static
Route - A single
ip route <prefix> …entry. - Storm
Control storm-controlbroadcast/multicast/unicast levels (percentage).- StpVlan
Priority - Per-VLAN STP priority override.
- Unknown
Block - A command that the parser did not recognize.
- Vlan
- A
vlan <id>database entry.
Enums§
- AclAction
- ACE action.
- AclMatch
- Address match criterion in an ACE.
- AclName
- ACL identifier.
- AclPort
- Port match operator in an extended ACE.
- AclProtocol
- Protocol field in an extended ACE.
- AclType
- ACL type controlling which fields are matched.
- BgpAfi
- BGP address family indicator.
- BgpNeighbor
Addr - BGP neighbor address — either an IP or a peer-group name.
- BgpSafi
- BGP subsequent address family indicator.
- Confidence
- Parser confidence level for a recognized element.
- Duplex
- Interface duplex setting.
- Interface
Kind - Interface type discriminant.
- Interface
Speed - Interface speed configuration.
- L2Mode
- Switchport operating mode.
- NatDirection
ip nat inside/ip nat outsidemarker on an interface.- NatType
- NAT rule type.
- NextHop
- Next-hop specification for a static route.
- Ospf
Area - OSPF area identifier.
- Ospf
Area Type - OSPF area type.
- Ospf
Auth - OSPF authentication configuration.
- Ospf
Network Type - OSPF network type for an interface.
- Parse
Error - Parse errors returned by
parse. - Password
Type - Password storage type as encoded in the config.
- Redistribute
Source - Source protocol for redistribution.
- Snmp
Access - SNMP community access level.
- StpMode
- STP operational mode.
Functions§
- parse
- Parse a Cisco IOS
show running-configstring into aNetworkConfig.