Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extract origin from as-path #42

Closed
hhaootian opened this issue Apr 1, 2021 · 1 comment
Closed

extract origin from as-path #42

hhaootian opened this issue Apr 1, 2021 · 1 comment

Comments

@hhaootian
Copy link

Based on the tutorial, we can extract origin as:

ases = elem.fields["as-path"].split(" ")
origin = ases[-1]

However, I'm seeing some cases that we might extract wrong origin, for example:
rib|R|1617098401.000000|routeviews|route-views.sydney|None|None|4739|45.127.172.20|37.142.0.0/17|45.127.172.20|4739 7545 6453 12849 {12849,21450}|4739:0|None|None

This also happens in 'updates' record type.
update|A|1617098751.000000|routeviews|route-views.sydney|None|None|58511|45.127.172.149|94.131.240.0/20|45.127.172.149|58511 44600 {6939,29491,35297,49720}|58511:200 58511:9007|None|None

Using the origin extraction shown above, we would get {12849,21450} and {6939,29491,35297,49720}.

Codes to duplicate this error:

stream = pybgpstream.BGPStream(
    from_time = "2021-03-30 10:00:00", until_time = "2021-03-30 10:30:00 UTC",
    collectors = ["route-views.sydney"],
    record_type = "ribs"
)

for rec in stream.records():
    for elem in rec:
        ases = elem.fields['as-path'].split(" ")
        if len(ases) > 0:
            origin = ases[-1]
            if "{" in origin:
                print(elem)
@realdah
Copy link

realdah commented Apr 2, 2021

Hi tian, I found this online, and also replied in canvas.
CAIDA/bgpstream#12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants