Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

django-ixp-tracker

PyPI Tests Changelog License

Library to retrieve and manipulate data about IXPs

v2 warning

Note the v2 is a complete rewrite to use Event Sourcing. The first time you upgrade you will need to re-run any historical data you have as the history is not migrated between major versions.

v2 does not by default preserve any internal ids for IXPs. If you need to preserve them, you will need to preload the IXPIdMap model table with the mapping to Peering DB ids (use a dummy aggregate_id), e.g. if you use Postgres, by running these queries

INSERT INTO ixp_tracker_ixpidmap (id, peeringdb_id, aggregate_id)
SELECT id, peeringdb_id, concat('aaaabbbb-cccc-dddd-eeee-', lpad(id::text, 12, '0'))::uuid FROM ixp_tracker_ixp;

SELECT setval(pg_get_serial_sequence('ixp_tracker_ixpidmap', 'id')
           , COALESCE(max(id) + 1, 1)
           , false)
FROM   ixp_tracker_ixpidmap;

The legacy implementation is preserved in v2 for now but will be removed in a future minor version. If you would like to upgrade to v2 but continue with the legacy implementation be sure to set IXP_TRACKER_ENABLE_EVENT_SOURCING to False. Note that there are no changes to the legacy implementation in v2 though.

Installation

Install this library using pip:

pip install django-ixp-tracker

Usage

  1. Add to your INSTALLED_APPS setting like this:
   INSTALLED_APPS = [
   ...,
   "ixp_tracker",
   ]

Note: this app has no web-facing components so you don't need to add anything to urls.py etc

  1. Run python manage.py migrate to create the models.
  2. Add the relevant settings to your config.
  3. Add IXP_TRACKER_DATA_LOOKUP_FACTORY to config with the path to your factory (see below).
  4. Run the management command to import the data: python manage.py ixp_tracker_import (This will sync the current data, if you want historical data you need to backfill first)

ASN country and status data

The lib uses an external component to look up the country of registration (why?) and the status of an ASN. This status is used for the logic to identify when members have left an IXP.

If you don't provide this service yourself, it will default to a noop version. This will mean you will get no country of registration data and the marking of members having left an IXP will not be as efficient.

In order to implement such a component yourself, you should implement the Protocol ixp_tracker.data_lookup.AdditionalDataSources and provide a factory function for your class.

Backfilling data

You have the option of backfilling data from archived PeeringDb data. This can be done by running the import command with the --backfill option for each month you want to backfill:

python manage.py ixp_tracker_import --backfill <YYYMM>

The backfill currently process a single month at a time and will look for the earliest file for the relevant month at https://publicdata.caida.org/datasets/peeringdb/

IMPORTANT NOTE: due to the way the code tries to figure out when a member left an IXP, you should run the backfill strictly in date order and before syncing the current data.

IXP stats

The import process also generates monthly stats per IXP and per country. These are generated as of the 1st of the month used to import the data.

Running programmatically

If you'd like to run the import from code, rather than from the management command, you can call importers.import_data() and stats.generate_stats() directly.

It's not recommended to call any other functions yourself.

Development

To contribute to this library, first checkout the code. Then create a new virtual environment:

cd django-ixp-tracker
python -m venv .venv
source .venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

We use pre-commit for linting etc on push. Run:

pre-commit install

from the repo top-level dir to set it up.

Releases

For now, releasing a new version is manual and can be done by running the following commands from the repo:

python -m build
python -m twine upload --repository pypi dist/*

Peering Db libraries

PeeringDb provide their own vanilla Python and Django libs, but we have decided not to use these.

Both libs are designed to keep a local copy of the current data and to keep that copy in sync with the central copy via the API.

As we need to keep a historical record (e.g. for IXP growth stats over time), we would have to provide some sort of wrapper over those libs anyway.

In addition to that, the historical archives of PeeringDb data use flat lists of the different object types in json. We can retrieve the data from the API directly in the same way, so it makes it simpler to implement.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_ixp_tracker-2rc10.tar.gz (52.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_ixp_tracker-2rc10-py3-none-any.whl (53.5 kB view details)

Uploaded Python 3

File details

Details for the file django_ixp_tracker-2rc10.tar.gz.

File metadata

  • Download URL: django_ixp_tracker-2rc10.tar.gz
  • Upload date:
  • Size: 52.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for django_ixp_tracker-2rc10.tar.gz
Algorithm Hash digest
SHA256 e2075b56fd8fded2fa45cedf6d58e3970bf2f11390ee996c4c05b2ea5a87a1d5
MD5 86a9b81417f1e4b78f54fa1aaa216403
BLAKE2b-256 596467ec8f164b7f969f4e000b583e64670b14b6932b853acf8a98a279172a00

See more details on using hashes here.

File details

Details for the file django_ixp_tracker-2rc10-py3-none-any.whl.

File metadata

File hashes

Hashes for django_ixp_tracker-2rc10-py3-none-any.whl
Algorithm Hash digest
SHA256 dcb07d765cb5b0c361db5529ad803e41b2bbc4cb1d6539095520e79186b06528
MD5 8a4aaaef6f51af6c403312e1c738f434
BLAKE2b-256 89bd03ac76fc1f55126603fc22d362e8cd12f0c8bad62507292406cb7b6ae6fe

See more details on using hashes here.

Release history Release notifications | RSS feed

3.0.1

2 files

3.0.0

2 files

2.0.0

2 files

This release

2rc10 This release

2 files

1.3.3

2 files

1.3.2

2 files

1.3.1

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

1.0.0

2 files

0.15

2 files

0.14

2 files

0.13

2 files

0.12

2 files

0.11

2 files

0.10

2 files

0.9

2 files

0.8

2 files

0.7

2 files

0.6

2 files

0.5

2 files

0.4

2 files

0.3

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page