From 92afe3c1b80b3df35e9883a04ea03ed8dfe5a6a1 Mon Sep 17 00:00:00 2001 From: sousaedu Date: Wed, 3 Feb 2021 15:03:44 +0100 Subject: [PATCH] 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 --- NG-RO/osm_ng_ro/ns.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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"]]) -- 2.25.1