Skip to main content

Crate ios_config

Crate ios_config 

Source
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

SectionTypes
InterfacesGigabitEthernet, FastEthernet, TenGigabitEthernet, Loopback, Vlan, Tunnel, Serial
L2switchport access/trunk, voice vlan, storm-control, STP per-interface
Routingstatic routes, OSPF (multi-process), BGP (neighbors, peer-groups, address-families), EIGRP
ACLstandard and extended, named and numbered
NATdynamic, PAT/overload, static
ManagementNTP, DNS, SNMP, AAA, SSH, line vty, local users, banner
Global STPmode, loopguard, portfast/bpduguard defaults, per-VLAN priority
Unknownunrecognized commands preserved in unknown_blocks

Structs§

AaaConfig
aaa new-model configuration.
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.
BgpAddressFamily
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> …).
BgpPeerGroup
A BGP peer-group definition.
EigrpProcess
A router eigrp <asn> block.
GlobalStp
Global spanning-tree configuration (spanning-tree … at global level).
HsrpGroup
An HSRP group configured on an interface.
HsrpTimers
HSRP hello/hold timers in milliseconds.
HsrpTrack
standby <id> track <object> decrement <n>
Interface
A single interface … block.
InterfaceName
Parsed and normalized interface name.
InterfaceOspf
Per-interface OSPF parameters (ip ospf …).
InterfaceStp
Per-interface spanning-tree settings.
IpAddress
An IPv4 address/prefix assigned to an interface.
L2Config
Layer-2 switchport configuration.
LineVty
line vty 0 4 (or 0 15) configuration block.
LocalUser
A local user account defined by username … privilege … secret/password ….
LoggingConfig
Logging subsystem configuration.
NatPool
An ip nat pool <name> … definition.
NatRule
A NAT rule (ip nat inside source …).
NatStaticEntry
A static NAT mapping (ip nat inside source static …).
NetworkConfig
Root object returned by the ios_config::parse function.
NtpServer
An ntp server … entry.
OspfAreaConfig
Per-area OSPF configuration.
OspfDefaultOriginate
default-information originate parameters.
OspfIfTimers
OSPF interface hello/dead timers (seconds).
OspfNetwork
A network <addr> <wildcard> area <id> statement.
OspfProcess
A router ospf <pid> process block.
OspfRedistribute
A redistribute <source> … statement inside a routing process.
RoutingConfig
All routing configuration parsed from the config.
SnmpCommunity
An snmp-server community <name> RO|RW entry.
SnmpConfig
snmp-server configuration.
SshConfig
ip ssh configuration.
StaticRoute
A single ip route <prefix> … entry.
StormControl
storm-control broadcast/multicast/unicast levels (percentage).
StpVlanPriority
Per-VLAN STP priority override.
UnknownBlock
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.
BgpNeighborAddr
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.
InterfaceKind
Interface type discriminant.
InterfaceSpeed
Interface speed configuration.
L2Mode
Switchport operating mode.
NatDirection
ip nat inside / ip nat outside marker on an interface.
NatType
NAT rule type.
NextHop
Next-hop specification for a static route.
OspfArea
OSPF area identifier.
OspfAreaType
OSPF area type.
OspfAuth
OSPF authentication configuration.
OspfNetworkType
OSPF network type for an interface.
ParseError
Parse errors returned by parse.
PasswordType
Password storage type as encoded in the config.
RedistributeSource
Source protocol for redistribution.
SnmpAccess
SNMP community access level.
StpMode
STP operational mode.

Functions§

parse
Parse a Cisco IOS show running-config string into a NetworkConfig.