Routing History

class prsw.stat.routing_history.RoutingHistory(RIPEstat, resource, starttime: Optional[datetime] = None, endtime: Optional[datetime] = None, min_peers=None, max_rows=None, include_first_hop=None, normalize_visibility=None)

This data call shows the history of announcements for prefixes, including the origin ASN and the first hop.

Reference: https://stat.ripe.net/docs/data_api#routing-history

Property

Description

by_origin

A list containing routes grouped by origin.

query_endtime

The datetime at which the query ended.

query_starttime

The datetime at which the query started.

resource

The resource used for the query / prefix or ASN

import prsw

ripe = prsw.RIPEstat()
history = ripe.routing_history(3333)

for element in history:
    print(element.prefix, element.timelines)
__getitem__(index)

Get a specific index of the returned routing history.

__init__(RIPEstat, resource, starttime: Optional[datetime] = None, endtime: Optional[datetime] = None, min_peers=None, max_rows=None, include_first_hop=None, normalize_visibility=None)

Initialize and request Routing History.

Parameters
  • resource – The Autonomous System Number for which to return prefixes

  • starttime – The start time for the query. (defaults to two weeks before current date and time)

  • endtime – The start time for the query. (defaults to two weeks before current date and time)

  • min_peers – Minimum number of full-feed RIS peers seeing the route for the segment to be included in the results. Excludes low-visibility/localized announcements. (default 10)

Param_max_rows

The maximum number of routes to return. This is a soft limit: all recorded routes for each origin ASN are returned, but when the row limit is reached no more origins will be returned. (default: 3000)

Pararm_include_first_hop

Include the first hop ASN in the route, instead of just the origin ASN. (default: false)

Param_normalize_visibility

Add a visibility field to each timeline indicating the visibility of the route (according to RIS) at that point in time. The visibility is computed as the peers_seeing divided by the number of RIS full table peers at the time. (default: false)

import prsw
from datetime import datetime

ripe = prsw.RIPEstat()

start = datetime.fromisoformat("2021-01-01T12:00:00.000000")
end = datetime.now()

prefixes = ripe.routing_history(
    3333,                # Autonomous System Number
    starttime=start,     # datetime
    endtime=end,         # datetime
    min_peers=20         # int
    )
__iter__()

Provide a way to iterate over routing history.

__len__()

Get the number of origins in routing history.

property latest_max_ff_peers

This gives the number of maximum full-table peers seen as per IP version in RIS.

property origin

List of origins included in the response

property query_endtime

The datetime at which the query ended.

property query_starttime

The datetime at which the query started.

property resource

The resource, autonomous system number, used for the query.

property routing_history

A list of all entries in the history including their timeline

Returns a list of Origin named tuples