From 2897feb84e6e1739df8df53c05898da8c559d909 Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Fri, 13 Dec 2024 05:05:28 +0000 Subject: [PATCH] update --- .../smartswitch_t1-28-lag.json | 14 +++++++++---- ansible/library/generate_golden_config_db.py | 21 +++++++++++++++++-- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/ansible/golden_config_db/smartswitch_t1-28-lag.json b/ansible/golden_config_db/smartswitch_t1-28-lag.json index 6db093155f..7117fb396c 100644 --- a/ansible/golden_config_db/smartswitch_t1-28-lag.json +++ b/ansible/golden_config_db/smartswitch_t1-28-lag.json @@ -1,8 +1,5 @@ { "CHASSIS_MODULE": { - "DPU0": { - "admin_status": "down" - }, "DPU1": { "admin_status": "down" }, @@ -28,7 +25,7 @@ "DHCP_SERVER_IPV4": { "bridge-midplane": { "gateway": "169.254.200.254", - "lease_time": "600", + "lease_time": "31536000", "mode": "PORT", "netmask": "255.255.255.0", "state": "enabled" @@ -119,5 +116,14 @@ "log_level": "2", "port": "50052" } + }, + "STATIC_ROUTE": { + "default|10.2.0.1/32": { + "blackhole": "false", + "distance": "0", + "ifname": "", + "nexthop": "18.0.202.1", + "nexthop-vrf": "default" + } } } diff --git a/ansible/library/generate_golden_config_db.py b/ansible/library/generate_golden_config_db.py index 33cce0e16e..ed502e2d16 100644 --- a/ansible/library/generate_golden_config_db.py +++ b/ansible/library/generate_golden_config_db.py @@ -103,13 +103,30 @@ def generate_smartswitch_golden_config_db(self): return "{}" ori_config_db["DEVICE_METADATA"]["localhost"]["subtype"] = "SmartSwitch" - if "FEATURE" not in ori_config_db or "dhcp_server" not in ori_config_db["FEATURE"]: + if "FEATURE" not in ori_config_db \ + or "dhcp_server" not in ori_config_db["FEATURE"] \ + or "dhcp_relay" not in ori_config_db["FEATURE"]: return "{}" ori_config_db["FEATURE"]["dhcp_server"]["state"] = "enabled" + ori_config_db["FEATURE"]["dhcp_relay"]["state"] = "enabled" + + # Generate INTERFACE table for EthernetBPXX + if "PORT" not in ori_config_db or "INTERFACE" not in ori_config_db: + return "{}" + for i in range(8): + port_key = f"Ethernet-BP{i}" + interface_key = f"Ethernet-BP{i}|18.{i}.202.0/31" + 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] = {} + gold_config_db = { "DEVICE_METADATA": copy.deepcopy(ori_config_db["DEVICE_METADATA"]), - "FEATURE": copy.deepcopy(ori_config_db["FEATURE"]) + "FEATURE": copy.deepcopy(ori_config_db["FEATURE"]), + "INTERFACE": copy.deepcopy(ori_config_db["INTERFACE"]), + "PORT": copy.deepcopy(ori_config_db["PORT"]) } # Generate dhcp_server related configuration