Skip to content

Comments

Start Jetty server in BGP example#2447

Merged
ihrasko merged 1 commit intoPANTHEONtech:mainfrom
PeterSuna:fixBgpRestcont
Nov 10, 2025
Merged

Start Jetty server in BGP example#2447
ihrasko merged 1 commit intoPANTHEONtech:mainfrom
PeterSuna:fixBgpRestcont

Conversation

@PeterSuna
Copy link
Contributor

@PeterSuna PeterSuna commented Nov 6, 2025

Without this Jetty initialization, we will not be able to use Restconf API.

JIRA: LIGHTY-397

@gemini-code-assist
Copy link

Summary of Changes

Hello @PeterSuna, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical initialization step for the BGP example application. It ensures that the Restconf API is properly enabled and accessible by explicitly starting the embedded Jetty server. Without this change, the Restconf API would not be operational, hindering the application's ability to interact via its intended interface.

Highlights

  • Import CommunityRestConf: The CommunityRestConf class is now imported, providing access to its specific functionalities.
  • Refactored restconf field type: The restconf instance variable has been updated from the generic LightyModule to the more specific CommunityRestConf type, allowing direct access to CommunityRestConf methods.
  • Jetty server initialization: An explicit call to restconf.startServer() has been added after the Restconf module is initialized, ensuring the underlying Jetty server is started and the Restconf API is functional.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly fixes a bug in the BGP example application where the Jetty server for Restconf was not being started, making the API inaccessible. The changes involve updating the restconf module's type to its concrete implementation and adding the necessary startServer() call. While the fix is correct, I've added a comment regarding a potential design improvement in the CommunityRestConf module to make its startup process more aligned with the LightyModule interface, which would improve long-term maintainability.

.build();
Preconditions.checkState(startLightyModule(restconf, modulesConfig.getModuleTimeoutSeconds()),
"Unable to start restconf module");
restconf.startServer();

Choose a reason for hiding this comment

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

medium

Calling startServer() here fixes the issue of the Restconf API not being available. However, the need to call this method separately after startLightyModule() suggests a design issue in CommunityRestConf.

The LightyModule interface contract implies that the start() method should be sufficient to make a module operational. By requiring an additional startServer() call, CommunityRestConf creates a "leaky abstraction," forcing consumers to be aware of its internal startup sequence. This is why the restconf field's type had to be changed from LightyModule to the concrete CommunityRestConf.

For better maintainability and adherence to the LightyModule contract, the logic within startServer() should ideally be part of the CommunityRestConf.initProcedure() method. This would make the module's startup atomic from the consumer's perspective and avoid the need for casting to a concrete type.

While changing CommunityRestConf is likely out of scope here, it's worth considering a follow-up to refactor it for a cleaner API.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@PeterSuna create a ticket for this fix, and a separate one with suggestion above.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Done.

.build();
Preconditions.checkState(startLightyModule(restconf, modulesConfig.getModuleTimeoutSeconds()),
"Unable to start restconf module");
restconf.startServer();
Copy link
Collaborator

Choose a reason for hiding this comment

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

@PeterSuna create a ticket for this fix, and a separate one with suggestion above.

Without this Jetty initialization, we will not be able to use
Restconf API.

JIRA: LIGHTY-397
Signed-off-by: Peter Suna <[email protected]>
@ihrasko ihrasko self-requested a review November 10, 2025 11:32
@ihrasko ihrasko merged commit d65a66b into PANTHEONtech:main Nov 10, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants