cooperlees / aioexabgp

Proof of concept core asyncio ExaBGP Client Library + CLI
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

aioexabgp

An example asyncio non blocking ExaBGP Library

Client

Library to perform X asynchronous healthchecks (e.g query an IGP or a ping check) and handle announcing + withdrawing routes. The library will also be able to read routes from ExaBGP peers and then program any FIB you write a Handler for (e.g. Linux Route table or an IGP)

Goals:

Use

Get an instance of Announcer class and add healthchecks to influence the addition and withdrawal of advertised routes.

Sample

The sample exists to show how you could extend the Announcer for route add and withdrawal via printing ExaBGP commands to STDOUT.

aioexabgp.announcer.sample has a runnable example. -D here is important for dry run. This is a bad example that needs sudo to /sbin/ip. Steps to use:

python3 -m venv /tmp/tae
cd .
/tmp/tae/bin/pip install --upgrade pip setuptools
/tmp/tae/bin/pip install [-e] .
# Run the code
/tmp/tae/bin/python aioexabgp/announcer/sample.py -c aioexabgp/announcer/sample_announcer.json -D -d

You can also add some IPs to loopback to see health checks pass and fail MacOS X

Modules

Running CI / Unit Tests

We are all ptr powered. To run CI:

cd .  # This dir
python3 -m venv /tmp/test_aioexabgp
/tmp/test_aioexabgp/bin/pip install --upgrade pip setuptool ptr

# For first run state we want to `keep` the venv via -k
/tmp/test_aio/bin/ptr -k

# Subsiquent Runs (venv creation is slow)
/tmp/test_aio/bin/ptr --venv PATH_PTR_PRINTED_OUT

Run tests only

You can also run unittests only via

to debug a specific test easily rather than running the full suite