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

Traceback while using ipaddress.collapse_addresses() #203

Closed mpenning closed 2 years ago

mpenning commented 3 years ago

Please fix issues blocking use of ipaddress.collapse_addresses()

Currently, we don't expose an attribute called _prefixlen. There are a few other attributes to support, and we need to be sure we handle IPv4Obj() and IPv6Obj() correctly. This issue also includes implementation of a new supernet attribute.

>>> from ipaddress import IPv4Network, collapse_addresses
>>> from ciscoconfparse.ccp_util import IPv4Obj
>>>
>>> foo = collapse_addresses([IPv4Obj("172.16.2.0/24"), IPv4Obj("172.16.3.0/24")])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/python37/lib/python3.7/ipaddress.py", line 335, in collapse_addresses
    elif ip._prefixlen == ip._max_prefixlen:
AttributeError: 'IPv4Obj' object has no attribute '_prefixlen'
>>>
github-actions[bot] commented 2 years ago

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.

github-actions[bot] commented 2 years ago

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

github-actions[bot] commented 2 years ago

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

github-actions[bot] commented 2 years ago

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