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

Delete TRSNCEIVER tables while config reload #3680

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,18 @@ def flush_configdb(namespace=DEFAULT_NAMESPACE):
return client, config_db


def delete_transceiver_tables():
tables = ["TRANSCEIVER_INFO", "TRANSCEIVER_STATUS", "TRANSCEIVER_PM",
"TRANSCEIVER_FIRMWARE_INFO", "TRANSCEIVER_DOM_SENSOR", "TRANSCEIVER_DOM_THRESHOLD"]
state_db_del_pattern = "|*"

# delete TRANSCEIVER tables from State DB
state_db = SonicV2Connector(use_unix_socket_path=True)
state_db.connect(state_db.STATE_DB, False)
for table in tables:
state_db.delete_all_by_pattern(state_db.STATE_DB, table + state_db_del_pattern)


def migrate_db_to_lastest(namespace=DEFAULT_NAMESPACE):
# Migrate DB contents to latest version
db_migrator = '/usr/local/bin/db_migrator.py'
Expand Down Expand Up @@ -1900,6 +1912,7 @@ def reload(db, filename, yes, load_sysinfo, no_service_restart, force, file_form
cfg_hwsku = output.strip()

client, config_db = flush_configdb(namespace)
delete_transceiver_tables()

if load_sysinfo:
if namespace is DEFAULT_NAMESPACE:
Expand Down Expand Up @@ -2035,6 +2048,7 @@ def load_minigraph(db, no_service_restart, traffic_shift_away, override_config,
#Stop services before config push
if not no_service_restart:
log.log_notice("'load_minigraph' stopping services...")
delete_transceiver_tables()
_stop_services()

# For Single Asic platform the namespace list has the empty string
Expand Down
Loading