Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IX-F importer fails on nulled ipv4 / ipv6 properties in vlan_list entries #1244

Closed
vegu opened this issue Sep 14, 2022 · 7 comments · Fixed by #1259 or #1269
Closed

IX-F importer fails on nulled ipv4 / ipv6 properties in vlan_list entries #1244

vegu opened this issue Sep 14, 2022 · 7 comments · Fixed by #1259 or #1269
Assignees
Labels
bug Time:Minor Up to 4 hours
Milestone

Comments

@vegu
Copy link
Contributor

vegu commented Sep 14, 2022

Describe the bug

Currently the importer will raise an error when encountering null values for ipv6 or ipv4 properties in the vlan_list property.

Expected behavior

It's valid according to the IX-F schema, and the importer should support it by treating it the same way as if the property (ipv6 or ipv4) was not there at all.

Are there security concerns?

no

Are there privacy concerns?

no

@vegu vegu added the bug label Sep 14, 2022
@vegu vegu changed the title IX-F importer fails on null vlan_list entries IX-F importer fails on nulled ipv4 / ipv6 properties in vlan_list entries Sep 14, 2022
@ccaputo
Copy link
Contributor

ccaputo commented Sep 14, 2022

@peeringdb/pc please make this an ASAP. It was reported by me and is an active problem. Thanks.

@mcmanuss8
Copy link
Contributor

+1 clear bug

@mcmanuss8 mcmanuss8 added this to the 4 Ready for Implementation milestone Sep 14, 2022
@martinhannigan
Copy link

martinhannigan commented Sep 14, 2022 via email

@arnoldnipper arnoldnipper self-assigned this Sep 14, 2022
@arnoldnipper
Copy link
Contributor

@vegu, please generally accept null instead of at least "".

@vegu vegu added the Time:Minor Up to 4 hours label Sep 14, 2022
vegu added a commit that referenced this issue Oct 11, 2022
IX-F importer fails on nulled ipv4 / ipv6 properties in vlan_list entries #1244

See merge request gh/peeringdb/peeringdb!320
@vegu vegu mentioned this issue Oct 11, 2022
grizz pushed a commit that referenced this issue Oct 11, 2022
* Add export tool to https://peeringdb.com/cp/peeringdb_server #586

* IX-F importer fails on nulled ipv4 / ipv6 properties in vlan_list entries #1244

* Adding a POC must require an email address or phone number #1044

* Selenium tests

* ping django-peeringdb and rdap and poetry relock

* linting

* linting

* remove selenium tests cruft

* comment out django-peeringdb and search data mounts

* regen docs
prithvimanikonda pushed a commit to prithvimanikonda/peeringdb that referenced this issue Oct 12, 2022
* Add export tool to https://peeringdb.com/cp/peeringdb_server peeringdb#586

* IX-F importer fails on nulled ipv4 / ipv6 properties in vlan_list entries peeringdb#1244

* Adding a POC must require an email address or phone number peeringdb#1044

* Selenium tests

* ping django-peeringdb and rdap and poetry relock

* linting

* linting

* remove selenium tests cruft

* comment out django-peeringdb and search data mounts

* regen docs
@ccaputo
Copy link
Contributor

ccaputo commented Oct 17, 2022

The traceback has evolved with this update, but the problem remains.

On production, the following is reported:

ERROR: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/srv/www.peeringdb.com/peeringdb_server/management/commands/pdb_ixf_ixp_member_import.py", line 278, in handle
    success = importer.update(
  File "/srv/www.peeringdb.com/peeringdb_server/ixf.py", line 501, in update
    data = self.fetch(ixlan.ixf_ixp_member_list_url, timeout=timeout)
  File "/srv/www.peeringdb.com/peeringdb_server/ixf.py", line 212, in fetch
    data = self.sanitize(data)
  File "/srv/www.peeringdb.com/peeringdb_server/ixf.py", line 451, in sanitize
    ipv6 = vlans[0].get("ipv6", {}).get("address")
AttributeError: 'NoneType' object has no attribute 'get'

While on beta, with the new code, this is reported:

ERROR: 'NoneType' object is not iterable
Traceback (most recent call last):
  File "/srv/www.peeringdb.com/peeringdb_server/management/commands/pdb_ixf_ixp_member_import.py", line 278, in handle
    success = importer.update(
  File "/srv/www.peeringdb.com/peeringdb_server/ixf.py", line 510, in update
    data = self.fetch(ixlan.ixf_ixp_member_list_url, timeout=timeout)
  File "/srv/www.peeringdb.com/peeringdb_server/ixf.py", line 212, in fetch
    data = self.sanitize(data)
  File "/srv/www.peeringdb.com/peeringdb_server/ixf.py", line 446, in sanitize
    connection_list = self.match_vlans_across_connections(
  File "/srv/www.peeringdb.com/peeringdb_server/ixf.py", line 318, in match_vlans_across_connections
    cxns_that_match = self.find_connections_that_match(
  File "/srv/www.peeringdb.com/peeringdb_server/ixf.py", line 290, in find_connections_that_match
    if self.connections_match(connection, connection2):
  File "/srv/www.peeringdb.com/peeringdb_server/ixf.py", line 282, in connections_match
    if_list_1 = self.get_if_speed_list(connection1)
  File "/srv/www.peeringdb.com/peeringdb_server/ixf.py", line 270, in get_if_speed_list
    for if_entry in connection.get("if_list", []):
TypeError: 'NoneType' object is not iterable

@ccaputo ccaputo reopened this Oct 17, 2022
@ccaputo
Copy link
Contributor

ccaputo commented Oct 17, 2022

An if_list of:

"if_list": null

rather than the normal likes of:

        "if_list": [
                {
                        "switch_id":0,
                        "if_speed":10000
                }
        ],

seems to be tripping up the importer.

This null passes the https://ixpdb.euro-ix.net/en/validator/ validator.

@ccaputo
Copy link
Contributor

ccaputo commented Oct 19, 2022

This new code worked successfully on beta this 0000 UTC run of the Importer. Nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Time:Minor Up to 4 hours
Projects
None yet
6 participants