Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into 202205
  • Loading branch information
isabelmsft committed Aug 10, 2023
2 parents 87d7d21 + 69d348d commit b879c20
Show file tree
Hide file tree
Showing 74 changed files with 1,886 additions and 173 deletions.
20 changes: 15 additions & 5 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1812,14 +1812,24 @@ def override_config_table(db, input_config_db, dry_run):
current_config = config_db.get_config()
# Serialize to the same format as json input
sonic_cfggen.FormatConverter.to_serialized(current_config)

if multi_asic.is_multi_asic():
ns_config_input = None
if multi_asic.is_multi_asic() and len(config_input):
# Golden Config will use "localhost" to represent host name
if ns == DEFAULT_NAMESPACE:
ns_config_input = config_input["localhost"]
if "localhost" in config_input.keys():
ns_config_input = config_input["localhost"]
else:
click.secho("Wrong config format! 'localhost' not found in host config! cannot override.. abort")
sys.exit(1)
else:
ns_config_input = config_input[ns]
else:
if ns in config_input.keys():
ns_config_input = config_input[ns]
else:
click.secho("Wrong config format! {} not found in asic config! cannot override.. abort".format(ns))
sys.exit(1)
if not ns_config_input:
# if ns_config_input is not defined, define it
# it could be single-asic dut, or config_input is empty
ns_config_input = config_input
# Generate sysinfo if missing in ns_config_input
generate_sysinfo(current_config, ns_config_input, ns)
Expand Down
17 changes: 17 additions & 0 deletions scripts/db_migrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,21 @@ def migrate_route_table(self):
route_key = "ROUTE_TABLE:{}".format(route_prefix)
self.appDB.set(self.appDB.APPL_DB, route_key, 'weight','')

def migrate_routing_config_mode(self):
# DEVICE_METADATA - synchronous_mode entry
if not self.minigraph_data or 'DEVICE_METADATA' not in self.minigraph_data:
return
device_metadata_old = self.configDB.get_entry('DEVICE_METADATA', 'localhost')
device_metadata_new = self.minigraph_data['DEVICE_METADATA']['localhost']
# overwrite the routing-config-mode as per minigraph parser
# Criteria for update:
# if config mode is missing in base OS or if base and target modes are not same
# Eg. in 201811 mode is "unified", and in newer branches mode is "separated"
if ('docker_routing_config_mode' not in device_metadata_old and 'docker_routing_config_mode' in device_metadata_new) or \
(device_metadata_old.get('docker_routing_config_mode') != device_metadata_new.get('docker_routing_config_mode')):
device_metadata_old['docker_routing_config_mode'] = device_metadata_new.get('docker_routing_config_mode')
self.configDB.set_entry('DEVICE_METADATA', 'localhost', device_metadata_old)

def update_edgezone_aggregator_config(self):
"""
Update cable length configuration in ConfigDB for T0 neighbor interfaces
Expand Down Expand Up @@ -985,6 +1000,8 @@ def common_migration_ops(self):

# Updating edgezone aggregator cable length config for T0 devices
self.update_edgezone_aggregator_config()
# update FRR config mode based on minigraph parser on target image
self.migrate_routing_config_mode()

def migrate(self):
version = self.get_version()
Expand Down
Loading

0 comments on commit b879c20

Please sign in to comment.