From 24b161f8829e5aa876f1aab13c43e31004b28a41 Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Wed, 29 Apr 2026 07:31:35 +0200 Subject: [PATCH] sonic: Fix STATIC_ROUTE clobber in OOB management path When a device has an OOB IP, generate_sonic_config() built the management default route by first resetting STATIC_ROUTE to an empty dict and then writing the single route into it: config["STATIC_ROUTE"] = {} config["STATIC_ROUTE"]["mgmt|0.0.0.0/0"] = {"nexthop": metalbox_ip} The assignment discards any routes loaded from /etc/sonic/config_db.json before reaching this point, silently wiping them on every sync. The reset was introduced in f4f2290 ("sonic: Add static default route in mgmt VRF"), at a time when config_db.json base loading did not exist yet. config was always an empty dict at that point, so the = {} was effectively an initialisation and cost nothing. Base config loading was added later, making the reset destructive without anyone noticing. Fix by writing the management route directly into the existing dict without resetting it first. AI-assisted: Claude Code Signed-off-by: Roger Luethi --- osism/tasks/conductor/sonic/config_generator.py | 1 - 1 file changed, 1 deletion(-) diff --git a/osism/tasks/conductor/sonic/config_generator.py b/osism/tasks/conductor/sonic/config_generator.py index 31fd43db..77efb67e 100644 --- a/osism/tasks/conductor/sonic/config_generator.py +++ b/osism/tasks/conductor/sonic/config_generator.py @@ -263,7 +263,6 @@ def generate_sonic_config(device, hwsku, device_as_mapping=None, config_version= 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} else: oob_ip = None