mpenning / ciscoconfparse

Parse, Audit, Query, Build, and Modify Arista / Cisco / Juniper / Palo Alto / F5 configurations.
http://www.pennington.net/py/ciscoconfparse/
GNU General Public License v3.0
793 stars 220 forks source link

Factory=True, syntax='ios' doesn't parse NXOS-style static routes #71

Closed mpenning closed 6 years ago

mpenning commented 7 years ago

CONFIG = """ip route 0.0.0.0/0 port-channel1 1.1.1.1
ip route 1.1.1.2/32 Vlan42  2.2.2.2"""

parse =CiscoConfParse(CONFIG.splitlines(), syntax='ios', factory=True)

Fails with ValueError: Could not parse 'ip route 0.0.0.0/0 port-channel1 1.1.1.1'

This is a known-failure; this configuration will parse correctly when I add a factory=True, syntax='nxos' parser. The workaround is to parse with factory=False (i.e. the default CiscoConfParse() behavior).

voltivo commented 7 years ago

It would be awesome if that could be addressed. Thank you for an amazing toolkit!

mpenning commented 6 years ago

To use the new nxos parser (alpha-quality at best),

from ciscoconfparse import CiscoConfParse

CONFIG = """ip route 0.0.0.0/0 port-channel1 1.1.1.1
ip route 1.1.1.2/32 Vlan42  2.2.2.2"""

parse =CiscoConfParse(CONFIG.splitlines(), syntax='nxos', factory=True)
voltivo commented 6 years ago

Thank you!