Skip to content

Commit

Permalink
Merge pull request #356 from SUNET/feature.dist_downlink_fabric_extra…
Browse files Browse the repository at this point in the history
…_fields

Allow downlink and fabric interfaces to specify aggregate_id, enabled
  • Loading branch information
indy-independence authored Jun 26, 2024
2 parents f425c2a + b0d4855 commit 4f4e2a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
3 changes: 2 additions & 1 deletion docker/api/exec-pre-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ fi

set -e

cp /etc/cnaas-nms/repository.yml /tmp/repository.yml.original
sed -e "s|^\(templates_remote: \).\+$|\1 $GITREPO_TEMPLATES|" \
-e "s|^\(settings_remote: \).\+$|\1 $GITREPO_SETTINGS|" \
< /etc/cnaas-nms/repository.yml > /tmp/repository.yml.new \
< /tmp/repository.yml.original > /tmp/repository.yml.new \
&& cat /tmp/repository.yml.new > /etc/cnaas-nms/repository.yml

#if [ -e "/opt/cnaas/settings" ]; then
Expand Down
25 changes: 14 additions & 11 deletions src/cnaas_nms/devicehandler/sync_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,19 +272,22 @@ def populate_device_vars(
ifindexnum: int = 0
if "ifclass" not in intf:
continue
extra_keys = ["aggregate_id", "enabled", "cli_append_str"]
if intf["ifclass"] == "downlink":
data = {}
if intf["name"] in ifname_peer_map:
data["description"] = ifname_peer_map[intf["name"]]
fabric_device_variables["interfaces"].append(
{
"name": intf["name"],
"ifclass": intf["ifclass"],
"redundant_link": intf["redundant_link"],
"indexnum": ifindexnum,
"data": data,
}
)
if_dict = {
"name": intf["name"],
"ifclass": intf["ifclass"],
"redundant_link": intf["redundant_link"],
"indexnum": ifindexnum,
"data": data,
}
for extra_key_name in extra_keys:
if extra_key_name in intf:
if_dict[extra_key_name] = intf[extra_key_name]
fabric_device_variables["interfaces"].append(if_dict)
elif intf["ifclass"] == "custom":
fabric_device_variables["interfaces"].append(
{
Expand Down Expand Up @@ -315,8 +318,8 @@ def populate_device_vars(
)
else:
if_dict = {"indexnum": ifindexnum}
for key, value in intf.items():
if_dict[key] = value
for extra_key_name, value in intf.items():
if_dict[extra_key_name] = value
fabric_device_variables["interfaces"].append(if_dict)

for local_if, data in fabric_interfaces.items():
Expand Down

0 comments on commit 4f4e2a0

Please sign in to comment.