Closed metrax closed 2 years ago
Hello @Metrax,
I removed the bug label because this is not a bug. The way you're using the factory parser is not correct.
from ciscoconfparse import CiscoConfParse
parse = CiscoConfParse("configs/file.txt",factory=True)
# ^^^^^^^^^^^^
What are you hoping to do once the configuration is parsed?
This will work with no problems...
from ciscoconfparse import CiscoConfParse
asa_config = ['ipv6 route testnetz_transfer aaaa:aaaa:aaaa:bbbb::/64 aaaa:aaaa:aaaa:aaaa::2']
parse = CiscoConfParse(asa_config)
Please note that factory
is False
by default; the factory
functionality is somewhere between alpha and beta quality (depending on what you're trying to do). If you try to use factory=True
, the configuration syntax is checked against expected IOS static route configuration syntax (because syntax
defaults to ios
). However IOS doesn't use interface zone names...
Unfortunately, parsing with the ASA config factory classifier is not in a useful state for ASA static routes as of version 1.6.40. I can consider this as a request to change ASA factory parsing to understand ASA static routes... but as soon as you get that, there are 20 other ASA syntax factory features that won't work.
Hi @mpenning,
i'm using ciscoconfparse to automatically import the interfaces, the vlans and ip addresses from our cisco routers, switches and the ASAs config to netbox (https://github.com/netbox-community/netbox/).
I've started without factory mode, but had some problems, i dont' remember them. I just remember that it was realy complicated for me, to use it. I also tried the ASA module, but got a lot of errors. After activating factory mode, i could use the module easily for importing the interfaces and their configurations. It was working fine, until the colleagues from the firewall administration added the ipv6 route rules (unfortunatly on my request ... hehe :-( ).
I've fixed my issue now, with removing the ipv6 route lines before parsing the configuration with ciscoconfparse. Its fine, because i don't need these options for my script.
But it would be nice, if you can add this later.
Thank you very much (also for this awesome libary).
Bests,
Metrax
This issue has automatically been marked stale due to inactivity. The issue will close unless further activity occurs. Please understand that the CiscoConfParse team is not obligated to comment on every issue. For more detailed information, please refer to our CONTRIBUTING guidance -> https://github.com/mpenning/ciscoconfparse/blob/main/.github/CONTRIBUTING.md
Due to inactivity, CiscoConfParse's maintainers are closing this issue. Please refrain from further comments. In the future, CiscoConfParse's maintainers may reopen it solely at their own discretion. For more detailed information, please refer to our CONTRIBUTING guidance -> https://github.com/mpenning/ciscoconfparse/blob/main/.github/CONTRIBUTING.md
Contact Details
metrax@metrax.eu
What happened?
Could not parse 'ipv6 route testnetz_transfer aaaa:aaaa:aaaa:bbbb::/64 aaaa:aaaa:aaaa:aaaa::2'
It looks like that the regex in modesl_cisco.py line 63864 is not detecting this string. I've played around a little bit with the regex, but couldn't fix it (due to my bad regex skills ;-)).
It's a Cisco ASA5550
CiscoConfParse Version
1.6.40
What Operating System are you using?
Linux - Debian, Ubuntu, CentOS, RHEL or others
What Python version(s) have this problem?
Python 3.8
Show us how to reproduce the problem. Please tell us if the problem is specific to certain inputs or situations.
Python tracebacks
Relevant log output
No response
Code of Conduct