[src/libraries/sonic-fib]: Add sonic-fib library to build libnexthopgroup deb for RIB/FIB#26423
Conversation
d1ab862 to
5d481bd
Compare
5d481bd to
afce0cf
Compare
This comment was marked as duplicate.
This comment was marked as duplicate.
b2a3564 to
934bc94
Compare
|
/azpw ms_conflict |
1 similar comment
|
/azpw ms_conflict |
8a3afc9 to
508d9ee
Compare
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
Update compiling files to build libnexthopgroup debian for sonic-fib. Signed-off-by: Eddie Ruan <eddie.ruan@alibaba-inc.com> Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com>
Introduce sonic-fib, a C++ library that provides encoding and decoding capabilities for NextHopGroupFull objects: - FRR uses the encoding function to generate a JSON string embedded in messages sent to fpmsyncd - fpmsyncd uses the decoding function to reconstruct the NHG object from the incoming JSON string To minimize human error, the library uses a JSON Schema as the single source of truth and Jinja2 templates to auto-generate the required code. Key components: - Data schema: NextHopGroupFull.json drives auto-generation of C++ classes, JSON codecs, and C struct wrappers via render_schema.py + Jinja2. - C-API: C-callable interface for FRR to encode NHG objects into JSON. - Logging: pluggable FIB_LOG macro with per-process callback registration (fib_frr_register_callback for FRR, registerLogCallback for SWSS). - Unit tests: covers C++ class behavior, JSON round-trip, C-API conversion, and logging callback using Google Test. Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com> Signed-off-by: Eddie Ruan <eddie.ruan@alibaba-inc.com>
6af317e to
e741921
Compare
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
|
Hi @deepak-singhal0408 , thanks a lot for your review. I've addressed all the comments above. |
deepak-singhal0408
left a comment
There was a problem hiding this comment.
Thanks for addressing the review comments @GaladrielZhao .. LGTM.
…roup deb for RIB/FIB (sonic-net#26423) * [rules][src]: Add sonic-fib for nexthopgroup deb Update compiling files to build libnexthopgroup debian for sonic-fib. Signed-off-by: Eddie Ruan <eddie.ruan@alibaba-inc.com> Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com> * [src/libraries/sonic-fib]: Implementation for sonic-fib Introduce sonic-fib, a C++ library that provides encoding and decoding capabilities for NextHopGroupFull objects: - FRR uses the encoding function to generate a JSON string embedded in messages sent to fpmsyncd - fpmsyncd uses the decoding function to reconstruct the NHG object from the incoming JSON string To minimize human error, the library uses a JSON Schema as the single source of truth and Jinja2 templates to auto-generate the required code. Key components: - Data schema: NextHopGroupFull.json drives auto-generation of C++ classes, JSON codecs, and C struct wrappers via render_schema.py + Jinja2. - C-API: C-callable interface for FRR to encode NHG objects into JSON. - Logging: pluggable FIB_LOG macro with per-process callback registration (fib_frr_register_callback for FRR, registerLogCallback for SWSS). - Unit tests: covers C++ class behavior, JSON round-trip, C-API conversion, and logging callback using Google Test. Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com> Signed-off-by: Eddie Ruan <eddie.ruan@alibaba-inc.com> --------- Signed-off-by: Eddie Ruan <eddie.ruan@alibaba-inc.com> Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com> Signed-off-by: Vidya Chidambaram <vidya_chidambaram@dell.com>
|
@GaladrielZhao, sairedis PR CI checks are failing with below linking errors. Can you please check if it is related to your PR and kindly fix? |
Hi @radha-danda , thanks for your update. I've opened a PR sonic-net/sonic-sairedis#1908 to fix this. It adds the libnexthopgroup deb download and installation to sairedis CI pipeline files. |
…roup deb for RIB/FIB (sonic-net#26423) * [rules][src]: Add sonic-fib for nexthopgroup deb Update compiling files to build libnexthopgroup debian for sonic-fib. Signed-off-by: Eddie Ruan <eddie.ruan@alibaba-inc.com> Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com> * [src/libraries/sonic-fib]: Implementation for sonic-fib Introduce sonic-fib, a C++ library that provides encoding and decoding capabilities for NextHopGroupFull objects: - FRR uses the encoding function to generate a JSON string embedded in messages sent to fpmsyncd - fpmsyncd uses the decoding function to reconstruct the NHG object from the incoming JSON string To minimize human error, the library uses a JSON Schema as the single source of truth and Jinja2 templates to auto-generate the required code. Key components: - Data schema: NextHopGroupFull.json drives auto-generation of C++ classes, JSON codecs, and C struct wrappers via render_schema.py + Jinja2. - C-API: C-callable interface for FRR to encode NHG objects into JSON. - Logging: pluggable FIB_LOG macro with per-process callback registration (fib_frr_register_callback for FRR, registerLogCallback for SWSS). - Unit tests: covers C++ class behavior, JSON round-trip, C-API conversion, and logging callback using Google Test. Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com> Signed-off-by: Eddie Ruan <eddie.ruan@alibaba-inc.com> --------- Signed-off-by: Eddie Ruan <eddie.ruan@alibaba-inc.com> Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com>
…roup deb for RIB/FIB (sonic-net#26423) * [rules][src]: Add sonic-fib for nexthopgroup deb Update compiling files to build libnexthopgroup debian for sonic-fib. Signed-off-by: Eddie Ruan <eddie.ruan@alibaba-inc.com> Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com> * [src/libraries/sonic-fib]: Implementation for sonic-fib Introduce sonic-fib, a C++ library that provides encoding and decoding capabilities for NextHopGroupFull objects: - FRR uses the encoding function to generate a JSON string embedded in messages sent to fpmsyncd - fpmsyncd uses the decoding function to reconstruct the NHG object from the incoming JSON string To minimize human error, the library uses a JSON Schema as the single source of truth and Jinja2 templates to auto-generate the required code. Key components: - Data schema: NextHopGroupFull.json drives auto-generation of C++ classes, JSON codecs, and C struct wrappers via render_schema.py + Jinja2. - C-API: C-callable interface for FRR to encode NHG objects into JSON. - Logging: pluggable FIB_LOG macro with per-process callback registration (fib_frr_register_callback for FRR, registerLogCallback for SWSS). - Unit tests: covers C++ class behavior, JSON round-trip, C-API conversion, and logging callback using Google Test. Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com> Signed-off-by: Eddie Ruan <eddie.ruan@alibaba-inc.com> --------- Signed-off-by: Eddie Ruan <eddie.ruan@alibaba-inc.com> Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com>
…roup deb for RIB/FIB (sonic-net#26423) * [rules][src]: Add sonic-fib for nexthopgroup deb Update compiling files to build libnexthopgroup debian for sonic-fib. Signed-off-by: Eddie Ruan <eddie.ruan@alibaba-inc.com> Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com> * [src/libraries/sonic-fib]: Implementation for sonic-fib Introduce sonic-fib, a C++ library that provides encoding and decoding capabilities for NextHopGroupFull objects: - FRR uses the encoding function to generate a JSON string embedded in messages sent to fpmsyncd - fpmsyncd uses the decoding function to reconstruct the NHG object from the incoming JSON string To minimize human error, the library uses a JSON Schema as the single source of truth and Jinja2 templates to auto-generate the required code. Key components: - Data schema: NextHopGroupFull.json drives auto-generation of C++ classes, JSON codecs, and C struct wrappers via render_schema.py + Jinja2. - C-API: C-callable interface for FRR to encode NHG objects into JSON. - Logging: pluggable FIB_LOG macro with per-process callback registration (fib_frr_register_callback for FRR, registerLogCallback for SWSS). - Unit tests: covers C++ class behavior, JSON round-trip, C-API conversion, and logging callback using Google Test. Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com> Signed-off-by: Eddie Ruan <eddie.ruan@alibaba-inc.com> --------- Signed-off-by: Eddie Ruan <eddie.ruan@alibaba-inc.com> Signed-off-by: Yuqing Zhao <galadriel.zyq@alibaba-inc.com>
Why I did it
This is the first PR of the RIB/FIB project.
Currently, fpmsyncd receives only partial nexthop information from FRR. To support nexthop object with full information
(called as NextHopGroupFull) passed from FRR (zebra) to fpmsyncd, a shared serialization library is needed so both processes can encode or decode NHG data consistently.
Work item tracking
How I did it
Introduce sonic-fib, a C++ library that provides encoding and decoding capabilities for NextHopGroupFull objects:
To minimize human error, the library uses a JSON Schema as the single source of truth and Jinja2 templates to auto-generate the required code.
(1) Key components:
(2) Architecture

(3) Directory Structure
Note: The generated files in templates/references are only kept for review and will not be committed later.
How to verify it
There is a UT module in sonic-fib, containing GTests for all functions.
A picture of a cute animal (not mandatory but encouraged)