#!/usr/bin/env python3 import pybgpstream CS 6250 BGP Measurements Project Notes: - Edit this file according to...
Question:
import pybgpstream
""" CS 6250 BGP Measurements Project
Notes: - Edit this file according to the project description and the docstrings provided for each function - Do not change the existing function names or arguments - You may add additional functions but they need to be contained entirely in this file """
# Task 3: Announcement-Withdrawal Event Durations def aw_event_durations(cache_files): """ Identify Announcement and Withdrawal events and compute the duration of all explicit AW events in the input BGP data
Args: cache_files: A chronologically sorted list of absolute (also called "fully qualified") path names
Returns: A dictionary where each key is a string representing the IPv4 address of a peer (peerIP) and each value is a dictionary with keys that are strings representing a prefix and values that are the list of explicit AW event durations (in seconds) for that peerIP and prefix pair.
For example: {"127.0.0.1": {"12.13.14.0/24": [4.0, 1.0, 3.0]}} corresponds to the peerIP "127.0.0.1", the prefix "12.13.14.0/24" and event durations of 4.0, 1.0 and 3.0. """
return {}
# The main function will not be run during grading. # You may use it however you like during testing. # # NB: make sure that check_solution.py runs your # solution without errors prior to submission if __name__ == '__main__': # do nothing pass
####################################################
Task 3: Announcement-Withdrawal Event Durations
In this task, we will measure how long prefix Announcements last before they are withdrawn. This matters because, when a prefix gets Advertised and then Withdrawn, this information propagates and affects the volume of the associated BGP traffic. Optional background reading on this topic can be found in The Shape of a BGP Update.
This task will use cache files from the update_files subdirectories. These are update files, so you will pass "upd-file" in your call to set_data_interface_option(). Using the data from the cache files, we will measure how long prefix Announcements last before they are withdrawn by completing the function aw_event_durations(). Make sure that your function returns the data structure exactly as specified in bgpm.py.
In defining Announcement Withdrawal (AW) events, we will only consider explicit withdrawals. An explicit withdrawal occurs when a prefix is advertised with an (A)nnouncement and is then (W)ithdrawn. In contrast, an implicit withdrawal occurs when a prefix is advertised (A) and then re-advertised (A) - usually with different BGP attributes. Don't forget that we are only considering IPv4 prefixes.
To compute the duration of an Explicit AW event for a given peerIP/prefix, you will need to monitor the stream of (A)nnouncements and (W)ithdrawals separately per peerIP/prefix pair.
- Example: Given the stream: A1 A2 A3 W1 W2 W3 W4 for a specific peerIP/prefix pair, you have an implicit withdrawal A1-A2, another implicit withdrawal A2-A3, and, finally, an explicit withdrawal (and AW event) A3-W1. W1-W2, W2-W3, and W3-W4 are all meaningless, as there's no active advertisement. The duration of the AW event is the time difference between A3 and W1. Again, we are only looking for last A and first W.
- Example: Given the stream: A1 A2 A3 W1 W2 W3 W4 A4 A5 W4 for a specific peerIP/prefix pair, we have two AW events at A3-W1 and A5-W4.
- We consider only non-zero AW durations.
Introduction to Data Mining
ISBN: 978-0321321367
1st edition
Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar