oneryalcin / PyGoBGP-Example

Example GoBGP Docker setup for testing PyGoBGP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PyGoBGP Examples (Docker)

PyGoBGP is a python library to interact with GoBGP. Below is an example docker setup to run two GoBGP routers and a controller node. Controller has PyGoBGP and Jupyter notebook installed and can access GoBGP routers. Controller can manipulate GoBGP router RIB, or change neighbor configs programmatically.

This setup is influenced by David Barroso's GoBGP examples.

GoBGP Docker Diagram

Requirements

  • docker
  • docker-compose

Environment Setup

Create docker images and bring them up

make build
make up

Now you should be able to access jupyter notebook at http://127.0.0.1:8080

Connect to one of the GoBGP Nodes and check BGP session

from pygobgp import PyGoBGP
gobgp = PyGoBGP(address="10.0.255.2")

neighbor = gobgp.get_neighbor(address="10.0.255.3")

print(neighbor.info.bgp_state)
>>> "established"

print(neighbor.conf.peer_as)
>>> 65001

Check PyGoBGP github page for more details

About

Example GoBGP Docker setup for testing PyGoBGP

License:Apache License 2.0


Languages

Language:Python 96.7%Language:Dockerfile 2.1%Language:Makefile 1.2%