Skip to content

Commit

Permalink
zebra: Add a new dataplane dplane_fpm_pb using protobuf in zebra.
Browse files Browse the repository at this point in the history
`dplane_fpm_pb` is a new dplane plugin in zebra using protobuf to encode data.
It will be built when `DPLANE_PB` option is in effect.

Signed-off-by: Hongyu Li <[email protected]>
  • Loading branch information
BIoodborne committed Aug 25, 2023
1 parent 19ad3e2 commit e7d4dce
Show file tree
Hide file tree
Showing 7 changed files with 1,027 additions and 4 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2796,6 +2796,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"])

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,12 +11,14 @@ 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/zebra_irdp.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
^^^^^^^^^^^^^

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
11 changes: 7 additions & 4 deletions doc/user/zebra.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1125,13 +1125,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 @@ -1145,6 +1147,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 @@ -1209,7 +1212,7 @@ 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
2 changes: 2 additions & 0 deletions redhat/frr.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ fi
%{_sbindir}/ripd
%{_sbindir}/bgpd
%{_sbindir}/mgmtd
%{_sbindir}/dplaneserver
%exclude %{_sbindir}/ssd
%if %{with_watchfrr}
%{_sbindir}/watchfrr
Expand Down Expand Up @@ -715,6 +716,7 @@ fi
%endif
%{_libdir}/frr/modules/zebra_cumulus_mlag.so
%{_libdir}/frr/modules/dplane_fpm_nl.so
%{_libdir}/frr/modules/dplane_fpm_pb.so
%{_libdir}/frr/modules/zebra_irdp.so
%{_libdir}/frr/modules/bgpd_bmp.so
%{_libdir}/libfrr_pb.so*
Expand Down
Loading

0 comments on commit e7d4dce

Please sign in to comment.