|
90 | 90 | y_cable_port_instances = {} |
91 | 91 | y_cable_port_locks = {} |
92 | 92 |
|
| 93 | +disable_telemetry = False |
93 | 94 |
|
94 | 95 | Y_CABLE_STATUS_NO_TOR_ACTIVE = 0 |
95 | 96 | Y_CABLE_STATUS_TORA_ACTIVE = 1 |
@@ -1505,6 +1506,11 @@ def delete_ports_status_for_y_cable(): |
1505 | 1506 |
|
1506 | 1507 | def check_identifier_presence_and_update_mux_info_entry(state_db, mux_tbl, asic_index, logical_port_name): |
1507 | 1508 |
|
| 1509 | + global disable_telemetry |
| 1510 | + |
| 1511 | + if disable_telemetry == True: |
| 1512 | + return |
| 1513 | + |
1508 | 1514 | # Get the namespaces in the platform |
1509 | 1515 | config_db, port_tbl = {}, {} |
1510 | 1516 | namespaces = multi_asic.get_front_end_namespaces() |
@@ -3323,6 +3329,35 @@ def handle_hw_mux_cable_table_grpc_notification(fvp, hw_mux_cable_tbl, asic_inde |
3323 | 3329 | helper_logger.log_info("Got a change event on port {} of table {} that does not contain state".format( |
3324 | 3330 | port, swsscommon.APP_HW_MUX_CABLE_TABLE_NAME)) |
3325 | 3331 |
|
| 3332 | +def handle_ycable_enable_disable_tel_notification(fvp_m, key): |
| 3333 | + |
| 3334 | + global disable_telemetry |
| 3335 | + |
| 3336 | + if fvp_m: |
| 3337 | + |
| 3338 | + if key != "Y_CABLE": |
| 3339 | + return |
| 3340 | + |
| 3341 | + fvp_dict = dict(fvp_m) |
| 3342 | + if "log_verbosity" in fvp_dict: |
| 3343 | + # check if xcvrd got a probe command |
| 3344 | + probe_identifier = fvp_dict["log_verbosity"] |
| 3345 | + |
| 3346 | + if probe_identifier == "debug": |
| 3347 | + helper_logger.set_min_log_priority_debug() |
| 3348 | + |
| 3349 | + elif probe_identifier == "notice": |
| 3350 | + helper_logger.set_min_log_priority_notice() |
| 3351 | + if "disable_telemetry" in fvp_dict: |
| 3352 | + # check if xcvrd got a probe command |
| 3353 | + enable = fvp_dict["disable_telemetry"] |
| 3354 | + |
| 3355 | + helper_logger.log_notice("Y_CABLE_DEBUG: trying to enable/disable telemetry flag to {}".format(enable)) |
| 3356 | + if enable == "True": |
| 3357 | + disable_telemetry = True |
| 3358 | + |
| 3359 | + elif enable == "False": |
| 3360 | + disable_telemetry = False |
3326 | 3361 |
|
3327 | 3362 | # Thread wrapper class to update y_cable status periodically |
3328 | 3363 | class YCableTableUpdateTask(object): |
@@ -3727,22 +3762,10 @@ def task_cli_worker(self): |
3727 | 3762 | if not key: |
3728 | 3763 | break |
3729 | 3764 |
|
3730 | | - helper_logger.log_notice("Y_CABLE_DEBUG: trying to enable/disable debug logs") |
3731 | 3765 | if fvp_m: |
3732 | | - |
3733 | | - if key == "Y_CABLE": |
3734 | | - continue |
3735 | | - |
3736 | | - fvp_dict = dict(fvp_m) |
3737 | | - if "log_verbosity" in fvp_dict: |
3738 | | - # check if xcvrd got a probe command |
3739 | | - probe_identifier = fvp_dict["log_verbosity"] |
3740 | | - |
3741 | | - if probe_identifier == "debug": |
3742 | | - helper_logger.set_min_log_priority_debug() |
3743 | | - |
3744 | | - elif probe_identifier == "notice": |
3745 | | - helper_logger.set_min_log_priority_notice() |
| 3766 | + helper_logger.log_notice("Y_CABLE_DEBUG: trying to enable/disable debug logs") |
| 3767 | + handle_ycable_enable_disable_tel_notification(fvp_m, 'Y_CABLE') |
| 3768 | + break |
3746 | 3769 |
|
3747 | 3770 | while True: |
3748 | 3771 | # show muxcable hwmode state <port> |
|
0 commit comments