aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java14
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java24
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql5
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java41
4 files changed, 51 insertions, 33 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
index e821d806dd..2a17656f1d 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
@@ -478,12 +478,14 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
boolean timedOut = false;
int cancelTimeout = timeout; // TODO: For now, just use same timeout
- String status = cancelExecution.getStatus();
-
+ String status = null;
+ if (cancelExecution != null) {
+ status = cancelExecution.getStatus();
+ }
// Poll for completion. Create a reusable cloudify query request
GetExecution queryExecution = cloudify.executions().byId(executionId);
- while (!timedOut && !status.equals(CANCELLED)) {
+ while (!timedOut && !CANCELLED.equals(status)) {
// workflow is still running; check for timeout
if (cancelTimeout <= 0) {
logger.debug("Cancel timeout for workflow {} on deployment {}", workflowId, deploymentId);
@@ -497,11 +499,13 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
logger.debug("pollTimeout remaining: {}", cancelTimeout);
execution = queryExecution.execute();
- status = execution.getStatus();
+ if (execution != null) {
+ status = execution.getStatus();
+ }
}
// Broke the loop. Check again for a terminal state
- if (status.equals(CANCELLED)) {
+ if (CANCELLED.equals(status)) {
// Finished cancelling. Return the original exception
logger.debug("Cancel workflow {} completed on deployment {}", workflowId, deploymentId);
throw new MsoCloudifyException(-1, "", "", savedException);
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index 6565db7ebc..b5a97f7559 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -327,20 +327,24 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
Integer.parseInt(this.environment.getProperty(pollingMultiplierProp, POLLING_MULTIPLIER_DEFAULT));
int numberOfPollingAttempts = Math.floorDiv((timeoutMinutes * pollingMultiplier), pollingFrequency);
Heat heatClient = getHeatClient(cloudSiteId, tenantId);
- Stack latestStack = null;
while (true) {
- latestStack = queryHeatStack(heatClient, stack.getStackName() + "/" + stack.getId());
- statusHandler.updateStackStatus(latestStack);
- logger.debug("Polling: {} ({})", latestStack.getStackStatus(), latestStack.getStackName());
- if (stackStatus.equals(latestStack.getStackStatus())) {
- if (numberOfPollingAttempts <= 0) {
- logger.error("Polling of stack timed out with Status: {}", latestStack.getStackStatus());
+ Stack latestStack = queryHeatStack(heatClient, stack.getStackName() + "/" + stack.getId());
+ if (latestStack != null) {
+ statusHandler.updateStackStatus(latestStack);
+ logger.debug("Polling: {} ({})", latestStack.getStackStatus(), latestStack.getStackName());
+ if (stackStatus.equals(latestStack.getStackStatus())) {
+ if (numberOfPollingAttempts <= 0) {
+ logger.error("Polling of stack timed out with Status: {}", latestStack.getStackStatus());
+ return latestStack;
+ }
+ sleep(pollingFrequency * 1000L);
+ numberOfPollingAttempts -= 1;
+ } else {
return latestStack;
}
- sleep(pollingFrequency * 1000L);
- numberOfPollingAttempts -= 1;
} else {
- return latestStack;
+ logger.error("latestStack is null");
+ return null;
}
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql
index 5d940fb9ea..8e52fbeeaf 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql
@@ -30,3 +30,8 @@ resources:
INSERT INTO `temp_network_heat_template_lookup` (`NETWORK_RESOURCE_MODEL_NAME`, `HEAT_TEMPLATE_ARTIFACT_UUID`,`AIC_VERSION_MIN` , `AIC_VERSION_MAX` )
VALUES ('Generic NeutronNet','efee1d84-b8ec-11e7-abc4-cec278b6b50a','2.0','3.0');
+INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`)
+VALUES ('efee1d84-b8ec-11e7-abc4-cec278b6b50a', 'network_name', 0, 'String', NULL);
+
+INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`)
+VALUES ('efee1d84-b8ec-11e7-abc4-cec278b6b50a', 'shared', 0, 'Boolean', NULL);
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 153de2fb12..afc227faf0 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
@@ -462,13 +462,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
}
}
+ networkRollback.setNeutronNetworkId((String) outputs.get(NETWORK_ID));
}
subnetIdMap.value = sMap;
rollback.value = networkRollback;
// Populate remaining rollback info and response parameters.
networkRollback.setNetworkStackId(heatStack.getCanonicalName());
- networkRollback.setNeutronNetworkId((String) heatStack.getOutputs().get(NETWORK_ID));
networkRollback.setNetworkCreated(true);
networkRollback.setNetworkType(networkType);
@@ -915,7 +915,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Use MsoNeutronUtils for all NEUTRON commands
String mode;
- String neutronId;
+ String neutronId = null;
// Try Heat first, since networks may be named the same as the Heat stack
StackInfo heatStack = null;
long queryStackStarttime = System.currentTimeMillis();
@@ -931,12 +931,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Populate the outputs based on the returned Stack information
if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) {
// Found it. Get the neutronNetworkId for further query
+ Map<String, String> sMap = new HashMap<>();
Map<String, Object> outputs = heatStack.getOutputs();
- neutronId = (String) outputs.get(NETWORK_ID);
mode = "HEAT";
-
- Map<String, String> sMap = new HashMap<>();
if (outputs != null) {
+ neutronId = (String) outputs.get(NETWORK_ID);
+
for (String key : outputs.keySet()) {
if (key != null && key.startsWith("subnet_id_")) // multiples subnet_%aaid% outputs
{
@@ -1521,23 +1521,28 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
logger.debug("Subnet_Ipam Output JSON String:{} {}", obj.getClass(), jStr);
JsonNode rootNode = mapper.readTree(jStr);
- for (JsonNode sNode : rootNode.path("ipam_subnets")) {
- logger.debug("Output Subnet Node {}", sNode.toString());
- String name = sNode.path("subnet_name").textValue();
- String uuid = sNode.path("subnet_uuid").textValue();
- String aaiId = name; // default
- // try to find aaiId for name in input subnetList
- if (subnets != null) {
- for (Subnet subnet : subnets) {
- if (subnet != null && !commonUtils.isNullOrEmpty(subnet.getSubnetName())) {
- if (subnet.getSubnetName().equals(name)) {
- aaiId = subnet.getSubnetId();
- break;
+ if (rootNode != null) {
+ for (JsonNode sNode : rootNode.path("ipam_subnets")) {
+ logger.debug("Output Subnet Node {}", sNode.toString());
+ String name = sNode.path("subnet_name").textValue();
+ String uuid = sNode.path("subnet_uuid").textValue();
+ String aaiId = name; // default
+ // try to find aaiId for name in input subnetList
+ if (subnets != null) {
+ for (Subnet subnet : subnets) {
+ if (subnet != null && !commonUtils.isNullOrEmpty(subnet.getSubnetName())) {
+ if (subnet.getSubnetName().equals(name)) {
+ aaiId = subnet.getSubnetId();
+ break;
+ }
}
}
}
+ sMap.put(aaiId, uuid); // bpmn needs aaid to uuid map
}
- sMap.put(aaiId, uuid); // bpmn needs aaid to uuid map
+ } else {
+ logger.error("{} {} null rootNode - cannot get subnet-uuids", MessageEnum.RA_MARSHING_ERROR,
+ ErrorCode.DataError.getValue());
}
} catch (Exception e) {
logger.error("{} {} Exception getting subnet-uuids ", MessageEnum.RA_MARSHING_ERROR,