mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
- clean up wording for import preview - change `skip` action to `ignore` in import preview - change action to `noop` when no action is taken because of disabled ixp update - #390 fixed: Wrong IPs in exports for IX members with multiple links
This commit is contained in:
@@ -74,19 +74,19 @@ def export_ixf_ix_members(ixlans, pretty=False):
|
|||||||
}
|
}
|
||||||
connection_list.append(connection)
|
connection_list.append(connection)
|
||||||
|
|
||||||
if netixlan.ipaddr4:
|
if _netixlan.ipaddr4:
|
||||||
vlan_list[0]["ipv4"] = {
|
vlan_list[0]["ipv4"] = {
|
||||||
"address": "{}".format(netixlan.ipaddr4),
|
"address": "{}".format(_netixlan.ipaddr4),
|
||||||
"routeserver": netixlan.is_rs_peer,
|
"routeserver": _netixlan.is_rs_peer,
|
||||||
"max_prefix": netixlan.network.info_prefixes4,
|
"max_prefix": _netixlan.network.info_prefixes4,
|
||||||
"as_macro": netixlan.network.irr_as_set
|
"as_macro": _netixlan.network.irr_as_set
|
||||||
}
|
}
|
||||||
if netixlan.ipaddr6:
|
if _netixlan.ipaddr6:
|
||||||
vlan_list[0]["ipv6"] = {
|
vlan_list[0]["ipv6"] = {
|
||||||
"address": "{}".format(netixlan.ipaddr6),
|
"address": "{}".format(_netixlan.ipaddr6),
|
||||||
"routeserver": netixlan.is_rs_peer,
|
"routeserver": _netixlan.is_rs_peer,
|
||||||
"max_prefix": netixlan.network.info_prefixes6,
|
"max_prefix": _netixlan.network.info_prefixes6,
|
||||||
"as_macro": netixlan.network.irr_as_set
|
"as_macro": _netixlan.network.irr_as_set
|
||||||
}
|
}
|
||||||
|
|
||||||
if pretty:
|
if pretty:
|
||||||
|
|||||||
@@ -18,8 +18,18 @@ from peeringdb_server.models import (
|
|||||||
|
|
||||||
class Importer(object):
|
class Importer(object):
|
||||||
|
|
||||||
allowed_member_types = ["peering", "ixp", "routeserver", "probono"]
|
allowed_member_types = ["peering",
|
||||||
allowed_states = ["active", "connected"]
|
"ixp",
|
||||||
|
"routeserver",
|
||||||
|
"probono",
|
||||||
|
]
|
||||||
|
allowed_states = ["",
|
||||||
|
None,
|
||||||
|
"active",
|
||||||
|
"inactive",
|
||||||
|
"connected",
|
||||||
|
"operational",
|
||||||
|
]
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.reset()
|
self.reset()
|
||||||
@@ -29,6 +39,7 @@ class Importer(object):
|
|||||||
self.netixlans = []
|
self.netixlans = []
|
||||||
self.netixlans_deleted = []
|
self.netixlans_deleted = []
|
||||||
self.ipaddresses = []
|
self.ipaddresses = []
|
||||||
|
self.asns = []
|
||||||
self.ixlan = ixlan
|
self.ixlan = ixlan
|
||||||
self.save = save
|
self.save = save
|
||||||
|
|
||||||
@@ -156,17 +167,34 @@ class Importer(object):
|
|||||||
their ip addresses
|
their ip addresses
|
||||||
|
|
||||||
In order for a netixlan to be removed both it's ipv4 and ipv6 address
|
In order for a netixlan to be removed both it's ipv4 and ipv6 address
|
||||||
need to be gone from the ixf data
|
or it's asn need to be gone from the ixf data after validation
|
||||||
"""
|
"""
|
||||||
for netixlan in self.ixlan.netixlan_set_active:
|
for netixlan in self.ixlan.netixlan_set_active:
|
||||||
ipv4 = "{}-{}".format(netixlan.asn, netixlan.ipaddr4)
|
ipv4 = "{}-{}".format(netixlan.asn, netixlan.ipaddr4)
|
||||||
ipv6 = "{}-{}".format(netixlan.asn, netixlan.ipaddr6)
|
ipv6 = "{}-{}".format(netixlan.asn, netixlan.ipaddr6)
|
||||||
if ipv4 not in self.ipaddresses and ipv6 not in self.ipaddresses:
|
|
||||||
|
if netixlan.asn not in self.asns:
|
||||||
self.log_peer(netixlan.asn, "delete",
|
self.log_peer(netixlan.asn, "delete",
|
||||||
_("Ip addresses no longer in data"), netixlan)
|
_("ASN no longer in data"), netixlan)
|
||||||
self.netixlans_deleted.append(netixlan)
|
self.netixlans_deleted.append(netixlan)
|
||||||
if self.save:
|
if self.save:
|
||||||
netixlan.delete()
|
netixlan.delete()
|
||||||
|
elif ipv4 not in self.ipaddresses and ipv6 not in self.ipaddresses:
|
||||||
|
self.log_peer(netixlan.asn, "delete",
|
||||||
|
_("Ip addresses no longer exist in validated data or are "\
|
||||||
|
"no longer with this asn"), netixlan)
|
||||||
|
self.netixlans_deleted.append(netixlan)
|
||||||
|
if self.save:
|
||||||
|
netixlan.delete()
|
||||||
|
elif ipv4 not in self.ipaddresses or ipv6 not in self.ipaddresses:
|
||||||
|
if not netixlan.network.allow_ixp_update:
|
||||||
|
self.log_peer(netixlan.asn, "delete",
|
||||||
|
_("At least one ipaddress mismatched and "\
|
||||||
|
"network has disabled upates"), netixlan)
|
||||||
|
self.netixlans_deleted.append(netixlan)
|
||||||
|
if self.save:
|
||||||
|
netixlan.delete()
|
||||||
|
|
||||||
|
|
||||||
@transaction.atomic()
|
@transaction.atomic()
|
||||||
def archive(self):
|
def archive(self):
|
||||||
@@ -213,21 +241,25 @@ class Importer(object):
|
|||||||
# check that the as exists in pdb
|
# check that the as exists in pdb
|
||||||
asn = member["asnum"]
|
asn = member["asnum"]
|
||||||
|
|
||||||
|
# keep track of asns we find in the ix-f data
|
||||||
|
if asn not in self.asns:
|
||||||
|
self.asns.append(asn)
|
||||||
|
|
||||||
if Network.objects.filter(asn=asn).exists():
|
if Network.objects.filter(asn=asn).exists():
|
||||||
network = Network.objects.get(asn=asn)
|
network = Network.objects.get(asn=asn)
|
||||||
if network.status != "ok":
|
if network.status != "ok":
|
||||||
self.log_peer(
|
self.log_peer(
|
||||||
asn, "skip",
|
asn, "ignore",
|
||||||
_("Network status is '{}'").format(network.status))
|
_("Network status is '{}'").format(network.status))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self.parse_connections(
|
self.parse_connections(
|
||||||
member.get("connection_list", []), network, member)
|
member.get("connection_list", []), network, member)
|
||||||
else:
|
else:
|
||||||
self.log_peer(asn, "skip",
|
self.log_peer(asn, "ignore",
|
||||||
_("Network does not exist in peeringdb"))
|
_("Network does not exist in peeringdb"))
|
||||||
else:
|
else:
|
||||||
self.log_peer(asn, "skip",
|
self.log_peer(asn, "ignore",
|
||||||
_("Invalid member type: {}").format(member_type))
|
_("Invalid member type: {}").format(member_type))
|
||||||
|
|
||||||
def parse_connections(self, connection_list, network, member):
|
def parse_connections(self, connection_list, network, member):
|
||||||
@@ -251,7 +283,7 @@ class Importer(object):
|
|||||||
connection.get("vlan_list", []), network, member,
|
connection.get("vlan_list", []), network, member,
|
||||||
connection, speed)
|
connection, speed)
|
||||||
else:
|
else:
|
||||||
self.log_peer(asn, "skip",
|
self.log_peer(asn, "ignore",
|
||||||
_("Invalid connection state: {}").format(state))
|
_("Invalid connection state: {}").format(state))
|
||||||
|
|
||||||
def parse_vlans(self, vlan_list, network, member, connection, speed):
|
def parse_vlans(self, vlan_list, network, member, connection, speed):
|
||||||
@@ -274,7 +306,7 @@ class Importer(object):
|
|||||||
ipv4 = lan.get("ipv4", {})
|
ipv4 = lan.get("ipv4", {})
|
||||||
ipv6 = lan.get("ipv6", {})
|
ipv6 = lan.get("ipv6", {})
|
||||||
|
|
||||||
# vlan entry has no ipaddresses set, log and skip
|
# vlan entry has no ipaddresses set, log and ignore
|
||||||
if not ipv4 and not ipv6:
|
if not ipv4 and not ipv6:
|
||||||
self.log_error(_("Could not find ipv4 or 6 address in " \
|
self.log_error(_("Could not find ipv4 or 6 address in " \
|
||||||
"vlan_list entry for vlan_id {} (AS{})").format(
|
"vlan_list entry for vlan_id {} (AS{})").format(
|
||||||
@@ -319,16 +351,24 @@ class Importer(object):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
# if connection state is inactive we won't create or update
|
||||||
|
if connection.get("state", "active") == "inactive":
|
||||||
|
self.log_peer(asn, "noop",
|
||||||
|
_("Connection is currently marked as inactive"),
|
||||||
|
netixlan_info)
|
||||||
|
continue
|
||||||
|
|
||||||
|
|
||||||
# after this point we either add or modify the netixlan, so
|
# after this point we either add or modify the netixlan, so
|
||||||
# now is a good time to check if the related network allows
|
# now is a good time to check if the related network allows
|
||||||
# such updates, bail if not
|
# such updates, bail if not
|
||||||
if not network.allow_ixp_update:
|
if not network.allow_ixp_update:
|
||||||
self.log_peer(asn, "skip",
|
self.log_peer(asn, "noop",
|
||||||
_("Network has disabled ixp updates"),
|
_("Network has disabled ixp updates"),
|
||||||
netixlan_info)
|
netixlan_info)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
# add / modify the netixlan
|
# add / modify the netixlan
|
||||||
result = self.ixlan.add_netixlan(netixlan_info, save=self.save,
|
result = self.ixlan.add_netixlan(netixlan_info, save=self.save,
|
||||||
save_others=self.save)
|
save_others=self.save)
|
||||||
@@ -344,7 +384,7 @@ class Importer(object):
|
|||||||
elif result["netixlan"]:
|
elif result["netixlan"]:
|
||||||
self.log_peer(asn, "noop", "", result["netixlan"])
|
self.log_peer(asn, "noop", "", result["netixlan"])
|
||||||
elif result["log"]:
|
elif result["log"]:
|
||||||
self.log_peer(asn, "skip", "\n".join(result["log"]),
|
self.log_peer(asn, "ignore", "\n".join(result["log"]),
|
||||||
netixlan_info)
|
netixlan_info)
|
||||||
|
|
||||||
def parse_speed(self, if_list):
|
def parse_speed(self, if_list):
|
||||||
@@ -386,7 +426,7 @@ class Importer(object):
|
|||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
- asn <int>
|
- asn <int>
|
||||||
- action <str>: add | modify | delete | noop | skip
|
- action <str>: add | modify | delete | noop | ignore
|
||||||
- reason <str>
|
- reason <str>
|
||||||
|
|
||||||
Keyrword Arguments:
|
Keyrword Arguments:
|
||||||
|
|||||||
@@ -1239,7 +1239,7 @@ div[data-edit-name=ipaddr6]
|
|||||||
border-bottom: 1px rgba(0,0,0,0.25) solid;
|
border-bottom: 1px rgba(0,0,0,0.25) solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ixf-skip {
|
.ixf-ignore {
|
||||||
background-color: #ffffd7;
|
background-color: #ffffd7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,55 +10,133 @@
|
|||||||
"ixlan_id": 1,
|
"ixlan_id": 1,
|
||||||
"asn": 2906
|
"asn": 2906
|
||||||
},
|
},
|
||||||
"action": "skip",
|
"action": "ignore",
|
||||||
"reason": "Invalid connection state: disabled"
|
"reason": "Invalid connection state: disabled"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"peer": {
|
"peer": {
|
||||||
"is_rs_peer": true,
|
|
||||||
"ipaddr4": "195.69.146.250",
|
|
||||||
"net_id": 1,
|
"net_id": 1,
|
||||||
|
"ipaddr4": "195.69.146.250",
|
||||||
|
"is_rs_peer": true,
|
||||||
"speed": 10000,
|
"speed": 10000,
|
||||||
"ixlan_id": 1,
|
"ixlan_id": 1,
|
||||||
"asn": 2906,
|
"asn": 2906,
|
||||||
"ipaddr6": "2001:7f8:1::a500:2906:2"
|
"ipaddr6": "2001:7f8:1::a500:2906:2"
|
||||||
},
|
},
|
||||||
"action": "skip",
|
"action": "noop",
|
||||||
"reason": "Network has disabled ixp updates"
|
"reason": "Network has disabled ixp updates"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"peer": {
|
"peer": {
|
||||||
"is_rs_peer": true,
|
|
||||||
"ipaddr4": "195.69.147.250",
|
|
||||||
"net_id": 1,
|
"net_id": 1,
|
||||||
|
"ipaddr4": "195.69.147.250",
|
||||||
|
"is_rs_peer": true,
|
||||||
"speed": 10000,
|
"speed": 10000,
|
||||||
"ixlan_id": 1,
|
"ixlan_id": 1,
|
||||||
"asn": 2906,
|
"asn": 2906,
|
||||||
"ipaddr6": "2001:7f8:1::a500:2906:1"
|
"ipaddr6": "2001:7f8:1::a500:2906:1"
|
||||||
},
|
},
|
||||||
"action": "skip",
|
"action": "noop",
|
||||||
"reason": "Network has disabled ixp updates"
|
"reason": "Network has disabled ixp updates"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"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": "noop",
|
||||||
|
"reason": "Network has disabled ixp updates"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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": {
|
"peer": {
|
||||||
"ixlan_id": 1,
|
"ixlan_id": 1,
|
||||||
"asn": 2906
|
"asn": 2906
|
||||||
},
|
},
|
||||||
"action": "skip",
|
"action": "ignore",
|
||||||
"reason": "Invalid member type: other"
|
"reason": "Invalid member type: other"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"peer": {
|
"peer": {
|
||||||
"is_rs_peer": false,
|
|
||||||
"ipaddr4": "195.69.146.249",
|
|
||||||
"net_id": 1,
|
"net_id": 1,
|
||||||
|
"ipaddr4": "195.69.146.249",
|
||||||
|
"is_rs_peer": false,
|
||||||
"speed": 10000,
|
"speed": 10000,
|
||||||
"ixlan_id": 1,
|
"ixlan_id": 1,
|
||||||
"asn": 2906,
|
"asn": 2906,
|
||||||
"ipaddr6": ""
|
"ipaddr6": ""
|
||||||
},
|
},
|
||||||
"action": "delete",
|
"action": "delete",
|
||||||
"reason": "Ip addresses no longer in data"
|
"reason": "Ip addresses no longer exist in validated data or are no longer with this asn"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"peer": {
|
||||||
|
"net_id": 1,
|
||||||
|
"ipaddr4": "195.69.146.251",
|
||||||
|
"is_rs_peer": false,
|
||||||
|
"speed": 10000,
|
||||||
|
"ixlan_id": 1,
|
||||||
|
"asn": 2906,
|
||||||
|
"ipaddr6": ""
|
||||||
|
},
|
||||||
|
"action": "delete",
|
||||||
|
"reason": "At least one ipaddress mismatched and network has disabled upates"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"peer": {
|
||||||
|
"net_id": 1,
|
||||||
|
"ipaddr4": "195.69.147.251",
|
||||||
|
"is_rs_peer": false,
|
||||||
|
"speed": 20000,
|
||||||
|
"ixlan_id": 1,
|
||||||
|
"asn": 2906,
|
||||||
|
"ipaddr6": ""
|
||||||
|
},
|
||||||
|
"action": "delete",
|
||||||
|
"reason": "At least one ipaddress mismatched and network has disabled upates"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,41 +10,80 @@
|
|||||||
"ixlan_id": 2,
|
"ixlan_id": 2,
|
||||||
"asn": 2906
|
"asn": 2906
|
||||||
},
|
},
|
||||||
"action": "skip",
|
"action": "ignore",
|
||||||
"reason": "Invalid connection state: disabled"
|
"reason": "Invalid connection state: disabled"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"peer": {
|
"peer": {
|
||||||
"is_rs_peer": true,
|
|
||||||
"ipaddr4": "195.69.146.250",
|
|
||||||
"net_id": 1,
|
"net_id": 1,
|
||||||
|
"ipaddr4": "195.69.146.250",
|
||||||
|
"is_rs_peer": true,
|
||||||
"speed": 10000,
|
"speed": 10000,
|
||||||
"ixlan_id": 2,
|
"ixlan_id": 2,
|
||||||
"asn": 2906,
|
"asn": 2906,
|
||||||
"ipaddr6": "2001:7f8:1::a500:2906:2"
|
"ipaddr6": "2001:7f8:1::a500:2906:2"
|
||||||
},
|
},
|
||||||
"action": "skip",
|
"action": "ignore",
|
||||||
"reason": "Ip addresses (195.69.146.250, 2001:7f8:1::a500:2906:2) do not match any prefix on this ixlan"
|
"reason": "Ip addresses (195.69.146.250, 2001:7f8:1::a500:2906:2) do not match any prefix on this ixlan"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"peer": {
|
"peer": {
|
||||||
"is_rs_peer": true,
|
|
||||||
"ipaddr4": "195.69.147.250",
|
|
||||||
"net_id": 1,
|
"net_id": 1,
|
||||||
|
"ipaddr4": "195.69.147.250",
|
||||||
|
"is_rs_peer": true,
|
||||||
"speed": 10000,
|
"speed": 10000,
|
||||||
"ixlan_id": 2,
|
"ixlan_id": 2,
|
||||||
"asn": 2906,
|
"asn": 2906,
|
||||||
"ipaddr6": "2001:7f8:1::a500:2906:1"
|
"ipaddr6": "2001:7f8:1::a500:2906:1"
|
||||||
},
|
},
|
||||||
"action": "skip",
|
"action": "ignore",
|
||||||
"reason": "Ip addresses (195.69.147.250, 2001:7f8:1::a500:2906:1) do not match any prefix on this ixlan"
|
"reason": "Ip addresses (195.69.147.250, 2001:7f8:1::a500:2906:1) do not match any prefix on this ixlan"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"peer": {
|
||||||
|
"net_id": 1,
|
||||||
|
"ipaddr4": "195.69.147.251",
|
||||||
|
"is_rs_peer": true,
|
||||||
|
"speed": 10000,
|
||||||
|
"ixlan_id": 2,
|
||||||
|
"asn": 2906,
|
||||||
|
"ipaddr6": "2001:7f8:1::a500:2906:5"
|
||||||
|
},
|
||||||
|
"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.146.251",
|
||||||
|
"is_rs_peer": true,
|
||||||
|
"speed": 20000,
|
||||||
|
"ixlan_id": 2,
|
||||||
|
"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": 2,
|
||||||
|
"asn": 2906,
|
||||||
|
"ipaddr6": "2001:7f8:1::a500:2906:4"
|
||||||
|
},
|
||||||
|
"action": "noop",
|
||||||
|
"reason": "Connection is currently marked as inactive"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"peer": {
|
"peer": {
|
||||||
"ixlan_id": 2,
|
"ixlan_id": 2,
|
||||||
"asn": 2906
|
"asn": 2906
|
||||||
},
|
},
|
||||||
"action": "skip",
|
"action": "ignore",
|
||||||
"reason": "Invalid member type: other"
|
"reason": "Invalid member type: other"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -10,14 +10,14 @@
|
|||||||
"ixlan_id": 1,
|
"ixlan_id": 1,
|
||||||
"asn": 2906
|
"asn": 2906
|
||||||
},
|
},
|
||||||
"action": "skip",
|
"action": "ignore",
|
||||||
"reason": "Invalid connection state: disabled"
|
"reason": "Invalid connection state: disabled"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"peer": {
|
"peer": {
|
||||||
"is_rs_peer": true,
|
|
||||||
"ipaddr4": "195.69.146.250",
|
|
||||||
"net_id": 1,
|
"net_id": 1,
|
||||||
|
"ipaddr4": "195.69.146.250",
|
||||||
|
"is_rs_peer": true,
|
||||||
"speed": 10000,
|
"speed": 10000,
|
||||||
"ixlan_id": 1,
|
"ixlan_id": 1,
|
||||||
"asn": 2906,
|
"asn": 2906,
|
||||||
@@ -28,9 +28,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"peer": {
|
"peer": {
|
||||||
"is_rs_peer": true,
|
|
||||||
"ipaddr4": "195.69.147.250",
|
|
||||||
"net_id": 1,
|
"net_id": 1,
|
||||||
|
"ipaddr4": "195.69.147.250",
|
||||||
|
"is_rs_peer": true,
|
||||||
"speed": 10000,
|
"speed": 10000,
|
||||||
"ixlan_id": 1,
|
"ixlan_id": 1,
|
||||||
"asn": 2906,
|
"asn": 2906,
|
||||||
@@ -39,26 +39,78 @@
|
|||||||
"action": "add",
|
"action": "add",
|
||||||
"reason": ""
|
"reason": ""
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"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": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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": {
|
"peer": {
|
||||||
"ixlan_id": 1,
|
"ixlan_id": 1,
|
||||||
"asn": 2906
|
"asn": 2906
|
||||||
},
|
},
|
||||||
"action": "skip",
|
"action": "ignore",
|
||||||
"reason": "Invalid member type: other"
|
"reason": "Invalid member type: other"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"peer": {
|
"peer": {
|
||||||
"is_rs_peer": false,
|
|
||||||
"ipaddr4": "195.69.146.249",
|
|
||||||
"net_id": 1,
|
"net_id": 1,
|
||||||
|
"ipaddr4": "195.69.146.249",
|
||||||
|
"is_rs_peer": false,
|
||||||
"speed": 10000,
|
"speed": 10000,
|
||||||
"ixlan_id": 1,
|
"ixlan_id": 1,
|
||||||
"asn": 2906,
|
"asn": 2906,
|
||||||
"ipaddr6": ""
|
"ipaddr6": ""
|
||||||
},
|
},
|
||||||
"action": "delete",
|
"action": "delete",
|
||||||
"reason": "Ip addresses no longer in data"
|
"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"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
{
|
{
|
||||||
"timestamp": "2017-10-26T08:04:29Z",
|
"timestamp": "2019-04-18T07:24:59Z",
|
||||||
"version": "0.6",
|
"version": "0.6",
|
||||||
"ixp_list": [
|
"ixp_list": [
|
||||||
{ "ixp_id" : 1, "shortname" : "Test Exchange" }
|
{
|
||||||
|
"shortname": "Test Exchange",
|
||||||
|
"ixp_id": 1
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"member_list": [
|
"member_list": [
|
||||||
{
|
{
|
||||||
@@ -23,13 +26,32 @@
|
|||||||
{
|
{
|
||||||
"ipv4": {
|
"ipv4": {
|
||||||
"as_macro": "AS-NFLX",
|
"as_macro": "AS-NFLX",
|
||||||
"address": "195.69.146.250",
|
"address": "195.69.146.251",
|
||||||
|
"routeserver": false,
|
||||||
|
"max_prefix": 42
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"state": "active",
|
||||||
|
"if_list": [
|
||||||
|
{
|
||||||
|
"if_speed": 10000
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ixp_id": 1,
|
||||||
|
"vlan_list": [
|
||||||
|
{
|
||||||
|
"ipv4": {
|
||||||
|
"as_macro": "AS-NFLX",
|
||||||
|
"address": "195.69.147.251",
|
||||||
"routeserver": true,
|
"routeserver": true,
|
||||||
"max_prefix": 42
|
"max_prefix": 42
|
||||||
},
|
},
|
||||||
"ipv6": {
|
"ipv6": {
|
||||||
"as_macro": "AS-NFLX",
|
"as_macro": "AS-NFLX",
|
||||||
"address": "2001:7f8:1::a500:2906:2",
|
"address": "2001:7f8:1::a500:2906:5",
|
||||||
"routeserver": true,
|
"routeserver": true,
|
||||||
"max_prefix": 42
|
"max_prefix": 42
|
||||||
}
|
}
|
||||||
@@ -60,6 +82,31 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"state": "active",
|
||||||
|
"if_list": [
|
||||||
|
{
|
||||||
|
"if_speed": 10000
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ixp_id": 1,
|
||||||
|
"vlan_list": [
|
||||||
|
{
|
||||||
|
"ipv4": {
|
||||||
|
"as_macro": "AS-NFLX",
|
||||||
|
"address": "195.69.147.250",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42
|
||||||
|
},
|
||||||
|
"ipv6": {
|
||||||
|
"as_macro": "AS-NFLX",
|
||||||
|
"address": "2001:7f8:1::a500:2906:1",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"peering_policy_url": "https://www.netflix.com/openconnect/",
|
"peering_policy_url": "https://www.netflix.com/openconnect/",
|
||||||
|
|||||||
@@ -93,6 +93,98 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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.251",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42,
|
||||||
|
"as_macro": "AS-NFLX-V4"
|
||||||
|
},
|
||||||
|
"ipv6": {
|
||||||
|
"address": "2001:7f8:1::a500:2906:5",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42,
|
||||||
|
"as_macro": "AS-NFLX-V6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"ixp_id": 42,
|
||||||
|
"connected_since": "2009-02-04T00:00:00Z",
|
||||||
|
"state": "inactive",
|
||||||
|
"if_list": [
|
||||||
|
{
|
||||||
|
"switch_id": 1,
|
||||||
|
"if_speed": 20000,
|
||||||
|
"if_type": "LR4"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"vlan_list": [
|
||||||
|
{
|
||||||
|
"vlan_id": 0,
|
||||||
|
"mac_address" : "00:0a:95:9d:68:16",
|
||||||
|
"ipv4": {
|
||||||
|
"address": "195.69.146.251",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42,
|
||||||
|
"as_macro": "AS-NFLX-V4"
|
||||||
|
},
|
||||||
|
"ipv6": {
|
||||||
|
"address": "2001:7f8:1::a500:2906:3",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42,
|
||||||
|
"as_macro": "AS-NFLX-V6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"ixp_id": 42,
|
||||||
|
"connected_since": "2009-02-04T00:00:00Z",
|
||||||
|
"state": "inactive",
|
||||||
|
"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.146.252",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42,
|
||||||
|
"as_macro": "AS-NFLX-V4"
|
||||||
|
},
|
||||||
|
"ipv6": {
|
||||||
|
"address": "2001:7f8:1::a500:2906:4",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42,
|
||||||
|
"as_macro": "AS-NFLX-V6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -93,9 +93,102 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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.251",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42,
|
||||||
|
"as_macro": "AS-NFLX-V4"
|
||||||
|
},
|
||||||
|
"ipv6": {
|
||||||
|
"address": "2001:7f8:1::a500:2906:5",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42,
|
||||||
|
"as_macro": "AS-NFLX-V6"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"ixp_id": 42,
|
||||||
|
"connected_since": "2009-02-04T00:00:00Z",
|
||||||
|
"state": "inactive",
|
||||||
|
"if_list": [
|
||||||
|
{
|
||||||
|
"switch_id": 1,
|
||||||
|
"if_speed": 20000,
|
||||||
|
"if_type": "LR4"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"vlan_list": [
|
||||||
|
{
|
||||||
|
"vlan_id": 0,
|
||||||
|
"mac_address" : "00:0a:95:9d:68:16",
|
||||||
|
"ipv4": {
|
||||||
|
"address": "195.69.146.251",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42,
|
||||||
|
"as_macro": "AS-NFLX-V4"
|
||||||
|
},
|
||||||
|
"ipv6": {
|
||||||
|
"address": "2001:7f8:1::a500:2906:3",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42,
|
||||||
|
"as_macro": "AS-NFLX-V6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"ixp_id": 42,
|
||||||
|
"connected_since": "2009-02-04T00:00:00Z",
|
||||||
|
"state": "inactive",
|
||||||
|
"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.146.252",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42,
|
||||||
|
"as_macro": "AS-NFLX-V4"
|
||||||
|
},
|
||||||
|
"ipv6": {
|
||||||
|
"address": "2001:7f8:1::a500:2906:4",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42,
|
||||||
|
"as_macro": "AS-NFLX-V6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"member_type": "other"
|
"member_type": "other"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,6 +103,113 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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.251",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42,
|
||||||
|
"as_macro": "AS-NFLX-V4",
|
||||||
|
"mac_address" : [
|
||||||
|
"00:0a:95:9d:68:16"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ipv6": {
|
||||||
|
"address": "2001:7f8:1::a500:2906:5",
|
||||||
|
"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",
|
||||||
|
"state": "inactive",
|
||||||
|
"if_list": [
|
||||||
|
{
|
||||||
|
"switch_id": 1,
|
||||||
|
"if_speed": 20000,
|
||||||
|
"if_type": "LR4"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"vlan_list": [
|
||||||
|
{
|
||||||
|
"vlan_id": 0,
|
||||||
|
"ipv4": {
|
||||||
|
"address": "195.69.146.251",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42,
|
||||||
|
"as_macro": "AS-NFLX-V4",
|
||||||
|
"mac_address" : [
|
||||||
|
"00:0a:95:9d:68:16"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ipv6": {
|
||||||
|
"address": "2001:7f8:1::a500:2906:3",
|
||||||
|
"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",
|
||||||
|
"state": "inactive",
|
||||||
|
"if_list": [
|
||||||
|
{
|
||||||
|
"switch_id": 1,
|
||||||
|
"if_speed": 10000,
|
||||||
|
"if_type": "LR4"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"vlan_list": [
|
||||||
|
{
|
||||||
|
"vlan_id": 0,
|
||||||
|
"ipv4": {
|
||||||
|
"address": "195.69.146.252",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42,
|
||||||
|
"as_macro": "AS-NFLX-V4",
|
||||||
|
"mac_address" : [
|
||||||
|
"00:0a:95:9d:68:16"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ipv6": {
|
||||||
|
"address": "2001:7f8:1::a500:2906:4",
|
||||||
|
"routeserver": true,
|
||||||
|
"max_prefix": 42,
|
||||||
|
"as_macro": "AS-NFLX-V6",
|
||||||
|
"mac_address" : [
|
||||||
|
"00:0a:95:9d:68:16"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -112,6 +112,18 @@ class JsonMembersListTestCase(TestCase):
|
|||||||
network=cls.entities["net"][0],
|
network=cls.entities["net"][0],
|
||||||
ixlan=cls.entities["ixlan"][0], asn=2906, speed=10000,
|
ixlan=cls.entities["ixlan"][0], asn=2906, speed=10000,
|
||||||
ipaddr4="195.69.146.249", ipaddr6=None, status="ok"),
|
ipaddr4="195.69.146.249", ipaddr6=None, status="ok"),
|
||||||
|
NetworkIXLan.objects.create(
|
||||||
|
network=cls.entities["net"][0],
|
||||||
|
ixlan=cls.entities["ixlan"][0], asn=2906, speed=10000,
|
||||||
|
ipaddr4="195.69.146.251", ipaddr6=None, status="ok"),
|
||||||
|
NetworkIXLan.objects.create(
|
||||||
|
network=cls.entities["net"][0],
|
||||||
|
ixlan=cls.entities["ixlan"][0], asn=2906, speed=20000, is_rs_peer=False,
|
||||||
|
ipaddr4="195.69.147.251", ipaddr6=None, status="ok"),
|
||||||
|
NetworkIXLan.objects.create(
|
||||||
|
network=cls.entities["net"][0],
|
||||||
|
ixlan=cls.entities["ixlan"][0], asn=1002, speed=10000,
|
||||||
|
ipaddr4="195.69.147.252", ipaddr6=None, status="ok"),
|
||||||
]
|
]
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@@ -129,12 +141,12 @@ class JsonMembersListTestCase(TestCase):
|
|||||||
self.assertEqual(unicode(n_deleted.ipaddr4), u'195.69.146.250')
|
self.assertEqual(unicode(n_deleted.ipaddr4), u'195.69.146.250')
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
unicode(n_deleted2.ipaddr6), u'2001:7f8:1::a500:2906:1')
|
unicode(n_deleted2.ipaddr6), u'2001:7f8:1::a500:2906:1')
|
||||||
self.assertEqual(ixlan.netixlan_set_active.count(), 1)
|
self.assertEqual(ixlan.netixlan_set_active.count(), 4)
|
||||||
r, netixlans, netixlans_deleted, log = self.ixf_importer.update(ixlan, data=self.json_data)
|
r, netixlans, netixlans_deleted, log = self.ixf_importer.update(ixlan, data=self.json_data)
|
||||||
|
|
||||||
self.assertLog(log, "update_01")
|
self.assertLog(log, "update_01")
|
||||||
self.assertEqual(len(netixlans), 2)
|
self.assertEqual(len(netixlans), 3)
|
||||||
self.assertEqual(len(netixlans_deleted), 1)
|
self.assertEqual(len(netixlans_deleted), 2)
|
||||||
|
|
||||||
n = netixlans[0]
|
n = netixlans[0]
|
||||||
self.assertEqual(unicode(n.ipaddr4), u"195.69.146.250")
|
self.assertEqual(unicode(n.ipaddr4), u"195.69.146.250")
|
||||||
@@ -152,6 +164,11 @@ class JsonMembersListTestCase(TestCase):
|
|||||||
self.assertEqual(n2.ixlan, ixlan)
|
self.assertEqual(n2.ixlan, ixlan)
|
||||||
self.assertEqual(n.asn, 2906)
|
self.assertEqual(n.asn, 2906)
|
||||||
|
|
||||||
|
# test that inactive connections had no effect
|
||||||
|
self.assertEqual(NetworkIXLan.objects.filter(ipaddr4="195.69.146.251", speed=10000, status="ok").count(), 1)
|
||||||
|
self.assertEqual(NetworkIXLan.objects.filter(ipaddr4="195.69.146.252").count(), 0)
|
||||||
|
|
||||||
|
|
||||||
#self.assertEqual(IXLan.objects.get(id=ixlan.id).netixlan_set_active.count(), 2)
|
#self.assertEqual(IXLan.objects.get(id=ixlan.id).netixlan_set_active.count(), 2)
|
||||||
|
|
||||||
#FIXME: this is not practical until
|
#FIXME: this is not practical until
|
||||||
@@ -196,6 +213,7 @@ class JsonMembersListTestCase(TestCase):
|
|||||||
network.save()
|
network.save()
|
||||||
r, netixlans, netixlans_deleted, log = self.ixf_importer.update(ixlan, data=self.json_data)
|
r, netixlans, netixlans_deleted, log = self.ixf_importer.update(ixlan, data=self.json_data)
|
||||||
|
|
||||||
|
print(json.dumps(log, indent=2))
|
||||||
self.assertLog(log, "skip_disabled_networks")
|
self.assertLog(log, "skip_disabled_networks")
|
||||||
self.assertEqual(len(netixlans), 0)
|
self.assertEqual(len(netixlans), 0)
|
||||||
|
|
||||||
@@ -212,7 +230,17 @@ class JsonMembersListTestCase(TestCase):
|
|||||||
for netixlan in netixlans:
|
for netixlan in netixlans:
|
||||||
log_entry = ixlan.ixf_import_log_set.last().entries.get(
|
log_entry = ixlan.ixf_import_log_set.last().entries.get(
|
||||||
netixlan=netixlan)
|
netixlan=netixlan)
|
||||||
self.assertEqual(log_entry.version_before, None)
|
|
||||||
|
if netixlan.id == self.entities["netixlan"][4].id:
|
||||||
|
# netixlan was modified
|
||||||
|
self.assertEqual(
|
||||||
|
log_entry.version_before,
|
||||||
|
reversion.models.Version.objects.get_for_object(netixlan)[1])
|
||||||
|
else:
|
||||||
|
# netixlan was added
|
||||||
|
self.assertEqual(
|
||||||
|
log_entry.version_before, None)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
log_entry.version_after,
|
log_entry.version_after,
|
||||||
reversion.models.Version.objects.get_for_object(netixlan)[0])
|
reversion.models.Version.objects.get_for_object(netixlan)[0])
|
||||||
@@ -274,7 +302,7 @@ class JsonMembersListTestCase(TestCase):
|
|||||||
ixlan = self.entities["ixlan"][0]
|
ixlan = self.entities["ixlan"][0]
|
||||||
r, netixlans, netixlans_deleted, log = self.ixf_importer.update(ixlan, data=self.json_data)
|
r, netixlans, netixlans_deleted, log = self.ixf_importer.update(ixlan, data=self.json_data)
|
||||||
|
|
||||||
self.assertEqual(len(netixlans_deleted), 1)
|
self.assertEqual(len(netixlans_deleted), 2)
|
||||||
|
|
||||||
netixlan = netixlans_deleted[0]
|
netixlan = netixlans_deleted[0]
|
||||||
other = NetworkIXLan.objects.create(
|
other = NetworkIXLan.objects.create(
|
||||||
@@ -310,6 +338,7 @@ class JsonMembersListTestCase(TestCase):
|
|||||||
resp = c.get("/export/ixlan/{}/ixp-member-list".format(ixlan.id))
|
resp = c.get("/export/ixlan/{}/ixp-member-list".format(ixlan.id))
|
||||||
self.assertEqual(resp.status_code, 200)
|
self.assertEqual(resp.status_code, 200)
|
||||||
data = json.loads(resp.content)
|
data = json.loads(resp.content)
|
||||||
|
print(json.dumps(data, indent=2))
|
||||||
with open(
|
with open(
|
||||||
os.path.join(
|
os.path.join(
|
||||||
os.path.dirname(__file__), "data", "json_members_list",
|
os.path.dirname(__file__), "data", "json_members_list",
|
||||||
|
|||||||
Reference in New Issue
Block a user