Skip to content
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

Summary:New smartswitch DPU config template #16201

Merged
merged 11 commits into from
Jan 22, 2025
25 changes: 18 additions & 7 deletions ansible/library/generate_golden_config_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"Cisco-8102-28FH-DPU-O-T1": {
"dpu_num": 8,
"port_key": "Ethernet-BP{}",
"interface_key": "Ethernet-BP{}|18.{}.202.0/31",
"interface_key": "Ethernet-BP{}|18.{}.202.0/31"
}
}

Expand Down Expand Up @@ -74,7 +74,7 @@ def generate_mx_golden_config_db(self):
# Generate FEATURE table from init_cfg.ini
ori_config_db = json.loads(out)
if "FEATURE" not in ori_config_db or "dhcp_server" not in ori_config_db["FEATURE"]:
return {}
return "{}"

ori_config_db["FEATURE"]["dhcp_server"]["state"] = "enabled"
gold_config_db = {
Expand Down Expand Up @@ -125,23 +125,34 @@ def generate_smartswitch_golden_config_db(self):

if hwsku not in smartswitch_hwsku_config:
return "{}"

for i in range(smartswitch_hwsku_config[hwsku]["dpu_num"]):
port_key = smartswitch_hwsku_config[hwsku]["port_key"].format(i)
interface_key = smartswitch_hwsku_config[hwsku]["interface_key"].format(i, i)

for i in range(smartswitch_hwsku_config["dpu_num"]):
port_key = smartswitch_hwsku_config["port_key"].format(i)
interface_key = smartswitch_hwsku_config["interface_key"].format(i, i)
if port_key in ori_config_db["PORT"]:
ori_config_db["PORT"][port_key]["admin_status"] = "up"
ori_config_db["INTERFACE"][port_key] = {}
ori_config_db["INTERFACE"][interface_key] = {}


midplane_network_config = {
"midplane_network": {
"bridge_name": "bridge-midplane",
"bridge_address": "169.254.200.254/24"
}
}
ori_config_db["MIDPLANE_NETWORK"] = midplane_network_config

gold_config_db = {
"DEVICE_METADATA": copy.deepcopy(ori_config_db["DEVICE_METADATA"]),
"FEATURE": copy.deepcopy(ori_config_db["FEATURE"]),
"INTERFACE": copy.deepcopy(ori_config_db["INTERFACE"]),
"PORT": copy.deepcopy(ori_config_db["PORT"])
"PORT": copy.deepcopy(ori_config_db["PORT"]),
"MIDPLANE_NETWORK": copy.deepcopy(ori_config_db["MIDPLANE_NETWORK"])
nnelluri-cisco marked this conversation as resolved.
Show resolved Hide resolved
}

# Generate dhcp_server related configuration
#Generate dhcp_server related configuration
rc, out, err = self.module.run_command("cat {}".format(TEMP_SMARTSWITCH_CONFIG_PATH))
if rc != 0:
self.module.fail_json(msg="Failed to get smartswitch config: {}".format(err))
Expand Down
Loading