Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
wen587 committed Dec 13, 2024
1 parent 8c096ea commit 2897feb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
14 changes: 10 additions & 4 deletions ansible/golden_config_db/smartswitch_t1-28-lag.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"CHASSIS_MODULE": {
"DPU0": {
"admin_status": "down"
},
"DPU1": {
"admin_status": "down"
},
Expand All @@ -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"
Expand Down Expand Up @@ -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"
}
}
}
21 changes: 19 additions & 2 deletions ansible/library/generate_golden_config_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2897feb

Please sign in to comment.