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

Support 202001 (#641)

* remove warning for missing information for fields: aka, looking glass server url, route server url (#616)
remove warning for missing information for fields: ipv4 prefixes, ipv6 prefixes if either of them is set (#616)

* Use autocomplete fields in the admincom controlpanel to speed up loading times (#597)

* Better error reporting for POSTs and PUTs (#610)

* Add operation to API to look for covering prefixes given an IP (#25)
This commit is contained in:
Matt Griswold
2020-02-05 21:26:21 -06:00
committed by GitHub
parent 014b5746e3
commit 06805fef36
9 changed files with 247 additions and 12 deletions

View File

@@ -1999,6 +1999,26 @@ class IXLanPrefix(pdb_models.IXLanPrefixBase):
filt = make_relation_filter("ixlan__%s" % field, filt, value)
return qset.filter(**filt)
@classmethod
def whereis_ip(cls, ipaddr, qset=None):
"""
Filter queryset of ixpfx objects where the prefix contains
the supplied ipaddress
"""
if not qset:
qset = cls.handleref.undeleted()
ids = []
ipaddr = ipaddress.ip_address(ipaddr)
for ixpfx in qset:
if ipaddr in ixpfx.prefix:
ids.append(ixpfx.id)
return qset.filter(id__in=ids)
@property
def nsp_namespace(self):
"""