summaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters
diff options
context:
space:
mode:
authorMunir Ahmad <munir.ahmad@bell.ca>2020-04-13 19:04:48 -0400
committerYuriy Malakov <Yuriy.Malakov@att.com>2020-04-14 10:41:38 +0000
commit0c47c70a55795801b90f2ee05c267a6996f1ae9d (patch)
tree5fb19b3753971212f8914b6517c48aec6bc457e5 /adapters/mso-openstack-adapters
parent8fe8b70f1cf10e53273b7292f0daad99257675e7 (diff)
Check for null when building pserver objects from op server obj
Issue-ID: SO-2802 Signed-off-by: Munir Ahmad <munir.ahmad@bell.ca> Change-Id: Idc7d2a4a831ece6347f5d6bc837a476bfa0b2d27 (cherry picked from commit a8e7c090c351fd5531e09724fcab8a419773cec7)
Diffstat (limited to 'adapters/mso-openstack-adapters')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java12
1 files changed, 9 insertions, 3 deletions
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 c578b29664..adcde92917 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
@@ -148,10 +148,16 @@ public class AaiHelper {
public Pserver buildPserver(final Server server) {
Pserver pserver = new Pserver();
pserver.setInMaint(false);
- pserver.setPserverId(server.getId());
pserver.setHostname(server.getHypervisorHostname());
- pserver.setPserverName2(server.getHost());
- pserver.setProvStatus(server.getStatus().value());
+ if (server.getId() != null) {
+ pserver.setPserverId(server.getId());
+ }
+ if (server.getHost() != null) {
+ pserver.setPserverName2(server.getHost());
+ }
+ if (server.getStatus() != null && server.getStatus().value() != null) {
+ pserver.setProvStatus(server.getStatus().value());
+ }
return pserver;
}