diff options
author | Steve Smokowski <ss835w@att.com> | 2020-04-22 12:35:23 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-22 12:35:23 +0000 |
commit | 796ca4238b8647ee69d621f40b2dd13e094099b2 (patch) | |
tree | 42ca2570563c97d92b9b52b6f51a260e99619c6e /adapters | |
parent | 4a5372d661d780f5b641f44eadb295aeb8de44d8 (diff) | |
parent | 0c536f0a8e1327e085e92cdb8384f5de5e731a80 (diff) |
Merge "Add additional null checks when building pserver objects from openstack server object. This error is not reproduceable with mitaka and queens release of openstack" into frankfurt
Diffstat (limited to 'adapters')
2 files changed, 13 insertions, 2 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java index 6d3b0ab680..e83ec8387a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java @@ -278,6 +278,9 @@ public class HeatBridgeImpl implements HeatBridgeApi { @Override public void createPserversAndPinterfacesIfNotPresentInAai(final List<Resource> stackResources) throws HeatBridgeException { + if (stackResources == null) { + return; + } Map<String, Pserver> serverHostnames = getPserverMapping(stackResources); createPServerIfNotExists(serverHostnames); List<String> portIds = @@ -294,8 +297,13 @@ public class HeatBridgeImpl implements HeatBridgeApi { private Map<String, Pserver> getPserverMapping(final List<Resource> stackResources) { List<Server> osServers = getAllOpenstackServers(stackResources); Map<String, Pserver> pserverMap = new HashMap<>(); - for (Server server : osServers) { - pserverMap.put(server.getHost(), aaiHelper.buildPserver(server)); + if (osServers != null) { + for (Server server : osServers) { + Pserver pserver = aaiHelper.buildPserver(server); + if (pserver != null) { + pserverMap.put(server.getHost(), pserver); + } + } } return pserverMap; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java index adcde92917..727cdccff5 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java @@ -146,6 +146,9 @@ public class AaiHelper { * @return AAI Pserver object */ public Pserver buildPserver(final Server server) { + if (server == null || server.getHypervisorHostname() == null) { + return null; + } Pserver pserver = new Pserver(); pserver.setInMaint(false); pserver.setHostname(server.getHypervisorHostname()); |