Skip to content

Conversation

@benoit-nexthop
Copy link
Contributor

@benoit-nexthop benoit-nexthop commented Dec 18, 2025

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

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.

@meta-cla meta-cla bot added the CLA Signed label Dec 18, 2025
@benoit-nexthop benoit-nexthop marked this pull request as ready for review December 18, 2025 00:36
@benoit-nexthop benoit-nexthop force-pushed the fboss2-cli-prototype_part03 branch from 04bd218 to ab2a9fb Compare December 19, 2025 23:32
Copy link
Contributor

@joseph5wu joseph5wu left a 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

* @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(
Copy link
Contributor

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

Copy link
Contributor Author

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";
}
Copy link
Contributor

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.

Copy link
Contributor Author

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.

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
```
@benoit-nexthop benoit-nexthop force-pushed the fboss2-cli-prototype_part03 branch from 7a586bc to 4102813 Compare December 25, 2025 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants