summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2019-07-30 13:32:59 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-30 13:32:59 +0000
commit5df2935557f13e9ea42d9e20d0cef6bf5f06acda (patch)
treea6ebce6393962190a667cd51db1bdfd5a3e87f63
parentc7fe0ab72153acaed0a83157e4436b44bec3cc2c (diff)
parentbfc7997e306a59ce3c2640ea409fe0383d82588c (diff)
Merge "Added null check to heatStack.getOutputs() to prevent crash at get() call; removed redundant null check to simplify the code"
-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<>();