Comments (6)
Thank you for filing a bug. To be exact, ciscoconfparse.ccp_util.CiscoInterface
chokes on IOS XR interface names... it also happens with my git HEAD as shown below...
Have you been using IOS XR
factory before now?
The most basic problem is that IOS XR factory is not part of the test suite; it would have caught this problem if it was.
I need to do some reading about "IOS XR" interface names.
$ python
Python 3.10.13 (main, Nov 2 2023, 08:33:35) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ciscoconfparse.ccp_util import CiscoInterface
>>> CiscoInterface("MgmtEth0/RP0/CPU0/0")
2023-11-14 04:57:48.873 | ERROR | ciscoconfparse.ccp_util:__init__:3070 - An error has been caught in function '__init__', process 'MainProcess' (5229), thread 'MainThread' (139841872544384):
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
> File "/home/mpenning/fixme/ciscoconfparse/ciscoconfparse/ccp_util.py", line 3070, in __init__
self.update_internal_state(intf_dict=intf_dict)
│ │ └ {'prefix': 'MgmtEth', 'digit_separator': '/', 'slot': 0, 'card': None, 'port': None, 'subinterface': None, 'channel': None, '...
│ └ <function CiscoInterface.update_internal_state at 0x7f2f77de0e50>
└ <CiscoInterface None__UNINITIALIZED_NUMBER_ATTRIBUTE__>
File "/home/mpenning/fixme/ciscoconfparse/ciscoconfparse/ccp_util.py", line 3161, in update_internal_state
raise InvalidCiscoInterface(f"intf_dict={intf_dict}")
└ <class 'ciscoconfparse.errors.InvalidCiscoInterface'>
ciscoconfparse.errors.InvalidCiscoInterface: intf_dict={'prefix': 'MgmtEth', 'digit_separator': '/', 'slot': 0, 'card': None, 'port': None, 'subinterface': None, 'channel': None, 'interface_class': None}
2023-11-14 04:57:48.887 | ERROR | __main__:<module>:1 - An error has been caught in function '<module>', process 'MainProcess' (5229), thread 'MainThread' (139841872544384):
Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
File "/home/mpenning/fixme/ciscoconfparse/ciscoconfparse/ccp_util.py", line 3070, in __init__
self.update_internal_state(intf_dict=intf_dict)
│ │ └ {'prefix': 'MgmtEth', 'digit_separator': '/', 'slot': 0, 'card': None, 'port': None, 'subinterface': None, 'channel': None, '...
│ └ <function CiscoInterface.update_internal_state at 0x7f2f77de0e50>
└ <CiscoInterface None__UNINITIALIZED_NUMBER_ATTRIBUTE__>
File "/home/mpenning/fixme/ciscoconfparse/ciscoconfparse/ccp_util.py", line 3161, in update_internal_state
raise InvalidCiscoInterface(f"intf_dict={intf_dict}")
└ <class 'ciscoconfparse.errors.InvalidCiscoInterface'>
ciscoconfparse.errors.InvalidCiscoInterface: intf_dict={'prefix': 'MgmtEth', 'digit_separator': '/', 'slot': 0, 'card': None, 'port': None, 'subinterface': None, 'channel': None, 'interface_class': None}
2023-11-14 04:57:48.873 | ERROR | ciscoconfparse.ccp_util:__init__:3070 - An error has been caught in function '__init__', process 'MainProcess' (5229), thread 'MainThread' (139841872544384):
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
> File "/home/mpenning/fixme/ciscoconfparse/ciscoconfparse/ccp_util.py", line 3070, in __init__
self.update_internal_state(intf_dict=intf_dict)
│ │ └ {'prefix': 'MgmtEth', 'digit_separator': '/', 'slot': 0, 'card': None, 'port': None, 'subinterface': None, 'channel': None, '...
│ └ <function CiscoInterface.update_internal_state at 0x7f2f77de0e50>
└ <CiscoInterface None__UNINITIALIZED_NUMBER_ATTRIBUTE__>
File "/home/mpenning/fixme/ciscoconfparse/ciscoconfparse/ccp_util.py", line 3161, in update_internal_state
raise InvalidCiscoInterface(f"intf_dict={intf_dict}")
└ <class 'ciscoconfparse.errors.InvalidCiscoInterface'>
ciscoconfparse.errors.InvalidCiscoInterface: intf_dict={'prefix': 'MgmtEth', 'digit_separator': '/', 'slot': 0, 'card': None, 'port': None, 'subinterface': None, 'channel': None, 'interface_class': None}
2023-11-14 04:57:48.887 | ERROR | __main__:<module>:1 - An error has been caught in function '<module>', process 'MainProcess' (5229), thread 'MainThread' (139841872544384):
Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
File "/home/mpenning/fixme/ciscoconfparse/ciscoconfparse/ccp_util.py", line 3070, in __init__
self.update_internal_state(intf_dict=intf_dict)
│ │ └ {'prefix': 'MgmtEth', 'digit_separator': '/', 'slot': 0, 'card': None, 'port': None, 'subinterface': None, 'channel': None, '...
│ └ <function CiscoInterface.update_internal_state at 0x7f2f77de0e50>
└ <CiscoInterface None__UNINITIALIZED_NUMBER_ATTRIBUTE__>
File "/home/mpenning/fixme/ciscoconfparse/ciscoconfparse/ccp_util.py", line 3161, in update_internal_state
raise InvalidCiscoInterface(f"intf_dict={intf_dict}")
└ <class 'ciscoconfparse.errors.InvalidCiscoInterface'>
ciscoconfparse.errors.InvalidCiscoInterface: intf_dict={'prefix': 'MgmtEth', 'digit_separator': '/', 'slot': 0, 'card': None, 'port': None, 'subinterface': None, 'channel': None, 'interface_class': None}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/virtual_env/py310_test/lib/python3.10/site-packages/loguru/_logger.py", line 1277, in catch_wrapper
return function(*args, **kwargs)
File "/home/mpenning/fixme/ciscoconfparse/ciscoconfparse/ccp_util.py", line 3070, in __init__
self.update_internal_state(intf_dict=intf_dict)
File "/opt/virtual_env/py310_test/lib/python3.10/site-packages/loguru/_logger.py", line 1277, in catch_wrapper
return function(*args, **kwargs)
File "/home/mpenning/fixme/ciscoconfparse/ciscoconfparse/ccp_util.py", line 3161, in update_internal_state
raise InvalidCiscoInterface(f"intf_dict={intf_dict}")
ciscoconfparse.errors.InvalidCiscoInterface: intf_dict={'prefix': 'MgmtEth', 'digit_separator': '/', 'slot': 0, 'card': None, 'port': None, 'subinterface': None, 'channel': None, 'interface_class': None}
from ciscoconfparse.
FYI... This is not relevant to the bug, but you should not overwrite python functions... your example is overwriting int()
...
parse = CiscoConfParse(int_bad.splitlines(), syntax='ios', factory=True)
int = parse.find_objects_wo_child(r"^interf", r"^\s+^shutdown")
Would you mind donating your sanitized IOS XR config? I would like to be sure I know what else I'm dealing with before fixing this problem.
from ciscoconfparse.
I just pushed version 1.9.29 and added new syntax='iosxr'
...
Parsing an IOS XR config from the test fixtures works with 1.9.29...
from ciscoconfparse import CiscoConfParse
parse = CiscoConfParse("tests/fixtures/configs/sample_01.iosxr", syntax='iosxr', factory=True)
active_intfs = parse.find_objects_wo_child(r"^interf", r"^\s+shutdown")
Please consider adding one or two sanitized IOS XR configs since I only have one in the test fixtures at the moment...
from ciscoconfparse.
Hey, thanks a lot for your quick response!
Have you been using IOS XR factory before now?
Yes, syntax='iosxr', factory=True
and it worked well. Although the problem didn't occur because I used a different filter (parse.find_objects_w_child("^interface\s[\w\d\-\.\/]*$", "ipv\d\saddress.*")?
) and just some simple attributes (e.g. iface.name). While debugging my old code, I noticed the chocking can also happend on some attributes. e.g. simply hovering over some attributes in vscode.
Anyway. with 1.9.29 it works well. Although lot of attributes are missing - but this might be another topic.
I can supply some XR ASR/NCS 6.3/7.2/7.10 configs. please advice whats your preffered way.
from ciscoconfparse.
can supply some XR ASR/NCS 6.3/7.2/7.10 configs. please advice whats your preffered way.
Please send as text file attachments to my gmail, [email protected].
Although lot of attributes are missing - but this might be another topic.
Any missing IOS XR attributes are another topic.
I also just added version 1.9.32 to pypi.
from ciscoconfparse.
@Bierchermuesli thank you for donating the following configs via email:
from ciscoconfparse.
Related Issues (20)
- Github automated unit test failures (Python3.10) HOT 1
- [Bug]: IOSIntfLine object incorrectly parses an interface description containing a single character HOT 3
- UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 HOT 2
- [Bug]: CiscoConfParse cannot import dnspython during Github Automated test runs. HOT 2
- [Bug]: ModuleNotFoundError: No module named 'deprecat' HOT 1
- [Bug]: ModuleNotFoundError: No module named 'deprecat' persists on python 3.6 HOT 2
- Versions 1.7.21-1.7.23 are broken and should be yanked HOT 9
- [Feature]: IOS-XR Route-policy processed incorrectly HOT 4
- [Bug]: Seeing double entries on sync_diff() and order of negation reversed HOT 8
- [Bug]: dev_tools/deploy_docs does not 'make' HOT 1
- [Bug]: endless loop parsing (as factory=True) Dell FTOS9 ip/ipv6 static route with vlan HOT 1
- [Bug]: Issue parsing F5 BigIP config file HOT 6
- Documentation for syntax='nxos' HOT 1
- [Bug]: Version 1.6.41 is broken and should be yanked from pypi HOT 1
- [Bug]: Using append_line() causes issues HOT 1
- [Feature]: Add IOS XR Factory parsing HOT 3
- [FEATURE]: IOS diffs via ciscoconfparse.ciscoconfparse.Diff()
- Simplify API / remove legacy functions / methods HOT 2
- class CiscoConfParse has mutually exclusive parameters, factory = False, ignore_blank_lines = True HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ciscoconfparse.