-
Notifications
You must be signed in to change notification settings - Fork 664
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
Migrate GNMI table #3053
Migrate GNMI table #3053
Changes from 6 commits
78d8d0b
4e7d3f7
74e7d6a
845d19e
32bdd5f
a75bb57
25e80ba
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 |
---|---|---|
|
@@ -618,6 +618,25 @@ def migrate_telemetry(self): | |
if not certs: | ||
self.configDB.set_entry("TELEMETRY", "certs", telemetry_data.get("certs")) | ||
|
||
def migrate_gnmi(self): | ||
if self.config_src_data: | ||
if 'GNMI' in self.config_src_data: | ||
# If there's GNMI in minigraph or golden config, copy configuration from config_src_data | ||
gnmi_data = self.config_src_data['GNMI'] | ||
log.log_notice('Migrate GNMI configuration') | ||
if 'gnmi' in gnmi_data: | ||
self.configDB.set_entry("GNMI", "gnmi", gnmi_data.get('gnmi')) | ||
if 'certs' in gnmi_data: | ||
self.configDB.set_entry("GNMI", "certs", gnmi_data.get('certs')) | ||
else: | ||
# If there's no minigraph or golden config, copy configuration from CONFIG_DB TELEMETRY table | ||
gnmi = self.configDB.get_entry('TELEMETRY', 'gnmi') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, if TELEMETRY table is missing, db_migrator will not generate GNMI table. |
||
if gnmi: | ||
self.configDB.set_entry("GNMI", "gnmi", gnmi) | ||
certs = self.configDB.get_entry('TELEMETRY', 'certs') | ||
if certs: | ||
self.configDB.set_entry("GNMI", "certs", certs) | ||
|
||
def migrate_console_switch(self): | ||
# CONSOLE_SWITCH - add missing key | ||
if not self.config_src_data or 'CONSOLE_SWITCH' not in self.config_src_data: | ||
|
@@ -1137,9 +1156,20 @@ def version_202311_01(self): | |
def version_202311_02(self): | ||
""" | ||
Version 202311_02. | ||
This is current last erversion for 202311 branch | ||
""" | ||
log.log_info('Handling version_202311_02') | ||
# Update GNMI table | ||
self.migrate_gnmi() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding to an existing version is not safe. What if this operation was executed on a device running an older sonic image which already has database version reached 4.0.4? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
|
||
self.set_version('version_202311_03') | ||
return 'version_202311_03' | ||
|
||
def version_202311_03(self): | ||
""" | ||
Version 202311_03. | ||
This is current last erversion for 202311 branch | ||
""" | ||
log.log_info('Handling version_202311_03') | ||
self.set_version('version_202405_01') | ||
return 'version_202405_01' | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,6 @@ | |
"state": "enabled" | ||
}, | ||
"VERSIONS|DATABASE": { | ||
"VERSION": "version_4_0_4" | ||
"VERSION": "version_202405_01" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should not need to make this change. Is there a reason for this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no version_4_0_4 in db_migrator.py, does it make sense to use it in test? |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"GNMI|gnmi": { | ||
"client_auth": "true", | ||
"log_level": "2", | ||
"port": "50051" | ||
}, | ||
"GNMI|certs": { | ||
"server_key": "/etc/sonic/telemetry/streamingtelemetryserver.key", | ||
"ca_crt": "/etc/sonic/telemetry/dsmsroot.cer", | ||
"server_crt": "/etc/sonic/telemetry/streamingtelemetryserver.cer" | ||
}, | ||
"VERSIONS|DATABASE": { | ||
"VERSION": "version_202405_01" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"TELEMETRY|gnmi": { | ||
"client_auth": "true", | ||
"log_level": "2", | ||
"port": "50051" | ||
}, | ||
"TELEMETRY|certs": { | ||
"server_key": "/etc/sonic/telemetry/streamingtelemetryserver.key", | ||
"ca_crt": "/etc/sonic/telemetry/dsmsroot.cer", | ||
"server_crt": "/etc/sonic/telemetry/streamingtelemetryserver.cer" | ||
}, | ||
"VERSIONS|DATABASE": { | ||
"VERSION": "version_202311_01" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"GNMI|gnmi": { | ||
"client_auth": "true", | ||
"log_level": "2", | ||
"port": "50052" | ||
}, | ||
"GNMI|certs": { | ||
"server_key": "/etc/sonic/telemetry/streamingtelemetryserver.key", | ||
"ca_crt": "/etc/sonic/telemetry/dsmsroot.cer", | ||
"server_crt": "/etc/sonic/telemetry/streamingtelemetryserver.cer" | ||
}, | ||
"VERSIONS|DATABASE": { | ||
"VERSION": "version_202405_01" | ||
} | ||
} |
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.
There are upgrade/downgrade use cases. If self.configDB['GNMI'] already exists, you should not modify, right? #Closed
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.
Fixed, now I check GNMI table at first