Additional null checks while building vserver 87/111687/1
authorKuleshov, Elena <evn@att.com>
Tue, 25 Aug 2020 14:05:34 +0000 (10:05 -0400)
committerBenjamin, Max (mb388a) <mb388a@att.com>
Tue, 25 Aug 2020 14:05:35 +0000 (10:05 -0400)
Additional null checks while building vserver interfaces.

Issue-ID: SO-3197
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I9835535e6b13ee434a1532e1a739184b56bbc011

adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java

index ef2577d..45d91c2 100644 (file)
@@ -303,6 +303,8 @@ public class HeatBridgeImpl implements HeatBridgeApi {
         Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT);
         List<String> portIds =
                 extractStackResourceIdsByResourceType(stackResources, HeatBridgeConstants.OS_PORT_RESOURCE_TYPE);
+        if (portIds == null)
+            return;
         for (String portId : portIds) {
             Port port = osClient.getPortById(portId);
             Network network = osClient.getNetworkById(port.getNetworkId());
@@ -320,7 +322,7 @@ public class HeatBridgeImpl implements HeatBridgeApi {
                 lIf.setInterfaceRole(port.getvNicType());
             }
             boolean isL2Multicast = false;
-            if (port.getProfile().get("trusted") != null) {
+            if (port.getProfile() != null && port.getProfile().get("trusted") != null) {
                 String trusted = port.getProfile().get("trusted").toString();
                 if (Boolean.parseBoolean(trusted)) {
                     isL2Multicast = true;