summaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src
diff options
context:
space:
mode:
authorOleksandr Moliavko <o.moliavko@samsung.com>2019-07-30 13:30:40 +0300
committerOleksandr Moliavko <o.moliavko@samsung.com>2019-07-30 15:35:34 +0300
commitbfc7997e306a59ce3c2640ea409fe0383d82588c (patch)
treec057bc0888a7fc7090efac981dbfb2f91efd2ae7 /adapters/mso-openstack-adapters/src
parent5bc663e5831a87b897d43f0f7fb7ec8bce88e633 (diff)
Added null check to heatStack.getOutputs()
to prevent crash at get() call; removed redundant null check to simplify the code Issue-ID: SO-1841 Signed-off-by: Oleksandr Moliavko <o.moliavko@samsung.com> Change-Id: If9d8dcba3008cd7ebe60c17c08c71a07a6df9df4
Diffstat (limited to 'adapters/mso-openstack-adapters/src')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
index d9f47f5c3a..c934291246 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
@@ -330,14 +330,15 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} else {
// Populate the outputs from the existing stack.
networkId.value = heatStack.getCanonicalName();
- neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
- rollback.value = networkRollback; // Default rollback - no updates performed
- if (aic3template) {
- networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
- }
- Map<String, Object> outputs = heatStack.getOutputs();
Map<String, String> sMap = new HashMap<>();
- if (outputs != null) {
+ if (heatStack.getOutputs() != null) {
+ neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
+ rollback.value = networkRollback; // Default rollback - no updates performed
+ if (aic3template) {
+ networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
+ }
+ Map<String, Object> outputs = heatStack.getOutputs();
+
for (Map.Entry<String, Object> entry : outputs.entrySet()) {
String key = entry.getKey();
if (key != null && key.startsWith("subnet")) {
@@ -437,9 +438,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// For Heat-based orchestration, the MSO-tracked network ID is the heat stack,
// and the neutronNetworkId is the network UUID returned in stack outputs.
networkId.value = heatStack.getCanonicalName();
- neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
- if (aic3template) {
- networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
+ if (heatStack.getOutputs() != null) {
+ neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
+ if (aic3template) {
+ networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
+ }
}
Map<String, Object> outputs = heatStack.getOutputs();
Map<String, String> sMap = new HashMap<>();