Skip to content

Commit

Permalink
update generate_templates
Browse files Browse the repository at this point in the history
  • Loading branch information
haberkornsam committed Nov 1, 2024
1 parent 70e3a75 commit 377130a
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions generate_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def generate_body(devicemap):
)
def_route_exists = False
for index, dev_intf in enumerate(devicemap["ethernet"]):
if dev_intf["type"] == "MGMT":
if dev_intf["type"] in ["MGMT", "SWITCH"]:
continue
intf = {"pciAddress": dev_intf["pciAddress"]} if dev_intf.get("pciAddress") else {}
intf.update({
Expand Down Expand Up @@ -424,8 +424,7 @@ def img_exists(vendor, model):
def resolve_alias(devicemap, sku_map):
if not devicemap.get("alias"):
return devicemap
if not (devicemap.get("ethernet") or devicemap.get("lte")):
return None

alias_map = resolve_alias(
lookup_devicemap(
devicemap["alias"]["vendor"],
Expand All @@ -434,8 +433,25 @@ def resolve_alias(devicemap, sku_map):
),
sku_map,
)
del devicemap["alias"]
alias_map.update(devicemap)
method = device_map["alias"].get("method", "")

del device_map["alias"]

if not alias_map.get("ethernet"):
alias_map["ethernet"] = []
if not alias_map.get("lte"):
alias_map["lte"] = []

if method.lower() == "append":
try:
alias_map["ethernet"].extend(device_map.pop("ethernet"))
except KeyError:
pass
try:
alias_map["lte"].extend(device_map.pop("lte"))
except KeyError:
pass

return alias_map

def lookup_devicemap(vendor, sku, sku_map):
Expand Down

0 comments on commit 377130a

Please sign in to comment.