Skip to content

Commit

Permalink
Make sure IXPs work properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
cwacek committed Dec 19, 2013
1 parent d3d18f6 commit b3f2f74
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions inettopology/asmap/extra/torps/ixps.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ def identify_ixps(self, as_path):
"""Identify the IXP and MetaIXPs that occur along a given AS path
:as_path: An iterable of AS numbers representing a path
:returns: A tuple of the form (ixps, metaixps), which are either sets or None
:returns: A tuple of the form (ixps, metaixps), which are sets
"""
if as_path is None:
return ([], [])

path_ixps = set()

for pair in pairwise(as_path):
for pair in pairwise(as_path.split()):
if pair in self.ixps:
path_ixps |= self.ixps[pair]

path_metaixps = set([self.lookup(ixp) for ixp in path_ixps])
path_metaixps = set([self.lookup_metaixp(ixp) for ixp in path_ixps])

return (path_ixps, path_metaixps)

Expand Down
4 changes: 2 additions & 2 deletions inettopology/asmap/extra/torps/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def callback(data):
return

path_ixps, path_mixps = ixp_data.identify_ixps(data['path'])
ixpline = " ".join(path_ixps) if path_ixps is not None else "-"
metaixpline = " ".join(path_mixps) if path_mixps is not None else "-"
ixpline = " ".join(path_ixps) if len(path_ixps) > 0 else "-"
metaixpline = " ".join(path_mixps) if len(path_mixps) > 0 else "-"

print("@PATH|{0}::{1}|{2}|{3}|{4}".format(
endpoints[0],
Expand Down

0 comments on commit b3f2f74

Please sign in to comment.