Coder Social home page Coder Social logo

frr_grpc_python_example's Introduction

FRRrouting Northbound example with python

FRR has an experimental gRPC northbound interface, see: FRR Northbound gRPC

gRPC itself has several language bindings, for details see: gRPC Supported languages

FRR documentation has gRPC example for Ruby: Northbound gRPC Programming Language Bindings

Here You can find a similar example for python.

Install FRR with gRPC support

As a starting point: Ubuntu20.04 innstall from source

To build frr with gRPC enabled when executing configure add the following --enable-grpc:

$ ./configure \
    --prefix=/usr \
    --includedir=\${prefix}/include \
    --enable-exampledir=\${prefix}/share/doc/frr/examples \
    --bindir=\${prefix}/bin \
    --sbindir=\${prefix}/lib/frr \
    --libdir=\${prefix}/lib/frr \
    --libexecdir=\${prefix}/lib/frr \
    --localstatedir=/var/run/frr \
    --sysconfdir=/etc/frr \
    --with-moduledir=\${prefix}/lib/frr/modules \
    --with-libyang-pluginsdir=\${prefix}/lib/frr/libyang_plugins \
    --enable-configfile-mask=0640 \
    --enable-logfile-mask=0640 \
    --enable-snmp=agentx \
    --enable-multipath=64 \
    --enable-user=frr \
    --enable-group=frr \
    --enable-vty-group=frrvty \
    --with-pkg-git-version \
    --with-pkg-extra-version=-MyOwnFRRVersion
    --enable-grpc
    --enable-systemd=yes

When you have all systemd file and config in place, enable bfd in daemons file (/etc/frr/daemons): https://docs.frrouting.org/en/latest/grpc.html#daemon-grpc-configuration

...
bfdd=yes
...
bfdd_options="   --daemon -A 127.0.0.1 -M grpc" 
...

$ sudo systemctl restart frr.service

Install python env for gRPC

From gRPC python Quick Start:

$ mkdir frr_example; cd frr_example
$ virtualenv frrgrpcvenv
$ source frrgrpcvenv/bin/activate
(frrgrpcvenv) $ pip install grpcio
(frrgrpcvenv) $ pip install grpcio-tools

Next the proto file must be converted as next step. The proto file is in the frr repo under grpc folder: https://github.com/FRRouting/frr/blob/master/grpc/frr-northbound.proto

(frrgrpcvenv) $ python -m grpc_tools.protoc -I~/frr/grpc --python_out=. --grpc_python_out=. ~/frr/grpc/frr-northbound.proto

After this the following 2 files should have in your folder:

  • frr_northbound_pb2.py
  • frr_northbound_pb2_grpc.py

frr_grpc_python_example's People

Contributors

elajkat avatar

Watchers

 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.