-
Notifications
You must be signed in to change notification settings - Fork 367
[Nexthop][fboss2-dev] Add a utility class to help map ports to interfaces. #755
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
base: main
Are you sure you want to change the base?
[Nexthop][fboss2-dev] Add a utility class to help map ports to interfaces. #755
Conversation
04bd218 to
ab2a9fb
Compare
joseph5wu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it looks pretty good to me. Please address the two main comments:
- Removing vlog
- Use fboss strong type for the ids
fboss/cli/fboss2/utils/PortMap.h
Outdated
| * @param portName The name of the port (e.g., "eth1/20/1") | ||
| * @return The interface ID if found, std::nullopt otherwise | ||
| */ | ||
| std::optional<int32_t> getInterfaceIdForPort( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use FBOSS_STRONG_TYPE from https://github.com/facebook/fboss/blob/main/fboss/agent/types.h#L74
like we do in
https://github.com/facebook/fboss/blob/main/fboss/agent/ApplyThriftConfig.cpp#L674
Please update all the int32_t to the corresponding PortID or InterfaceID from this types.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| } | ||
|
|
||
| VLOG(2) << "Built port maps with " << portNameToLogicalId_.size() << " ports"; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will vlog dump this logging to the final output of your CLI?
We usually don't use vlog in fboss but xlog from folly.
If you don't need this logging, I'd suggest to remove it cause this is cli tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default it's not visible in the output of the CLI, no, unless you turn on verbose logging.
ab2a9fb to
1e8d134
Compare
3038f6a to
7a586bc
Compare
Sample output: ``` Config Applied Information: =========================== Last Applied Time: 2025-10-11 09:29:36.589 Last Coldboot Applied Time: 2025-10-11 06:44:36.741 ```
7a586bc to
4102813
Compare
Pre-submission checklist
pip install -r requirements-dev.txt && pre-commit installpre-commit runSummary
This is a small helper class used to lookup ports and interfaces in a consistent fashion in CLI commands.
Note: this change is part of a series, the previous one is #754, the next one is #756.
Test Plan
Unit tests.