summaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2020-04-16 18:30:46 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-16 18:30:46 +0000
commit0de788a5af875ee19a582672cc4e05b0e247a921 (patch)
tree2a8373485be3bc6bad44ac9aeac8edf14fe4cd66 /adapters/mso-openstack-adapters
parent5ca9cebe4129d6cd7e03d347c375282c69e94c35 (diff)
parent07ce5295b9bdb628cfb67f41026a30470942ce61 (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"
Diffstat (limited to 'adapters/mso-openstack-adapters')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java12
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java3
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 4df58484d8..390ed38764 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
@@ -277,6 +277,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 =
@@ -293,8 +296,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());