-
Notifications
You must be signed in to change notification settings - Fork 42
Description
I am trying to get all paths from ${origin} AS to ${destination} AS.
I want to scan all collectors, to make sure that if a path exists, between two ASes, I always get that.
I'm running into two issues, one of them is an error, and one of them is a confusion if you can help me out with that.
The error:
When i don't limit my collectors, the following errors are printed (the script doesn't stop though):
Filter: origin 11492 and peer 7922
HTTP ERROR: Failure when receiving data from the peer (56)
HTTP ERROR: Transferred a partial file (18)
Filter: origin 11492 and peer 22773
HTTP ERROR: Couldn't resolve host name (6)
2020-07-22 12:50:49 62124: bs_transport_file.c:40: ERROR: Could not open http://archive.routeviews.org/route-views.wide/bgpdata/2019.06/UPDATES/updates.20190601.0800.bz2 for reading
2020-07-22 12:50:49 62124: bgpstream_transport.c:97: ERROR: Could not open resource (http://archive.routeviews.org/route-views.wide/bgpdata/2019.06/UPDATES/updates.20190601.0800.bz2)
2020-07-22 12:50:49 62124: bgpstream_reader.c:170: WARNING: Could not open (http://archive.routeviews.org/route-views.wide/bgpdata/2019.06/UPDATES/updates.20190601.0800.bz2). Attempt 1 of 5
HTTP ERROR: Failure when receiving data from the peer (56)
HTTP ERROR: Transferred a partial file (18)
Similar lines print on the terminal multiple times (same numbers in the brackets)
The Confusion:
Even after all the errors get printed, I do get the results, but quite often they show that no such paths exist. While this is always possible, but I just wanted to know if there's something I'm doing something wrong.
If you have any recommendations to make the code or results better and more reliable, I would be happy to hear!
One additional information that might help in optimization is that all ASNs I am concerned with, are from within the USA.
I am using pybgpstream, and here is my code:
Given a source ASN and a destination ASN, this function returns all the paths that pybgpstream provides.
def getASPaths(src, dest):
paths = []
filter = "origin {} and peer {}".format(str(src), str(dest))
stream = pybgpstream.BGPStream(
from_time="2019-06-01 07:50:00", until_time="2019-06-01 08:10:00",
filter=filter,
)
for elem in stream:
paths.append(elem.fields["as-path"])
return list(set(paths))