You will need to become familiar with Blackholing events. Good resources for this include RFC 7999, Section
Question:
This task will use cache files from theupdate_files_blackholingsubdirectories. These areupdate files, so you will pass "upd-file" in your call toset_data_interface_option(). Using the data from the cache files, we will identify events where the IPv4 prefixes are tagged with a Remote Triggered Blackholing (RTBH) community and measure the time duration of the RTBH events by completing the functionrtbh_event_durations(). Make sure that your function returns the data structure exactly as specified inbgpm.py.
The duration of an RTBH event for a given peerIP/prefix pair is the time elapsed between the last (A)nnouncement of the IPv4 peerIP/prefix that is tagged with an RTBH community value and the first (W)ithdrawal of the IPv4 peerIP/prefix. In other words, we are looking at the stream of Announcements and Withdrawals for a given peerIP/prefix and identifying onlyexplicit withdrawalsfor an RTBH tagged peerIP/prefix.
To identify and compute the duration of an RTBH 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(RTBH) A4(RTBH) W1 W2 W3 W4 for a specific peerIP/prefix pair, A4(RTBH)-W1 denotes an RTBH event and the duration is calculated by taking the time difference between A4(RTBH) and W1.
- Note: There can be more than one RTBH event in a given stream. For example, in the stream A1 A2 A3(RTBH) A4(RTBH) W1 W2 W3 W4 A5(RTBH) W5, there are two RTBH events: A4(RTBH)-W1 and A5(RTBH)-W5.
- Example: Given the stream A1 A2 A3(RTBH) A4 A5 W1 W2 for a specific peerIP/prefix pair, the announcement A3(RTBH) followed by A4 is an implicit withdrawal. There is no explicit withdrawal and, thus, no RTBH event.
- In case of duplicate announcements, use the latest.
- Consider only non-zero duration events.
code requirements:
import pybgpstream # Task 4: RTBH Event Durations def rtbh_event_durations(cache_files): """ Identify blackholing events and compute the duration of all RTBH events from the input BGP data Identify events where the IPv4 prefixes are tagged with at least one Remote Triggered Blackholing (RTBH) community. 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 RTBH 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 {}
International Economics
ISBN: 978-1429278447
3rd edition
Authors: Robert C. Feenstra, Alan M. Taylor