Git Product home page Git Product logo

bgp-ls-vis's Introduction

Code style: black Docstrings: Google Discord

BGP Link-State AFI Visualiser (bgp-ls-vis)

PoC collection of scripts and modules that perform the following

  1. Connects via gRPC to a running GoBGP instance and submits a query for the contents of the BGP-LS table
    • or, loads from file a cached BGP-LS table (To dump, proto.GoBGPQueryWrapper.debug())
  2. Filters the returned structured data for only those values which are useful and required
  3. Builds a NetworkX graph object representative of the NLRI extracted
  4. Draws visual representation of said NetworkX graph object to screen or file

Minimal Example

# RPC tools
from proto import GoBGPQueryWrapper
# Graphing tools
import graphing

gobgp_target = {"target_ipv4_address": "172.20.10.2", "target_rpc_port": 50051}
rpc = GoBGPQueryWrapper(**gobgp_target)

lsdb = rpc.get_lsdb()
graph = graphing.build_nx_from_lsdb(lsdb)

graphing.draw_pyplot_graph(graph)

Requirements and Resources

pip install -r requirements.txt


  • NetworkX + matplotlib (graphing.draw_pyplot_graph)
   pip3 install networkx matplotlib

To get pygraphviz working ...

    Requires:
        redhat: graphviz-devel python3-dev graphviz pkg-config
        debian: python3-dev graphviz libgraphviz-dev pkg-config

You may need to prepare your own gRPC python interfaces if ours dont work. This process is described in the GoBGP guide on interfacing from your favourite language.

    - https://www.grpc.io/docs/languages/python/quickstart/
    python3 -m pip install grpcio
    python3 -m pip install grpcio-tools
    - Clone the gobgp repo and prep the rpc interface to python
    gobgp\api> python -m grpc_tools.protoc -I./ --python_out=. --grpc_python_out=. *.proto

Why?

Because we can, and it's fun

Lab & Testing Topology

Networking

Testing topologies are running ISIS, and 1 node peers with BGP-LS to the Ubuntu guest running GoBGP.

  • Clouds are a breakout for the virtual environment, allowing RPC calls from the real-world.
  • All nodes must support ISIS, but only the node peering to the GoBGP systems needs to support and peer BGP-LS
    • e.g Only R2 has an iBGP peering for address-family link-state link-state (BGP-LS) to the GoBGP instance.

Lab Topology 1

This topology is described under tests/lab_topology_definitions/lab_topology.yaml

Lab Topology 2

This topology is described under tests/lab_topology_definitions/18-node-topology.yaml

GoBGP

GoBGP configuration file is defined by the following YAML

global:
  config:
    as: 65001
    router-id: 10.2.9.9
neighbors:
- config:
    neighbor-address: 10.2.9.2
    peer-as: 65001
  transport:
    config:
      local-address: 10.2.9.9
  afi-safis:
  - config:
      afi-safi-name: ls

Progress so far:

  • Supports loading BGP-LS table dumps from file, an alternative to RPC connections
  • Resolves ISIS TLV 137 for actual hostnames
  • Supports Psuedonodes

graphing.draw_pyplot_graph for BGP-LS table dump tests/junos_bgpls_nopsn.yml draws the following

graphing.draw_pyplot_graph for BGP-LS table dump tests/18-node-isis-w-bcast-segment.yaml draws the following

Contributors

  • YungTimAllen
  • FlyingScotsman

bgp-ls-vis's People

Contributors

yungtimallen avatar flyingscotsman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.