diff --git a/files/sonic/config_db.json b/files/sonic/config_db.json index 8cccb179..7ed1e677 100644 --- a/files/sonic/config_db.json +++ b/files/sonic/config_db.json @@ -423,6 +423,7 @@ "TYPE": "RO" } }, + "STATIC_ROUTE": {}, "SSHD_COMMON": { "GLOBAL": { "ciphers": "aes128-ctr,aes192-ctr,aes256-ctr,chacha20-poly1305@openssh.com,aes128-gcm@openssh.com,aes256-gcm@openssh.com", @@ -442,7 +443,7 @@ "TELEMETRY": { "gnmi": {} }, - "VERSION": { + "VERSIONS": { "DATABASE": { "VERSION": "version_4_0_1" } diff --git a/osism/tasks/conductor/sonic/config_generator.py b/osism/tasks/conductor/sonic/config_generator.py index 4ef13f12..eb0d1e7d 100644 --- a/osism/tasks/conductor/sonic/config_generator.py +++ b/osism/tasks/conductor/sonic/config_generator.py @@ -255,6 +255,9 @@ def generate_sonic_config(device, hwsku, device_as_mapping=None, config_version= oob_ip, prefix_len = oob_ip_result config["MGMT_INTERFACE"]["eth0"] = {"admin_status": "up"} config["MGMT_INTERFACE"][f"eth0|{oob_ip}/{prefix_len}"] = {} + metalbox_ip = _get_metalbox_ip_for_device(device) + config["STATIC_ROUTE"] = {} + config["STATIC_ROUTE"]["mgmt|0.0.0.0/0"] = {"nexthop": metalbox_ip} # Add breakout configuration if breakout_info["breakout_cfgs"]: @@ -269,10 +272,10 @@ def generate_sonic_config(device, hwsku, device_as_mapping=None, config_version= _add_vrf_configuration(config, vrf_info, netbox_interfaces) # Set DATABASE VERSION from config_version parameter or default - if "VERSION" not in config: - config["VERSION"] = {} - if "DATABASE" not in config["VERSION"]: - config["VERSION"]["DATABASE"] = {} + if "VERSIONS" not in config: + config["VERSIONS"] = {} + if "DATABASE" not in config["VERSIONS"]: + config["VERSIONS"]["DATABASE"] = {} if config_version: # Normalize config_version: add "version_" prefix if not present @@ -283,12 +286,12 @@ def generate_sonic_config(device, hwsku, device_as_mapping=None, config_version= f"Normalized config_version from '{config_version}' to '{normalized_version}' for device {device.name}" ) - config["VERSION"]["DATABASE"]["VERSION"] = normalized_version + config["VERSIONS"]["DATABASE"]["VERSION"] = normalized_version logger.info( f"Using custom config_version '{normalized_version}' for device {device.name}" ) - elif "VERSION" not in config.get("VERSION", {}).get("DATABASE", {}): - config["VERSION"]["DATABASE"]["VERSION"] = "version_4_0_1" + elif "VERSION" not in config.get("VERSIONS", {}).get("DATABASE", {}): + config["VERSIONS"]["DATABASE"]["VERSION"] = "version_4_0_1" logger.debug( f"Using default config_version 'version_4_0_1' for device {device.name}" )