From 1900848f8ab8e046f5184da5a2763e22ab7ba648 Mon Sep 17 00:00:00 2001 From: lloretgalleg Date: Mon, 19 Apr 2021 11:40:18 +0000 Subject: [PATCH 1/1] Fixed bug 1476: VLD params (ip-profile) inside a NS not used Change-Id: I3f330610659a1b627dd74bfd9e1dd4d722ebf7d2 Signed-off-by: lloretgalleg --- osm_lcm/ns.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index 5b0b7b0..1bcf4c7 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -698,12 +698,25 @@ class NsLcm(LcmBase): # check at nsd descriptor, if there is an ip-profile vld_params = {} - virtual_link_profiles = get_virtual_link_profiles(nsd) + nsd_vlp = find_in_list( + get_virtual_link_profiles(nsd), + lambda a_link_profile: a_link_profile["virtual-link-desc-id"] == vld["id"]) + if nsd_vlp and nsd_vlp.get("virtual-link-protocol-data") and \ + nsd_vlp["virtual-link-protocol-data"].get("l3-protocol-data"): + ip_profile_source_data = nsd_vlp["virtual-link-protocol-data"]["l3-protocol-data"] + ip_profile_dest_data = {} + if "ip-version" in ip_profile_source_data: + ip_profile_dest_data["ip-version"] = ip_profile_source_data["ip-version"] + if "cidr" in ip_profile_source_data: + ip_profile_dest_data["subnet-address"] = ip_profile_source_data["cidr"] + if "gateway-ip" in ip_profile_source_data: + ip_profile_dest_data["gateway-address"] = ip_profile_source_data["gateway-ip"] + if "dhcp-enabled" in ip_profile_source_data: + ip_profile_dest_data["dhcp-params"] = { + "enabled": ip_profile_source_data["dhcp-enabled"] + } + vld_params["ip-profile"] = ip_profile_dest_data - for vlp in virtual_link_profiles: - ip_profile = find_in_list(nsd["ip-profiles"], - lambda profile: profile["name"] == vlp["ip-profile-ref"]) - vld_params["ip-profile"] = ip_profile["ip-profile-params"] # update vld_params with instantiation params vld_instantiation_params = find_in_list(get_iterable(ns_params, "vld"), lambda a_vld: a_vld["name"] in (vld["name"], vld["id"])) -- 2.25.1