Skip to content
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

[config] Eliminate port breakout-related globals #1045

Merged
merged 3 commits into from
Aug 12, 2020
Merged

[config] Eliminate port breakout-related globals #1045

merged 3 commits into from
Aug 12, 2020

Conversation

jleveque
Copy link
Contributor

@jleveque jleveque commented Aug 11, 2020

Port breakout-related data should be gathered on-demand, not every time config is executed. If the ConfigDB is not ready, the call to get hwsku will hang indefinitely, which will occur when loading config for the first time. Also, if it fails to retrieve the port breakout globals, it will abort, even if the executed command was unrelated to port breakout. This is not desirable behavior.

This PR eliminates port breakout-related global variables, and encapsulates them in functions to be called on-demand, only when commands which require the data are executed. It is currently only accessed in two places. If we feel the need to cache it in the future for efficiency, we can look into adding it to the Click context.

Also rename _get_option() to _get_breakout_cfg_file_name() to add more detail.

@jleveque jleveque requested a review from lguohan August 11, 2020 20:43
@jleveque jleveque self-assigned this Aug 11, 2020
@jleveque jleveque mentioned this pull request Aug 11, 2020
@lgtm-com

This comment has been minimized.

@jleveque
Copy link
Contributor Author

@samaity: Please review.

@samaity
Copy link
Contributor

samaity commented Aug 12, 2020

LGTM 👍 , @jleveque

@jleveque jleveque merged commit 2d9d00d into sonic-net:master Aug 12, 2020
@jleveque jleveque deleted the fix_breakout branch August 12, 2020 18:50
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.

3 participants