Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zebra: Adding a new dataplane using protobuf #14173

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ include zebra/subdir.am
include watchfrr/subdir.am
include qpb/subdir.am
include fpm/subdir.am
include dplaneserver/subdir.am
include grpc/subdir.am
include tools/subdir.am

Expand Down Expand Up @@ -272,6 +273,7 @@ EXTRA_DIST += \
doc/user/Makefile \
eigrpd/Makefile \
fpm/Makefile \
dplaneserver/Makefile \
grpc/Makefile \
isisd/Makefile \
ldpd/Makefile \
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,8 @@ AC_ARG_ENABLE([pcre2posix],
AS_HELP_STRING([--enable-pcre2posix], [enable using PCRE2 Posix libs for regex functions]))
AC_ARG_ENABLE([fpm],
AS_HELP_STRING([--enable-fpm], [enable Forwarding Plane Manager support]))
AC_ARG_ENABLE([enable_dplane_pb],
AS_HELP_STRING([--enable-dplane-pb], [enable Forwarding Plane Manager (FPM) protobuf support]))
AC_ARG_ENABLE([werror],
AS_HELP_STRING([--enable-werror], [enable -Werror (recommended for developers only)]))
AC_ARG_ENABLE([cumulus],
Expand Down Expand Up @@ -2795,6 +2797,7 @@ AM_CONDITIONAL([VRRPD], [test "$enable_vrrpd" != "no"])
AM_CONDITIONAL([PATHD], [test "$enable_pathd" != "no"])
AM_CONDITIONAL([PATHD_PCEP], [test "$enable_pathd" != "no"])
AM_CONDITIONAL([DP_DPDK], [test "$enable_dp_dpdk" = "yes"])
AM_CONDITIONAL([DPLANE_PB],[test "$enable_dplane_pb" != "no"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please follow the existing examples and add a help string

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added. Thanks.


AC_CONFIG_FILES([Makefile],[
test "$enable_dev_build" = "yes" && makefile_devbuild="--dev-build"
Expand Down
2 changes: 2 additions & 0 deletions debian/frr.install
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ usr/lib/*/frr/libfrrospfapiclient.*
usr/lib/*/frr/libmgmt_be_nb.*
usr/lib/*/frr/modules/bgpd_bmp.so
usr/lib/*/frr/modules/dplane_fpm_nl.so
usr/lib/*/frr/modules/dplane_fpm_pb.so
usr/lib/*/frr/modules/zebra_cumulus_mlag.so
usr/lib/*/frr/modules/zebra_fpm.so
usr/lib/*/frr/modules/pathd_pcep.so
usr/lib/frr/*.sh
usr/lib/frr/*d
usr/lib/frr/dplaneserver
usr/lib/frr/watchfrr
usr/lib/frr/zebra
usr/share/man/
Expand Down
18 changes: 18 additions & 0 deletions doc/developer/fpm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ advantages over Netlink:

* ``fpm``
* ``dplane_fpm_nl``
* ``dplane_fpm_pb``

fpm
^^^
Expand All @@ -55,6 +56,23 @@ netlink functions to translate route event snapshots into formatted binary
data.


dplane_fpm_pb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be useful to show examples of how to use it or at least how to start using protobuf, etc.

^^^^^^^^^^^^^

It has the same implementation as ``dplane_fpm_nl``, using ``zebra``'s data
plane framework as a plugin. It supports transmitting data in protobuf format.

To add a new data type:

- Add a new data structure to :file:`fpm/fpm.proto`.

.. c:function:: Fpm__Message *create_fpm_message(qpb_allocator_t *allocator,struct zebra_dplane_ctx *ctx);

- This function in :file:`zebra/dplane_fpm_pb.c` will create encoded fpm message.
Assign values to data based on opcode.
- Use the same proto file to decode on the server side.


Protocol Specification
----------------------

Expand Down
13 changes: 8 additions & 5 deletions doc/user/zebra.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1224,13 +1224,15 @@ as well. We refer to the component that programs the forwarding plane

The relevant zebra code kicks in when zebra is configured with the
:option:`--enable-fpm` flag and started with the module (``-M fpm``
or ``-M dplane_fpm_nl``).
or ``-M dplane_fpm_nl`` or ``-M dplane_fpm_pb``).

.. note::

The ``fpm`` implementation attempts to connect to ``127.0.0.1`` port ``2620``
by default without configurations. The ``dplane_fpm_nl`` only attempts to
connect to a server if configured.
by default without configurations. The ``dplane_fpm_nl`` only attempts
to connect to a server if configured. The ``dplane_fpm_pb`` attempts to
connect to ``127.0.0.1`` port ``2620`` by default. It can be changed or
canceled by configuring.

Zebra periodically attempts to connect to the well-known FPM port (``2620``).
Once the connection is up, zebra starts sending messages containing routes
Expand All @@ -1244,6 +1246,7 @@ with the module load-time option. The modules accept the following options:

- ``fpm``: ``netlink`` and ``protobuf``.
- ``dplane_fpm_nl``: none, it only implements netlink.
- ``dplane_fpm_pb``: none, it only implements protobuf.

The zebra FPM interface uses replace semantics. That is, if a 'route
add' message for a prefix is followed by another 'route add' message,
Expand Down Expand Up @@ -1308,8 +1311,8 @@ FPM Commands
optional Forwarding Plane Manager (FPM) component.


``dplane_fpm_nl`` implementation
--------------------------------
``dplane_fpm_nl`` or ``dplane_fpm_pb`` implementation
-----------------------------------------------------

.. clicmd:: fpm address <A.B.C.D|X:X::X:X> [port (1-65535)]

Expand Down
10 changes: 10 additions & 0 deletions dplaneserver/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
all: ALWAYS
@$(MAKE) -s -C .. dplaneserver/dplaneserver
%: ALWAYS
@$(MAKE) -s -C .. dplaneserver/$@

Makefile:
#nothing
ALWAYS:
.PHONY: ALWAYS makefiles
.SUFFIXES:
Loading
Loading