1
0
mirror of https://github.com/peeringdb/peeringdb.git synced 2024-05-11 05:55:09 +00:00

fix ixf import preview bug where entries with either ipv4 or ipv6 address blank would be ignored (gh-490) (#491)

This commit is contained in:
Matt Griswold
2019-05-08 09:31:49 -05:00
committed by GitHub
parent a46111bed0
commit 291b4ab15a
10 changed files with 426 additions and 3 deletions

View File

@@ -345,7 +345,7 @@ class Importer(object):
ipv6.get("routeserver", False))
)
if not self.save and (not self.ixlan.test_ipv4_address(ipv4_addr) or not \
if not self.save and (not self.ixlan.test_ipv4_address(ipv4_addr) and not \
self.ixlan.test_ipv6_address(ipv6_addr)):
#for the preview we don't care at all about new ip addresses
#not at the ixlan if they dont match the prefix

View File

@@ -0,0 +1,142 @@
{
"errors": [
"Invalid speed value: fast",
"Could not find ipv4 or 6 address in vlan_list entry for vlan_id 1 (AS2906)",
"Ip address error 'u'195.69.146.error' does not appear to be an IPv4 or IPv6 address' in vlan_list entry for vlan_id 2"
],
"data": [
{
"peer": {
"ixlan_id": 1,
"asn": 2906
},
"action": "ignore",
"reason": "Invalid connection state: disabled"
},
{
"peer": {
"net_id": 1,
"ipaddr4": "195.69.146.250",
"is_rs_peer": true,
"speed": 10000,
"ixlan_id": 1,
"asn": 2906,
"ipaddr6": "2001:7f8:1::a500:2906:2"
},
"action": "add",
"reason": "New ip-address"
},
{
"peer": {
"net_id": 1,
"ipaddr4": "195.69.147.250",
"is_rs_peer": true,
"speed": 10000,
"ixlan_id": 1,
"asn": 2906,
"ipaddr6": "2001:7f8:1::a500:2906:1"
},
"action": "add",
"reason": "New ip-address"
},
{
"peer": {
"net_id": 1,
"ipaddr4": "195.69.147.251",
"is_rs_peer": true,
"speed": 10000,
"ixlan_id": 1,
"asn": 2906,
"ipaddr6": "2001:7f8:1::a500:2906:5"
},
"action": "modify",
"reason": "Fields changed: ipaddr6, is_rs_peer, speed"
},
{
"peer": {
"net_id": 1,
"ipaddr4": "195.69.147.253",
"is_rs_peer": true,
"speed": 10000,
"ixlan_id": 1,
"asn": 2906,
"ipaddr6": ""
},
"action": "add",
"reason": "New ip-address"
},
{
"peer": {
"net_id": 1,
"ipaddr4": "",
"is_rs_peer": true,
"speed": 10000,
"ixlan_id": 1,
"asn": 2906,
"ipaddr6": "2001:7f8:1::a500:2906:6"
},
"action": "add",
"reason": "New ip-address"
},
{
"peer": {
"net_id": 1,
"ipaddr4": "195.69.146.251",
"is_rs_peer": true,
"speed": 20000,
"ixlan_id": 1,
"asn": 2906,
"ipaddr6": "2001:7f8:1::a500:2906:3"
},
"action": "noop",
"reason": "Connection is currently marked as inactive"
},
{
"peer": {
"net_id": 1,
"ipaddr4": "195.69.146.252",
"is_rs_peer": true,
"speed": 10000,
"ixlan_id": 1,
"asn": 2906,
"ipaddr6": "2001:7f8:1::a500:2906:4"
},
"action": "noop",
"reason": "Connection is currently marked as inactive"
},
{
"peer": {
"ixlan_id": 1,
"asn": 2906
},
"action": "ignore",
"reason": "Invalid member type: other"
},
{
"peer": {
"net_id": 1,
"ipaddr4": "195.69.146.249",
"is_rs_peer": false,
"speed": 10000,
"ixlan_id": 1,
"asn": 2906,
"ipaddr6": ""
},
"action": "delete",
"reason": "Ip addresses no longer exist in validated data or are no longer with this asn"
},
{
"peer": {
"net_id": 1,
"ipaddr4": "195.69.147.252",
"is_rs_peer": false,
"speed": 10000,
"ixlan_id": 1,
"asn": 1002,
"ipaddr6": ""
},
"action": "delete",
"reason": "ASN no longer in data"
}
]
}

View File

@@ -52,6 +52,32 @@
"action": "noop",
"reason": "Network has disabled ixp updates"
},
{
"peer": {
"net_id": 1,
"ipaddr4": "195.69.147.253",
"is_rs_peer": true,
"speed": 10000,
"ixlan_id": 1,
"asn": 2906,
"ipaddr6": ""
},
"action": "noop",
"reason": "Network has disabled ixp updates"
},
{
"peer": {
"net_id": 1,
"ipaddr4": "",
"is_rs_peer": true,
"speed": 10000,
"ixlan_id": 1,
"asn": 2906,
"ipaddr6": "2001:7f8:1::a500:2906:6"
},
"action": "noop",
"reason": "Network has disabled ixp updates"
},
{
"peer": {
"net_id": 1,

View File

@@ -52,6 +52,32 @@
"action": "ignore",
"reason": "Ip addresses (195.69.147.251, 2001:7f8:1::a500:2906:5) do not match any prefix on this ixlan"
},
{
"peer": {
"net_id": 1,
"ipaddr4": "195.69.147.253",
"is_rs_peer": true,
"speed": 10000,
"ixlan_id": 2,
"asn": 2906,
"ipaddr6": ""
},
"action": "ignore",
"reason": "Ip addresses (195.69.147.253, None) do not match any prefix on this ixlan"
},
{
"peer": {
"net_id": 1,
"ipaddr4": "",
"is_rs_peer": true,
"speed": 10000,
"ixlan_id": 2,
"asn": 2906,
"ipaddr6": "2001:7f8:1::a500:2906:6"
},
"action": "ignore",
"reason": "Ip addresses (None, 2001:7f8:1::a500:2906:6) do not match any prefix on this ixlan"
},
{
"peer": {
"net_id": 1,

View File

@@ -52,6 +52,32 @@
"action": "modify",
"reason": "Fields changed: ipaddr6, is_rs_peer, speed"
},
{
"peer": {
"net_id": 1,
"ipaddr4": "195.69.147.253",
"is_rs_peer": true,
"speed": 10000,
"ixlan_id": 1,
"asn": 2906,
"ipaddr6": ""
},
"action": "add",
"reason": "New ip-address"
},
{
"peer": {
"net_id": 1,
"ipaddr4": "",
"is_rs_peer": true,
"speed": 10000,
"ixlan_id": 1,
"asn": 2906,
"ipaddr6": "2001:7f8:1::a500:2906:6"
},
"action": "add",
"reason": "New ip-address"
},
{
"peer": {
"net_id": 1,

View File

@@ -107,6 +107,44 @@
}
}
]
},
{
"state": "active",
"if_list": [
{
"if_speed": 10000
}
],
"ixp_id": 1,
"vlan_list": [
{
"ipv4": {
"as_macro": "AS-NFLX",
"address": "195.69.147.253",
"routeserver": true,
"max_prefix": 42
}
}
]
},
{
"state": "active",
"if_list": [
{
"if_speed": 10000
}
],
"ixp_id": 1,
"vlan_list": [
{
"ipv6": {
"as_macro": "AS-NFLX",
"address": "2001:7f8:1::a500:2906:6",
"routeserver": true,
"max_prefix": 42
}
}
]
}
],
"peering_policy_url": "https://www.netflix.com/openconnect/",

View File

@@ -125,6 +125,58 @@
]
},
{
"ixp_id": 42,
"connected_since": "2009-02-04T00:00:00Z",
"state": "active",
"if_list": [
{
"switch_id": 1,
"if_speed": 10000,
"if_type": "LR4"
}
],
"vlan_list": [
{
"vlan_id": 0,
"mac_address" : "00:0a:95:9d:68:16",
"ipv4": {
"address": "195.69.147.253",
"routeserver": true,
"max_prefix": 42,
"as_macro": "AS-NFLX-V4"
}
}
]
},
{
"ixp_id": 42,
"connected_since": "2009-02-04T00:00:00Z",
"state": "active",
"if_list": [
{
"switch_id": 1,
"if_speed": 10000,
"if_type": "LR4"
}
],
"vlan_list": [
{
"vlan_id": 0,
"mac_address" : "00:0a:95:9d:68:16",
"ipv6": {
"address": "2001:7f8:1::a500:2906:6",
"routeserver": true,
"max_prefix": 42,
"as_macro": "AS-NFLX-V6"
}
}
]
},
{
"ixp_id": 42,
"connected_since": "2009-02-04T00:00:00Z",

View File

@@ -125,6 +125,58 @@
]
},
{
"ixp_id": 42,
"connected_since": "2009-02-04T00:00:00Z",
"state": "active",
"if_list": [
{
"switch_id": 1,
"if_speed": 10000,
"if_type": "LR4"
}
],
"vlan_list": [
{
"vlan_id": 0,
"mac_address" : "00:0a:95:9d:68:16",
"ipv4": {
"address": "195.69.147.253",
"routeserver": true,
"max_prefix": 42,
"as_macro": "AS-NFLX-V4"
}
}
]
},
{
"ixp_id": 42,
"connected_since": "2009-02-04T00:00:00Z",
"state": "active",
"if_list": [
{
"switch_id": 1,
"if_speed": 10000,
"if_type": "LR4"
}
],
"vlan_list": [
{
"vlan_id": 0,
"mac_address" : "00:0a:95:9d:68:16",
"ipv6": {
"address": "2001:7f8:1::a500:2906:6",
"routeserver": true,
"max_prefix": 42,
"as_macro": "AS-NFLX-V6"
}
}
]
},
{
"ixp_id": 42,
"connected_since": "2009-02-04T00:00:00Z",

View File

@@ -140,6 +140,62 @@
]
},
{
"ixp_id": 42,
"connected_since": "2009-02-04T00:00:00Z",
"state": "active",
"if_list": [
{
"switch_id": 1,
"if_speed": 10000,
"if_type": "LR4"
}
],
"vlan_list": [
{
"vlan_id": 0,
"ipv4": {
"address": "195.69.147.253",
"routeserver": true,
"max_prefix": 42,
"as_macro": "AS-NFLX-V4",
"mac_address" : [
"00:0a:95:9d:68:16"
]
}
}
]
},
{
"ixp_id": 42,
"connected_since": "2009-02-04T00:00:00Z",
"state": "active",
"if_list": [
{
"switch_id": 1,
"if_speed": 10000,
"if_type": "LR4"
}
],
"vlan_list": [
{
"vlan_id": 0,
"ipv6": {
"address": "2001:7f8:1::a500:2906:6",
"routeserver": true,
"max_prefix": 42,
"as_macro": "AS-NFLX-V6",
"mac_address" : [
"00:0a:95:9d:68:16"
]
}
}
]
},
{
"ixp_id": 42,
"connected_since": "2009-02-04T00:00:00Z",

View File

@@ -145,7 +145,7 @@ class JsonMembersListTestCase(TestCase):
r, netixlans, netixlans_deleted, log = self.ixf_importer.update(ixlan, data=self.json_data)
self.assertLog(log, "update_01")
self.assertEqual(len(netixlans), 3)
self.assertEqual(len(netixlans), 5)
self.assertEqual(len(netixlans_deleted), 2)
n = netixlans[0]
@@ -179,6 +179,11 @@ class JsonMembersListTestCase(TestCase):
#self.assertEqual(n_deleted.ipaddr4, None)
#self.assertEqual(n_deleted2.ipaddr6, None)
def test_preview_from_ixf_ixp_member_list(self):
ixlan = self.entities["ixlan"][0]
r, netixlans, netixlans_deleted, log = self.ixf_importer.update(ixlan, data=self.json_data, save=False)
self.assertLog(log, "preview_01")
def test_update_from_ixf_ixp_member_list_skip_prefix_mismatch(self):
"""
Here we test that entries with ipaddresses that cannot be validated
@@ -230,7 +235,7 @@ class JsonMembersListTestCase(TestCase):
log_entry = ixlan.ixf_import_log_set.last().entries.get(
netixlan=netixlan)
if netixlan.id == self.entities["netixlan"][4].id:
if netixlan.id in (self.entities["netixlan"][4].id, self.entities["netixlan"][5].id):
# netixlan was modified
self.assertEqual(
log_entry.version_before,