-
Notifications
You must be signed in to change notification settings - Fork 816
[muxcable] Add grpc CLI support for transceiver presence retrieval from TRANSCEIVER_INFO table #3857
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
[muxcable] Add grpc CLI support for transceiver presence retrieval from TRANSCEIVER_INFO table #3857
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2177,7 +2177,7 @@ def get_grpc_cached_version_mux_direction_per_port(db, port): | |||||||||||
| mux_info_full_dict[asic_index] = state_db[asic_index].get_all( | ||||||||||||
| state_db[asic_index].STATE_DB, 'MUX_CABLE_INFO|{}'.format(port)) | ||||||||||||
| trans_info_full_dict[asic_index] = state_db[asic_index].get_all( | ||||||||||||
| state_db[asic_index].STATE_DB, 'TRANSCEIVER_STATUS|{}'.format(port)) | ||||||||||||
| state_db[asic_index].STATE_DB, 'TRANSCEIVER_INFO|{}'.format(port)) or {} | ||||||||||||
|
|
||||||||||||
| res_dir = {} | ||||||||||||
| res_dir = mux_info_full_dict[asic_index] | ||||||||||||
|
|
@@ -2186,10 +2186,9 @@ def get_grpc_cached_version_mux_direction_per_port(db, port): | |||||||||||
| mux_info_dict["grpc_connection_status"] = res_dir.get("grpc_connection_status", None) | ||||||||||||
|
|
||||||||||||
| trans_dir = {} | ||||||||||||
| trans_dir = trans_info_full_dict[asic_index] | ||||||||||||
|
|
||||||||||||
| status = trans_dir.get("status", "0") | ||||||||||||
| presence = "True" if status == "1" else "False" | ||||||||||||
| trans_dir = trans_info_full_dict.get(asic_index, None) | ||||||||||||
|
|
||||||||||||
| presence = "True" if trans_dir else "False" | ||||||||||||
|
|
||||||||||||
|
Comment on lines
+2191
to
2192
|
||||||||||||
| presence = "True" if trans_dir else "False" | |
| if trans_dir is not None: # Table exists | |
| presence = "True" # Treat empty dictionary as presence | |
| else: | |
| presence = "False" # Table does not exist |
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.
what is the or condition here ?
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.
@vdahiya12 The or condition is just to ensure that an empty dictionary is returned rather None to avoid a crash.