From: sousaedu Date: Wed, 3 Feb 2021 14:03:44 +0000 (+0100) Subject: Partial fix for Bug 1408 X-Git-Tag: branch-sol006v331-start~16 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FRO.git;a=commitdiff_plain;h=239714b6df49d5d88a099e57006f1ac6e58a57a1 Partial fix for Bug 1408 This fixes the access to a non-exisiting key. There is another bug that is causing this in LCM (bug 1431). Change-Id: Ied80beb56657ead95eefa9ed967eca84e623f9c3 Signed-off-by: sousaedu --- diff --git a/NG-RO/osm_ng_ro/ns.py b/NG-RO/osm_ng_ro/ns.py index f6210514..1c2e960a 100644 --- a/NG-RO/osm_ng_ro/ns.py +++ b/NG-RO/osm_ng_ro/ns.py @@ -510,10 +510,11 @@ class Ns(object): "ip_version": "IPv4" if "v4" in ip_profile.get("ip-version", "ipv4") else "IPv6", "subnet_address": ip_profile.get("subnet-address"), "gateway_address": ip_profile.get("gateway-address"), - "dhcp_enabled": ip_profile["dhcp-params"].get("enabled", True), - "dhcp_start_address": ip_profile["dhcp-params"].get("start-address"), - "dhcp_count": ip_profile["dhcp-params"].get("count"), - + "dhcp_enabled": ip_profile["dhcp-params"].get("enabled", True) + if "dhcp_params" in ip_profile else False, + "dhcp_start_address": ip_profile["dhcp-params"].get("start-address") + if "dhcp_params" in ip_profile else None, + "dhcp_count": ip_profile["dhcp-params"].get("count") if "dhcp_params" in ip_profile else None, } if ip_profile.get("dns-server"): ro_ip_profile["dns_address"] = ";".join([v["address"] for v in ip_profile["dns-server"]])