|
|
|
@ -98,6 +98,10 @@ def get_current_network():
|
|
|
|
|
log.exception("Could not get data from host %s method %s", host, host.checkMethod)
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
# add neighbor count
|
|
|
|
|
for node, data in net.nodes(data=True):
|
|
|
|
|
data["neighbors"] = len(list(net.neighbors(node)))
|
|
|
|
|
|
|
|
|
|
log.info("Adding last seen neighbor info")
|
|
|
|
|
for asls in ASLastSeen.objects.all():
|
|
|
|
|
if asls.asn not in net.nodes:
|
|
|
|
@ -109,10 +113,6 @@ def get_current_network():
|
|
|
|
|
_populate_node(net, neigh.asn)
|
|
|
|
|
net.nodes[asls.asn]['online'] = False
|
|
|
|
|
|
|
|
|
|
# add neighbor count
|
|
|
|
|
for node, data in net.nodes(data=True):
|
|
|
|
|
data["neighbors"] = len(list(net.neighbors(node)))
|
|
|
|
|
|
|
|
|
|
log.info("Crawl done in %.2fs", time.time() - crawl_start)
|
|
|
|
|
|
|
|
|
|
# add id to edges
|
|
|
|
@ -164,7 +164,7 @@ def _add_data_to_net(net, data):
|
|
|
|
|
if not as_path:
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
orig_node = _populate_node(net, as_path[-1])
|
|
|
|
|
orig_node = _populate_node(net, as_path[0])
|
|
|
|
|
orig_node['prefixes'].add(route['prefix'])
|
|
|
|
|
|
|
|
|
|
for n in range(len(as_path) - 1):
|
|
|
|
@ -196,14 +196,4 @@ def convert_crawl(crawl):
|
|
|
|
|
prefix = "{}/{}".format(ann.ip, ann.prefix)
|
|
|
|
|
path = list(map(int, ann.ASPath.split()))
|
|
|
|
|
net.nodes[asn.number]['routing_table'].add((prefix, tuple(path)))
|
|
|
|
|
if path:
|
|
|
|
|
net.nodes[path[-1]]['prefixes'].add(prefix)
|
|
|
|
|
for path_asn in path:
|
|
|
|
|
if path_asn in net.nodes and path_asn not in (path[-1], path[0]):
|
|
|
|
|
net.nodes[path_asn]['stub'] = False
|
|
|
|
|
|
|
|
|
|
# add neighbor count
|
|
|
|
|
for node, data in net.nodes(data=True):
|
|
|
|
|
data["neighbors"] = len(list(net.neighbors(node)))
|
|
|
|
|
|
|
|
|
|
return net
|
|
|
|
|
net.nodes[path[-1]]['prefixes'].add(prefix)
|
|
|
|
|