Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion files/sonic/config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -442,7 +443,7 @@
"TELEMETRY": {
"gnmi": {}
},
"VERSION": {
"VERSIONS": {
"DATABASE": {
"VERSION": "version_4_0_1"
}
Expand Down
17 changes: 10 additions & 7 deletions osism/tasks/conductor/sonic/config_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]:
Expand All @@ -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
Expand All @@ -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}"
)
Expand Down