aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java84
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java221
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java98
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java6
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy28
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy247
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy143
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy32
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy22
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNSSI.bpmn1
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreSharedSlice.bpmn107
-rw-r--r--pom.xml2
14 files changed, 543 insertions, 457 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 9123ac9f36..b84d2a8600 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
@@ -31,6 +31,8 @@ import java.util.Map;
import java.util.Optional;
import javax.jws.WebService;
import javax.xml.ws.Holder;
+import org.apache.commons.lang3.mutable.MutableBoolean;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.adapters.network.beans.ContrailPolicyRef;
import org.onap.so.adapters.network.beans.ContrailPolicyRefSeq;
import org.onap.so.adapters.network.beans.ContrailSubnet;
@@ -47,7 +49,6 @@ import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationReposi
import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
import org.onap.so.db.catalog.utils.MavenLikeVersioning;
import org.onap.so.entity.MsoRequest;
-import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
@@ -150,7 +151,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
Holder<String> networkFqdn = new Holder<>();
createNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkName, physicalNetworkName,
vlans, null, shared, external, failIfExists, backout, subnets, null, null, msoRequest, networkId,
- neutronNetworkId, networkFqdn, subnetIdMap, rollback, true);
+ neutronNetworkId, networkFqdn, subnetIdMap, rollback, true, new MutableBoolean());
}
@Deprecated
@@ -164,7 +165,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
throws NetworkException {
createNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkName, null, null, routeTargets,
shared, external, failIfExists, backout, subnets, policyFqdns, routeTableFqdns, msoRequest, networkId,
- neutronNetworkId, networkFqdn, subnetIdMap, rollback, true);
+ neutronNetworkId, networkFqdn, subnetIdMap, rollback, true, new MutableBoolean());
}
/**
@@ -195,13 +196,14 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String shared, String external, Boolean failIfExists, Boolean backout, List<Subnet> subnets,
List<String> policyFqdns, List<String> routeTableFqdns, MsoRequest msoRequest, Holder<String> networkId,
Holder<String> neutronNetworkId, Holder<String> networkFqdn, Holder<Map<String, String>> subnetIdMap,
- Holder<NetworkRollback> rollback, Boolean pollForCompletion) throws NetworkException {
+ Holder<NetworkRollback> rollback, Boolean pollForCompletion, MutableBoolean isOs3Nw)
+ throws NetworkException {
logger.debug("*** CREATE Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId);
// Will capture execution time for metrics
long startTime = System.currentTimeMillis();
- // Build a default rollback object (no actions performed)
+ // Build a default rollback object (no actions performed) //TODO remove
NetworkRollback networkRollback = new NetworkRollback();
networkRollback.setCloudId(cloudSiteId);
networkRollback.setTenantId(tenantId);
@@ -241,13 +243,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
template = template.replaceAll("\r\n", "\n");
boolean os3template = false;
- String os3nw = OS3_NW;
- os3nw = environment.getProperty(OS3_NW_PROPERTY, OS3_NW);
+ String os3nw = environment.getProperty(OS3_NW_PROPERTY, OS3_NW);
if (template.contains(os3nw))
os3template = true;
+ isOs3Nw.setValue(os3template);
// First, look up to see if the Network already exists (by name).
// For HEAT orchestration of networks, the stack name will always match the network name
StackInfo heatStack = null;
@@ -280,20 +282,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
Map<String, Object> outputs = heatStack.getOutputs();
- for (Map.Entry<String, Object> entry : outputs.entrySet()) {
- String key = entry.getKey();
- if (key != null && key.startsWith("subnet")) {
- if (os3template) // one subnet_id output
- {
- Map<String, String> map = getSubnetUUId(key, outputs, subnets);
- sMap.putAll(map);
- } else // multiples subnet_%aaid% outputs
- {
- String subnetUUId = (String) outputs.get(key);
- sMap.put(key.substring("subnet_id_".length()), subnetUUId);
- }
- }
- }
+ sMap = buildSubnetMap(outputs, subnets, os3template);
}
subnetIdMap.value = sMap;
logger.warn("{} {} Found Existing network stack, status={} networkName={} for {}/{}",
@@ -390,20 +379,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
Map<String, Object> outputs = heatStack.getOutputs();
Map<String, String> sMap = new HashMap<>();
if (outputs != null) {
- for (Map.Entry<String, Object> entry : outputs.entrySet()) {
- String key = entry.getKey();
- if (key != null && key.startsWith("subnet")) {
- if (os3template) // one subnet output expected
- {
- Map<String, String> map = getSubnetUUId(key, outputs, subnets);
- sMap.putAll(map);
- } else // multiples subnet_%aaid% outputs allowed
- {
- String subnetUUId = (String) outputs.get(key);
- sMap.put(key.substring("subnet_id_".length()), subnetUUId);
- }
- }
- }
+ sMap = buildSubnetMap(outputs, subnets, os3template);
networkRollback.setNeutronNetworkId((String) outputs.get(NETWORK_ID));
}
subnetIdMap.value = sMap;
@@ -686,20 +662,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
Map<String, Object> outputs = heatStack.getOutputs();
Map<String, String> sMap = new HashMap<>();
if (outputs != null) {
- for (Map.Entry<String, Object> entry : outputs.entrySet()) {
- String key = entry.getKey();
- if (key != null && key.startsWith("subnet")) {
- if (os3template) // one subnet output expected
- {
- Map<String, String> map = getSubnetUUId(key, outputs, subnets);
- sMap.putAll(map);
- } else // multiples subnet_%aaid% outputs allowed
- {
- String subnetUUId = (String) outputs.get(key);
- sMap.put(key.substring("subnet_id_".length()), subnetUUId);
- }
- }
- }
+ sMap = buildSubnetMap(outputs, subnets, os3template);
}
subnetIdMap.value = sMap;
@@ -1361,7 +1324,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
return heatTemplate;
}
- private Map<String, String> getSubnetUUId(String key, Map<String, Object> outputs, List<Subnet> subnets) {
+ // TODO remove
+ public Map<String, String> getSubnetUUId(String key, Map<String, Object> outputs, List<Subnet> subnets) {
Map<String, String> sMap = new HashMap<>();
@@ -1418,4 +1382,24 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
return updatedTemplate;
}
+ public Map<String, String> buildSubnetMap(Map<String, Object> outputs, List<Subnet> subnets, boolean os3template) {
+
+ Map<String, String> sMap = new HashMap<>();
+ for (Map.Entry<String, Object> entry : outputs.entrySet()) {
+ String key = entry.getKey();
+ if (key != null && key.startsWith("subnet")) {
+ if (os3template) // one subnet_id output
+ {
+ Map<String, String> map = getSubnetUUId(key, outputs, subnets);
+ sMap.putAll(map);
+ } else // multiples subnet_%aaid% outputs
+ {
+ String subnetUUId = (String) outputs.get(key);
+ sMap.put(key.substring("subnet_id_".length()), subnetUUId);
+ }
+ }
+ }
+ return sMap;
+ }
+
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java
index 4e0c4ad8a6..bd71474aab 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java
@@ -28,8 +28,6 @@ import org.onap.so.adapters.tasks.orchestration.PollService;
import org.onap.so.adapters.tasks.orchestration.RollbackService;
import org.onap.so.adapters.tasks.orchestration.StackService;
import org.onap.so.utils.ExternalTaskServiceUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
@@ -38,8 +36,6 @@ import org.springframework.stereotype.Component;
@Profile("!test")
public class TaskServices {
- private static final Logger logger = LoggerFactory.getLogger(TaskServices.class);
-
@Autowired
private ExternalTaskServiceUtils externalTaskServiceUtils;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
index ddbda5da62..14df4e6941 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
@@ -33,16 +33,31 @@ import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.commons.lang3.mutable.MutableBoolean;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.so.adapters.network.MsoNetworkAdapterImpl;
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
+import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
+import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
+import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
+import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
+import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
+import org.onap.so.adapters.vnf.VnfAdapterUtils;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse;
import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
-import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
-import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
-import org.onap.so.adapters.vnf.VnfAdapterUtils;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.VfModuleRollback;
+import org.onap.so.adapters.vnfrest.VolumeGroupRollback;
import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.beans.NetworkRollback;
+import org.onap.so.openstack.beans.StackInfo;
+import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.mappers.StackInfoMapper;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.utils.ExternalTaskUtils;
import org.onap.so.utils.RetrySequenceLevel;
@@ -58,6 +73,12 @@ public class PollService extends ExternalTaskUtils {
private static final Logger logger = LoggerFactory.getLogger(PollService.class);
@Autowired
+ private MsoVnfAdapterImpl vnfAdapterImpl;
+
+ @Autowired
+ private MsoNetworkAdapterImpl networkAdapterImpl;
+
+ @Autowired
private MsoHeatUtils msoHeatUtils;
@Autowired
@@ -76,45 +97,66 @@ public class PollService extends ExternalTaskUtils {
Map<String, Object> variables = new HashMap<>();
MutableBoolean success = new MutableBoolean();
String errorMessage = null;
+ Optional<String> response = Optional.empty();
+ boolean isMulticloud = false;
try {
String xmlRequest = externalTask.getVariable("openstackAdapterTaskRequest");
if (xmlRequest != null) {
Optional<String> requestType = findRequestType(xmlRequest);
if ("createVolumeGroupRequest".equals(requestType.get())) {
- determineCreateVolumeGroupStatus(xmlRequest, externalTask, success);
+ CreateVolumeGroupRequest req =
+ JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
+ isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
+ response = determineCreateVolumeGroupStatus(req, externalTask, success, isMulticloud);
} else if ("createVfModuleRequest".equals(requestType.get())) {
- determineCreateVfModuleStatus(xmlRequest, externalTask, success);
+ CreateVfModuleRequest req =
+ JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class);
+ isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
+ response = determineCreateVfModuleStatus(req, externalTask, success, isMulticloud);
} else if ("deleteVfModuleRequest".equals(requestType.get())) {
logger.debug("Executing External Task Poll Service for Delete Vf Module");
+ String stackId = externalTask.getVariable("stackId");
DeleteVfModuleRequest req =
JAXB.unmarshal(new StringReader(xmlRequest), DeleteVfModuleRequest.class);
- boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
+ isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
if (!isMulticloud) {
int timeoutMinutes = msoHeatUtils.getVfHeatTimeoutValue(req.getModelCustomizationUuid(), false);
- pollDeleteResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), externalTask,
- success);
- } else {
- success.setTrue();
+ StackInfo stack = pollDeleteResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(),
+ stackId, success);
+ DeleteVfModuleResponse deleteResponse =
+ new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE,
+ req.getMessageId(), vnfAdapterImpl.copyStringOutputs(stack.getOutputs()));
+ response = Optional.of(deleteResponse.toXmlString());
}
} else if ("deleteVolumeGroupRequest".equals(requestType.get())) {
logger.debug("Executing External Task Poll Service for Delete Volume Group");
+ String stackId = externalTask.getVariable("stackId");
DeleteVolumeGroupRequest req =
JAXB.unmarshal(new StringReader(xmlRequest), DeleteVolumeGroupRequest.class);
- boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
+ isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
if (!isMulticloud) {
- pollDeleteResource(118, req.getCloudSiteId(), req.getTenantId(), externalTask, success);
- } else {
- success.setTrue();
+ pollDeleteResource(118, req.getCloudSiteId(), req.getTenantId(), stackId, success);
+ DeleteVolumeGroupResponse deleteResponse =
+ new DeleteVolumeGroupResponse(true, req.getMessageId());
+ response = Optional.of(deleteResponse.toXmlString());
}
} else if ("createNetworkRequest".equals(requestType.get())) {
- determineCreateNetworkStatus(xmlRequest, externalTask, success);
+ CreateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateNetworkRequest.class);
+ response = determineCreateNetworkStatus(req, externalTask, success);
} else if ("deleteNetworkRequest".equals(requestType.get())) {
logger.debug("Executing External Task Poll Service for Delete Network");
+ String stackId = externalTask.getVariable("stackId");
DeleteNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteNetworkRequest.class);
- pollDeleteResource(118, req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ pollDeleteResource(118, req.getCloudSiteId(), req.getTenantId(), stackId, success);
+ DeleteNetworkResponse deleteResponse =
+ new DeleteNetworkResponse(req.getNetworkId(), true, req.getMessageId());
+ response = Optional.of(deleteResponse.toXmlString());
} else if ("updateNetworkRequest".equals(requestType.get())) {
UpdateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), UpdateNetworkRequest.class);
pollUpdateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ UpdateNetworkResponse updateResponse =
+ new UpdateNetworkResponse(req.getNetworkId(), null, null, req.getMessageId());
+ response = Optional.of(updateResponse.toXmlString());
}
}
} catch (Exception e) {
@@ -123,6 +165,12 @@ public class PollService extends ExternalTaskUtils {
variables.put("openstackAdapterErrorMessage", errorMessage);
}
+ if (isMulticloud) {
+ success.setTrue();
+ }
+ if (response.isPresent()) {
+ variables.put("WorkflowResponse", response.get());
+ }
variables.put("OpenstackPollSuccess", success.booleanValue());
if (success.isTrue()) {
externalTaskService.complete(externalTask, variables);
@@ -146,76 +194,110 @@ public class PollService extends ExternalTaskUtils {
}
}
- private void determineCreateVolumeGroupStatus(String xmlRequest, ExternalTask externalTask, MutableBoolean success)
- throws MsoException {
- CreateVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
- boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
- if (!isMulticloud) {
- boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
- if (pollRollbackStatus) {
- logger.debug("Executing External Task Poll Service for Rollback Create Volume Group");
- pollDeleteResource(118, req.getCloudSiteId(), req.getTenantId(), externalTask, success);
- } else {
- int timeoutMinutes = msoHeatUtils.getVfHeatTimeoutValue(req.getModelCustomizationUuid(), true);
- pollCreateResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ private Optional<String> determineCreateVolumeGroupStatus(CreateVolumeGroupRequest req, ExternalTask externalTask,
+ MutableBoolean success, boolean isMulticloud) throws MsoException {
+ boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
+ String stackId = externalTask.getVariable("stackId");
+ if (pollRollbackStatus) {
+ logger.debug("Executing External Task Poll Service for Rollback Volume Group");
+ if (!isMulticloud) {
+ pollDeleteResource(118, req.getCloudSiteId(), req.getTenantId(), stackId, success);
}
+ return Optional.empty();
} else {
- success.setTrue();
+ logger.debug("Executing External Task Poll Service for Create Volume Group");
+ Map<String, String> outputs = new HashMap<String, String>();
+ if (!isMulticloud) {
+ int timeoutMinutes = msoHeatUtils.getVfHeatTimeoutValue(req.getModelCustomizationUuid(), true);
+ StackInfo stack =
+ pollCreateResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), stackId, success);
+ outputs = vnfAdapterImpl.copyStringOutputs(stack.getOutputs());
+ }
+ VolumeGroupRollback rb = new VolumeGroupRollback(req.getVolumeGroupId(), stackId, true, req.getTenantId(),
+ req.getCloudOwner(), req.getCloudSiteId(), req.getMsoRequest(), req.getMessageId());
+ CreateVolumeGroupResponse createResponse = new CreateVolumeGroupResponse(req.getVolumeGroupId(), stackId,
+ true, outputs, rb, req.getMessageId());
+ return Optional.of(createResponse.toXmlString());
}
}
- private void determineCreateVfModuleStatus(String xmlRequest, ExternalTask externalTask, MutableBoolean success)
- throws MsoException {
- CreateVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class);
- boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
- if (!isMulticloud) {
- boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
- int timeoutMinutes = msoHeatUtils.getVfHeatTimeoutValue(req.getModelCustomizationUuid(), false);
- if (pollRollbackStatus) {
- logger.debug("Executing External Task Poll Service for Rollback Create Vf Module");
- pollDeleteResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), externalTask, success);
- } else {
- logger.debug("Executing External Task Poll Service for Create Vf Module");
- pollCreateResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ private Optional<String> determineCreateVfModuleStatus(CreateVfModuleRequest req, ExternalTask externalTask,
+ MutableBoolean success, boolean isMulticloud) throws MsoException {
+ String stackId = externalTask.getVariable("stackId");
+ boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
+ int timeoutMinutes = msoHeatUtils.getVfHeatTimeoutValue(req.getModelCustomizationUuid(), false);
+ if (pollRollbackStatus) {
+ logger.debug("Executing External Task Poll Service for Rollback Vf Module");
+ if (!isMulticloud) {
+ pollDeleteResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), stackId, success);
}
+ return Optional.empty();
} else {
- success.setTrue();
+ logger.debug("Executing External Task Poll Service for Create Vf Module");
+ Map<String, String> outputs = new HashMap<String, String>();
+ if (!isMulticloud) {
+ StackInfo stack =
+ pollCreateResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), stackId, success);
+ outputs = vnfAdapterImpl.copyStringOutputs(stack.getOutputs());
+ }
+ VfModuleRollback modRollback = new VfModuleRollback(buildVnfRollback(req, stackId, isMulticloud),
+ req.getVfModuleId(), stackId, req.getMessageId());
+ CreateVfModuleResponse createResponse = new CreateVfModuleResponse(req.getVnfId(), req.getVfModuleId(),
+ stackId, Boolean.TRUE, outputs, modRollback, req.getMessageId());
+ return Optional.of(createResponse.toXmlString());
}
}
- private void determineCreateNetworkStatus(String xmlRequest, ExternalTask externalTask, MutableBoolean success)
- throws MsoException {
- CreateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateNetworkRequest.class);
+ private Optional<String> determineCreateNetworkStatus(CreateNetworkRequest req, ExternalTask externalTask,
+ MutableBoolean success) throws MsoException {
+ String stackId = externalTask.getVariable("stackId");
boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
int timeoutMinutes =
msoHeatUtils.getNetworkHeatTimeoutValue(req.getModelCustomizationUuid(), req.getNetworkType());
if (pollRollbackStatus) {
- logger.debug("Executing External Task Poll Service for Rollback Create Network");
- pollDeleteResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ logger.debug("Executing External Task Poll Service for Rollback Network");
+ pollDeleteResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), stackId, success);
+ return Optional.empty();
} else {
logger.debug("Executing External Task Poll Service for Create Network");
- pollCreateResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ boolean os3Nw = externalTask.getVariable("os3Nw");
+ StackInfo stack =
+ pollCreateResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), stackId, success);
+ String networkFqdn = "";
+ String neutronNetworkId = "";
+ Map<String, String> subnetMap = new HashMap<>();
+ if (stack.getOutputs() != null) {
+ networkFqdn = (String) stack.getOutputs().get("network_fqdn");
+ neutronNetworkId = (String) stack.getOutputs().get("network_id");
+ subnetMap = networkAdapterImpl.buildSubnetMap(stack.getOutputs(), req.getSubnets(), os3Nw);
+ }
+ CreateNetworkResponse response = new CreateNetworkResponse(req.getNetworkId(), neutronNetworkId, stackId,
+ networkFqdn, true, subnetMap, buildNetworkRollback(req, stackId), req.getMessageId());
+ return Optional.of(response.toXmlString());
+
}
}
- private void pollCreateResource(int pollingTimeout, String cloudSiteId, String tenantId, ExternalTask externalTask,
+ private StackInfo pollCreateResource(int pollingTimeout, String cloudSiteId, String tenantId, String stackId,
MutableBoolean success) throws MsoException {
- Stack currentStack = createCurrentStack(externalTask.getVariable("stackId"));
+ Stack currentStack = createCurrentStack(stackId);
Stack stack = msoHeatUtils.pollStackForStatus(pollingTimeout, currentStack, "CREATE_IN_PROGRESS", cloudSiteId,
tenantId, false);
msoHeatUtils.postProcessStackCreate(stack, false, 0, false, cloudSiteId, tenantId, null);
success.setTrue();
+ return new StackInfoMapper(stack).map();
}
- private void pollDeleteResource(int pollingTimeout, String cloudSiteId, String tenantId, ExternalTask externalTask,
+ private StackInfo pollDeleteResource(int pollingTimeout, String cloudSiteId, String tenantId, String stackId,
MutableBoolean success) throws MsoException {
- Stack currentStack = createCurrentStack(externalTask.getVariable("stackId"));
+ Stack currentStack = createCurrentStack(stackId);
Stack stack = msoHeatUtils.pollStackForStatus(pollingTimeout, currentStack, "DELETE_IN_PROGRESS", cloudSiteId,
tenantId, true);
if (stack != null) { // if stack is null it was not found and no need to do post process
msoHeatUtils.postProcessStackDelete(stack);
}
success.setTrue();
+ return new StackInfoMapper(stack).map();
}
private void pollUpdateResource(String cloudSiteId, String tenantId, ExternalTask externalTask,
@@ -251,4 +333,37 @@ public class PollService extends ExternalTaskUtils {
currentStack.setStackName(stackName);
return currentStack;
}
+
+ private VnfRollback buildVnfRollback(CreateVfModuleRequest req, String stackId, boolean isMulticloud) {
+ VnfRollback vfRollback = new VnfRollback();
+ vfRollback.setCloudSiteId(req.getCloudSiteId());
+ vfRollback.setCloudOwner(req.getCloudOwner());
+ vfRollback.setTenantId(req.getTenantId());
+ vfRollback.setMsoRequest(req.getMsoRequest());
+ vfRollback.setRequestType(req.getRequestType());
+ vfRollback.setVolumeGroupHeatStackId(req.getVolumeGroupStackId());
+ vfRollback.setBaseGroupHeatStackId(req.getBaseVfModuleStackId());
+ vfRollback.setIsBase(false);
+ vfRollback.setModelCustomizationUuid(req.getModelCustomizationUuid());
+ vfRollback.setVnfId(stackId);
+ vfRollback.setVnfCreated(true);
+ if (isMulticloud) {
+ vfRollback.setMode("CFY");
+ }
+
+ return vfRollback;
+ }
+
+ private NetworkRollback buildNetworkRollback(CreateNetworkRequest req, String stackId) {
+ NetworkRollback networkRollback = new NetworkRollback();
+ networkRollback.setCloudId(req.getCloudSiteId());
+ networkRollback.setTenantId(req.getTenantId());
+ networkRollback.setMsoRequest(req.getMsoRequest());
+ networkRollback.setModelCustomizationUuid(req.getModelCustomizationUuid());
+ networkRollback.setNetworkStackId(stackId);
+ networkRollback.setNetworkCreated(true);
+ networkRollback.setNetworkType(req.getNetworkType());
+
+ return networkRollback;
+ }
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java
index 7be1620b0e..6b76c3af9a 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java
@@ -39,12 +39,9 @@ import org.onap.so.adapters.network.MsoNetworkAdapterImpl;
import org.onap.so.adapters.network.exceptions.NetworkException;
import org.onap.so.adapters.nwrest.ContrailNetwork;
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
-import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
-import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
import org.onap.so.adapters.nwrest.ProviderVlanNetwork;
import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
-import org.onap.so.adapters.nwrest.RollbackNetworkResponse;
import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
@@ -52,15 +49,9 @@ import org.onap.so.adapters.vnf.MsoVnfPluginAdapterImpl;
import org.onap.so.adapters.vnf.VnfAdapterUtils;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
-import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
-import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse;
import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.VfModuleRollback;
-import org.onap.so.adapters.vnfrest.VolumeGroupRollback;
import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.openstack.beans.NetworkRollback;
import org.onap.so.openstack.beans.RouteTarget;
@@ -94,7 +85,6 @@ public class StackService extends ExternalTaskUtils {
private static final String SHARED = "shared";
private static final String EXTERNAL = "external";
- // TODO set backout earlier in case of exception??
public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
Map<String, Object> variables = new HashMap<>();
mdcSetup.setupMDC(externalTask);
@@ -102,7 +92,7 @@ public class StackService extends ExternalTaskUtils {
logger.debug("Starting External Task Stack Service. {}", xmlRequest);
MutableBoolean success = new MutableBoolean();
MutableBoolean backout = new MutableBoolean();
- String response = "";
+ MutableBoolean os3Nw = new MutableBoolean();
Holder<String> canonicalStackId = new Holder<>();
String errorMessage = "";
try {
@@ -117,26 +107,26 @@ public class StackService extends ExternalTaskUtils {
Holder<NetworkRollback> networkRollback = new Holder<>();
if ("createVolumeGroupRequest".equals(requestType.get())) {
logger.debug("Executing External Task Stack Service For Create Volume Group");
- response = createVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ createVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
} else if ("createVfModuleRequest".equals(requestType.get())) {
logger.debug("Executing External Task Stack Service For Create Vf Module");
- response = createVfModule(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ createVfModule(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
} else if ("deleteVfModuleRequest".equals(requestType.get())) {
logger.debug("Executing External Task Stack Service For Delete Vf Module");
- response = deleteVfModule(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ deleteVfModule(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
} else if ("deleteVolumeGroupRequest".equals(requestType.get())) {
logger.debug("Executing External Task Stack Service For Delete Volume Group");
- response = deleteVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ deleteVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
} else if ("createNetworkRequest".equals(requestType.get())) {
- response = createNetwork(xmlRequest, networkId, neutronNetworkId, networkFqdn, subnetIdMap,
- networkRollback, canonicalStackId, backout, success);
+ createNetwork(xmlRequest, networkId, neutronNetworkId, networkFqdn, subnetIdMap, networkRollback,
+ canonicalStackId, backout, success, os3Nw);
} else if ("deleteNetworkRequest".equals(requestType.get())) {
- response = deleteNetwork(xmlRequest, canonicalStackId, backout, success);
+ deleteNetwork(xmlRequest, canonicalStackId, backout, success);
} else if ("updateNetworkRequest".equals(requestType.get())) {
- response =
- updateNetwork(xmlRequest, subnetIdMap, networkRollback, canonicalStackId, backout, success);
+
+ updateNetwork(xmlRequest, subnetIdMap, networkRollback, canonicalStackId, backout, success);
} else if ("rollbackNetworkRequest".equals(requestType.get())) {
- response = rollbackNetwork(xmlRequest, canonicalStackId, backout, success);
+ rollbackNetwork(xmlRequest, canonicalStackId, backout, success);
}
}
} catch (Exception e) {
@@ -144,7 +134,6 @@ public class StackService extends ExternalTaskUtils {
errorMessage = e.getMessage();
}
variables.put("backout", backout.booleanValue());
- variables.put("WorkflowResponse", response);
variables.put("OpenstackInvokeSuccess", success.booleanValue());
variables.put("stackId", canonicalStackId.value);
variables.put("openstackAdapterErrorMessage", errorMessage);
@@ -152,6 +141,7 @@ public class StackService extends ExternalTaskUtils {
variables.put("rollbackPerformed", false);
variables.put("OpenstackRollbackSuccess", false);
variables.put("OpenstackPollSuccess", false);
+ variables.put("os3Nw", os3Nw.booleanValue());
if (success.isTrue()) {
externalTaskService.complete(externalTask, variables);
@@ -162,10 +152,9 @@ public class StackService extends ExternalTaskUtils {
}
}
- private String createVolumeGroup(String xmlRequest, Holder<Map<String, String>> outputs,
+ private void createVolumeGroup(String xmlRequest, Holder<Map<String, String>> outputs,
Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
MutableBoolean success) throws VnfException {
- Holder<String> stackId = new Holder<>();
CreateVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
@@ -173,28 +162,19 @@ public class StackService extends ExternalTaskUtils {
vnfPluginImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
completeVnfVfModuleType, req.getVnfVersion(), "", req.getVolumeGroupName(), "", "VOLUME", null,
null, req.getModelCustomizationUuid(), req.getVolumeGroupParams(), false, true,
- req.getEnableBridge(), req.getMsoRequest(), stackId, outputs, vnfRollback);
+ req.getEnableBridge(), req.getMsoRequest(), canonicalStackId, outputs, vnfRollback);
} else {
vnfAdapterImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
completeVnfVfModuleType, req.getVnfVersion(), "", req.getVolumeGroupName(), "", "VOLUME", null,
null, req.getModelCustomizationUuid(), req.getVolumeGroupParams(), false, true,
- req.getEnableBridge(), req.getMsoRequest(), stackId, outputs, vnfRollback);
+ req.getEnableBridge(), req.getMsoRequest(), canonicalStackId, outputs, vnfRollback);
}
success.setTrue();
backout.setValue(!req.getSuppressBackout());
- VolumeGroupRollback rb = new VolumeGroupRollback(req.getVolumeGroupId(), stackId.value,
- vnfRollback.value.getVnfCreated(), req.getTenantId(), req.getCloudOwner(), req.getCloudSiteId(),
- req.getMsoRequest(), req.getMessageId());
- canonicalStackId.value = stackId.value;
- CreateVolumeGroupResponse createResponse = new CreateVolumeGroupResponse(req.getVolumeGroupId(), stackId.value,
- vnfRollback.value.getVnfCreated(), outputs.value, rb, req.getMessageId());
- return createResponse.toXmlString();
}
- private String createVfModule(String xmlRequest, Holder<Map<String, String>> outputs,
- Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
- MutableBoolean success) throws VnfException {
- Holder<String> stackId = new Holder<>();
+ private void createVfModule(String xmlRequest, Holder<Map<String, String>> outputs, Holder<VnfRollback> vnfRollback,
+ Holder<String> canonicalStackId, MutableBoolean backout, MutableBoolean success) throws VnfException {
CreateVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class);
String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
@@ -203,27 +183,20 @@ public class StackService extends ExternalTaskUtils {
completeVnfVfModuleType, req.getVnfVersion(), req.getVnfId(), req.getVfModuleName(),
req.getVfModuleId(), req.getRequestType(), req.getVolumeGroupStackId(),
req.getBaseVfModuleStackId(), req.getModelCustomizationUuid(), req.getVfModuleParams(), false,
- false, req.getEnableBridge(), req.getMsoRequest(), stackId, outputs, vnfRollback);
+ false, req.getEnableBridge(), req.getMsoRequest(), canonicalStackId, outputs, vnfRollback);
} else {
vnfAdapterImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
completeVnfVfModuleType, req.getVnfVersion(), req.getVnfId(), req.getVfModuleName(),
req.getVfModuleId(), req.getRequestType(), req.getVolumeGroupStackId(),
req.getBaseVfModuleStackId(), req.getModelCustomizationUuid(), req.getVfModuleParams(), false,
- false, req.getEnableBridge(), req.getMsoRequest(), stackId, outputs, vnfRollback);
+ false, req.getEnableBridge(), req.getMsoRequest(), canonicalStackId, outputs, vnfRollback);
}
success.setTrue();
backout.setValue(req.getBackout());
- canonicalStackId.value = stackId.value;
- VfModuleRollback modRollback =
- new VfModuleRollback(vnfRollback.value, req.getVfModuleId(), stackId.value, req.getMessageId());
- CreateVfModuleResponse createResponse = new CreateVfModuleResponse(req.getVnfId(), req.getVfModuleId(),
- stackId.value, Boolean.TRUE, outputs.value, modRollback, req.getMessageId());
- return createResponse.toXmlString();
}
- private String deleteVfModule(String xmlRequest, Holder<Map<String, String>> outputs,
- Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
- MutableBoolean success) throws VnfException {
+ private void deleteVfModule(String xmlRequest, Holder<Map<String, String>> outputs, Holder<VnfRollback> vnfRollback,
+ Holder<String> canonicalStackId, MutableBoolean backout, MutableBoolean success) throws VnfException {
backout.setFalse();
DeleteVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteVfModuleRequest.class);
boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
@@ -241,12 +214,9 @@ public class StackService extends ExternalTaskUtils {
} else {
canonicalStackId.value = req.getVfModuleStackId();
}
- DeleteVfModuleResponse deleteResponse = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(),
- Boolean.TRUE, req.getMessageId(), outputs.value);
- return deleteResponse.toXmlString();
}
- private String deleteVolumeGroup(String xmlRequest, Holder<Map<String, String>> outputs,
+ private void deleteVolumeGroup(String xmlRequest, Holder<Map<String, String>> outputs,
Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
MutableBoolean success) throws VnfException {
backout.setFalse();
@@ -255,14 +225,12 @@ public class StackService extends ExternalTaskUtils {
req.getVolumeGroupStackId(), req.getMsoRequest(), false);
success.setTrue();
canonicalStackId.value = req.getVolumeGroupStackId();
- DeleteVolumeGroupResponse deleteResponse = new DeleteVolumeGroupResponse(true, req.getMessageId());
- return deleteResponse.toXmlString();
}
- private String createNetwork(String xmlRequest, Holder<String> networkId, Holder<String> neutronNetworkId,
+ private void createNetwork(String xmlRequest, Holder<String> networkId, Holder<String> neutronNetworkId,
Holder<String> networkFqdn, Holder<Map<String, String>> subnetIdMap,
Holder<NetworkRollback> networkRollback, Holder<String> canonicalStackId, MutableBoolean backout,
- MutableBoolean success) throws NetworkException {
+ MutableBoolean success, MutableBoolean os3) throws NetworkException {
CreateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateNetworkRequest.class);
HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams();
if (params == null) {
@@ -306,18 +274,13 @@ public class StackService extends ExternalTaskUtils {
networkAdapterImpl.createNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
req.getModelCustomizationUuid(), req.getNetworkName(), physicalNetworkName, vlans, routeTargets, shared,
external, req.getFailIfExists(), false, req.getSubnets(), fqdns, routeTable, req.getMsoRequest(),
- networkId, neutronNetworkId, networkFqdn, subnetIdMap, networkRollback, true);
+ networkId, neutronNetworkId, networkFqdn, subnetIdMap, networkRollback, true, os3);
success.setTrue();
backout.setValue(req.getBackout());
canonicalStackId.value = networkRollback.value.getNetworkStackId();
-
- CreateNetworkResponse response = new CreateNetworkResponse(req.getNetworkId(), neutronNetworkId.value,
- networkRollback.value.getNetworkStackId(), networkFqdn.value, networkRollback.value.getNetworkCreated(),
- subnetIdMap.value, networkRollback.value, req.getMessageId());
- return response.toXmlString();
}
- private String deleteNetwork(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout,
+ private void deleteNetwork(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout,
MutableBoolean success) throws NetworkException {
backout.setFalse();
DeleteNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteNetworkRequest.class);
@@ -328,13 +291,9 @@ public class StackService extends ExternalTaskUtils {
canonicalStackId.value = req.getNetworkStackId();
success.setTrue();
-
- DeleteNetworkResponse response =
- new DeleteNetworkResponse(req.getNetworkId(), networkDeleted.value, req.getMessageId());
- return response.toXmlString();
}
- private String rollbackNetwork(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout,
+ private void rollbackNetwork(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout,
MutableBoolean success) throws NetworkException {
backout.setFalse();
RollbackNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), RollbackNetworkRequest.class);
@@ -344,9 +303,6 @@ public class StackService extends ExternalTaskUtils {
canonicalStackId.value = rollback.getNetworkStackId();
success.setTrue();
-
- RollbackNetworkResponse response = new RollbackNetworkResponse(true, req.getMessageId());
- return response.toXmlString();
}
private String updateNetwork(String xmlRequest, Holder<Map<String, String>> subnetIdMap,
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
index 7acf953282..4ee6cf259e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
@@ -318,7 +318,7 @@ public class MsoVnfAdapterImpl {
return;
}
- private Map<String, String> copyStringOutputs(Map<String, Object> stackOutputs) {
+ public Map<String, String> copyStringOutputs(Map<String, Object> stackOutputs) {
Map<String, String> stringOutputs = new HashMap<>();
for (Map.Entry<String, Object> entry : stackOutputs.entrySet()) {
String key = entry.getKey();
@@ -408,6 +408,7 @@ public class MsoVnfAdapterImpl {
return stringMap;
}
+ // TODO remove rollback and outputs and polling
public void createVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfType,
String vnfVersion, String genericVnfName, String vnfName, String vfModuleId, String requestType,
String volumeGroupHeatStackId, String baseVfHeatStackId, String modelCustomizationUuid,
@@ -464,6 +465,7 @@ public class MsoVnfAdapterImpl {
logger.debug("requestTypeString = " + requestTypeString + ", nestedStackId = " + nestedStackId
+ ", nestedBaseStackId = " + nestedBaseStackId);
+ // TODO remove
// Build a default rollback object (no actions performed)
VnfRollback vfRollback = new VnfRollback();
vfRollback.setCloudSiteId(cloudSiteId);
@@ -963,7 +965,7 @@ public class MsoVnfAdapterImpl {
vnfId.value = heatStack.getCanonicalName();
outputs.value = copyStringOutputs(heatStack.getOutputs());
- rollback.value = vfRollback;
+ rollback.value = vfRollback; // TODO remove
logger.debug("VF Module {} successfully created", vfModuleName);
} catch (Exception e) {
logger.debug("unhandled exception in create VF", e);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
index afe7e17855..7a00cfe145 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
@@ -89,14 +89,15 @@ public class StackServiceTest {
Map<String, Object> variables = new HashMap<>();
variables.put("backout", true);
- variables.put("WorkflowResponse", "");
variables.put("OpenstackInvokeSuccess", true);
variables.put("stackId", null);
- variables.put("openstackAdapterErrorMessage", null);
+ variables.put("openstackAdapterErrorMessage", "");
variables.put("PollRollbackStatus", false);
variables.put("rollbackPerformed", false);
variables.put("OpenstackRollbackSuccess", false);
variables.put("OpenstackPollSuccess", false);
+ variables.put("os3Nw", false);
+
Mockito.verify(vnfAdapterImpl, Mockito.times(1)).createVfModule(Mockito.eq("regionOne"),
Mockito.eq("CloudOwner"), Mockito.eq("0422ffb57ba042c0800a29dc85ca70f8"),
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy
index 64c36e7026..ec97972e5d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy
@@ -68,10 +68,7 @@ class DoAllocateCoreNSSI extends AbstractServiceTaskProcessor {
execution.setVariable("coreServiceInstanceId", coreServiceInstanceId)
logger.debug(Prefix+" **** Exit DoAllocateCoreNSSI ::: preProcessRequest ****")
}
- /**
- * Query NSST name from CatalogDB
- * @param execution
- */
+
void getNSSTName(DelegateExecution execution){
logger.debug(Prefix+" **** Enter DoAllocateCoreNSSI ::: getNSSTName ****")
String nsstModelInvariantUuid = execution.getVariable("modelInvariantUuid")
@@ -79,8 +76,8 @@ class DoAllocateCoreNSSI extends AbstractServiceTaskProcessor {
String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution, nsstModelInvariantUuid)
logger.debug("***** JSON Response is: "+json)
String nsstName = jsonUtil.getJsonValue(json, "serviceResources.modelInfo.modelName") ?: ""
- String networkServiceModelInfo = jsonUtil.getJsonValue(json, "serviceResources.serviceProxy.modelInfo") ?: ""
-
+ List serviceProxyList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(json, "serviceResources.serviceProxy"))
+ String networkServiceModelInfo = serviceProxyList.get(0)
execution.setVariable("networkServiceModelInfo", networkServiceModelInfo)
logger.debug("***** nsstName is: "+ nsstName)
execution.setVariable("nsstName",nsstName)
@@ -93,6 +90,7 @@ class DoAllocateCoreNSSI extends AbstractServiceTaskProcessor {
}
logger.debug(Prefix+" **** Exit DoAllocateCoreNSSI ::: getNSSTName ****")
}
+
void prepareOOFRequest(DelegateExecution execution){
logger.debug(Prefix+" **** Enter DoAllocateCoreNSSI ::: prepareOOFRequest ****")
//API Path
@@ -105,8 +103,6 @@ class DoAllocateCoreNSSI extends AbstractServiceTaskProcessor {
//Setting messageType for all Core slice as cn
String messageType = "cn"
execution.setVariable("NSSI_messageType", messageType)
- //Is there any specific timeout we have to set or else we don't need to send
- //if blank will be set default value in DoHandleOofRequest
String timeout = "PT30M"
execution.setVariable("NSSI_timeout", timeout)
Map<String, Object> profileInfo = mapper.readValue(execution.getVariable("sliceProfile"), Map.class)
@@ -128,6 +124,10 @@ class DoAllocateCoreNSSI extends AbstractServiceTaskProcessor {
String solutions =""
if(requestStatus.equals("completed")) {
solutions = jsonUtil.getJsonValue(OOFResponse, "solutions")
+ List solutionsList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(OOFResponse, "solutions"))
+ if(solutionsList!=null && !solutionsList.isEmpty() ) {
+ solutions = solutionsList.get(0)
+ }
} else {
String statusMessage = jsonUtil.getJsonValue(OOFResponse, "statusMessage")
logger.error("received failed status from oof "+ statusMessage)
@@ -139,16 +139,20 @@ class DoAllocateCoreNSSI extends AbstractServiceTaskProcessor {
void prepareFailedOperationStatusUpdate(DelegateExecution execution){
logger.debug(Prefix + " **** Enter DoAllocateCoreNSSI ::: prepareFailedOperationStatusUpdate ****")
- String serviceId = execution.getVariable("nssiId")
+ String serviceId = execution.getVariable("nsiId")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
- String operationType = execution.getVariable("operationType")
+ String nssiId = execution.getVariable("nssiId")
+ String operationType = "ALLOCATE"
+ logger.debug("serviceId: "+serviceId+" jobId: "+jobId+" nsiId: "+nsiId+" operationType: "+operationType)
+ String modelUuid= execution.getVariable("modelUuid")
ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
resourceOperationStatus.setServiceId(serviceId)
+ resourceOperationStatus.setJobId(jobId)
resourceOperationStatus.setOperationId(jobId)
- resourceOperationStatus.setResourceTemplateUUID(nsiId)
+ resourceOperationStatus.setResourceTemplateUUID(modelUuid)
resourceOperationStatus.setOperType(operationType)
- resourceOperationStatus.setProgress(0)
+ resourceOperationStatus.setProgress("0")
resourceOperationStatus.setStatus("failed")
resourceOperationStatus.setStatusDescription("Core NSSI Allocate Failed")
requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy
index c5a928aaf9..1ca0605ac8 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy
@@ -64,6 +64,8 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.http.HttpEntity
+import org.onap.aai.domain.yang.NetworkPolicy
+import org.onap.aaiclient.client.aai.AAINamespaceConstants
import javax.ws.rs.NotFoundException
@@ -79,24 +81,26 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
public void preProcessRequest(DelegateExecution execution) {
logger.debug(Prefix+ "**** Enter DoAllocateCoreNonSharedSlice::: preProcessRequest ****")
String nssiServiceInstanceId= execution.getVariable("serviceInstanceId")
+ logger.debug("nssiServiceInstanceId: "+nssiServiceInstanceId)
execution.setVariable("nssiServiceInstanceId", nssiServiceInstanceId)
//Set orchestration-status as created
execution.setVariable("orchestrationStatus", "created")
//networkServiceName
- String networkServiceName = jsonUtil.getJsonValue(execution.getVariable("networkServiceModelInfo"), "modelName") ?: ""
+ String networkServiceName = jsonUtil.getJsonValue(execution.getVariable("networkServiceModelInfo"), "modelInfo.modelName") ?: ""
execution.setVariable("networkServiceName", networkServiceName.replaceAll(" Service Proxy", ""))
//networkServiceModelUuid
- String networkServiceModelUuid = jsonUtil.getJsonValue(execution.getVariable("networkServiceModelInfo"), "modelUuid") ?: ""
+ logger.debug("networkServiceName: "+networkServiceName)
+ String networkServiceModelUuid = jsonUtil.getJsonValue(execution.getVariable("networkServiceModelInfo"), "sourceModelUuid") ?: ""
execution.setVariable("networkServiceModelUuid", networkServiceModelUuid)
- String sliceParams = execution.getVariable("sliceParams")
- logger.debug("sliceParams "+sliceParams)
- List<String> bhEndPoints = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "endPoints"))
- if(bhEndPoints.empty) {
- logger.debug("End point info is empty")
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "End point info is empty")
- }else {
- execution.setVariable("bh_endpoint", bhEndPoints.get(0))
- }
+ String sliceParams = execution.getVariable("sliceParams")
+ logger.debug("sliceParams "+sliceParams)
+ List<String> bhEndPoints = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "endPoints"))
+ if(bhEndPoints.empty) {
+ logger.debug("End point info is empty")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "End point info is empty")
+ }else {
+ execution.setVariable("bh_endpoint", bhEndPoints.get(0))
+ }
logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice::: preProcessRequest ****")
}
@@ -139,10 +143,8 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
si.setWorkloadContext(workloadContext)
logger.debug("AAI service Instance Request Payload : "+si.toString())
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
- Response response = getAAIClient().create(uri, si)
- if(response.getStatus()!=200) {
- exceptionUtil.buildAndThrowWorkflowException(execution, response.getStatus(), "AAI instance creation failed")
- }
+ getAAIClient().create(uri, si)
+
execution.setVariable("nssiServiceInstance", si)
} catch (BpmnError e) {
throw e;
@@ -151,12 +153,14 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
+ getVnfInstanceName(execution)
logger.debug(Prefix+ " Exit DoAllocateCoreNonSharedSlice ::: Enter createNSSIinAAI ****")
}
public void prepareServiceOrderRequest(DelegateExecution execution) {
logger.debug("**** Enter DoAllocateCoreNonSharedSlice ::: prepareServiceOrderRequest ****")
- String extAPIPath = UrnPropertiesReader.getVariable("extapi.endpoint", execution) + '/serviceOrder'
+ //extAPI path hardcoded for testing purposes, will be updated in next patch
+ String extAPIPath = "https://nbi.onap:8443/nbi/api/v4" + "/serviceOrder"
execution.setVariable("ExternalAPIURL", extAPIPath)
ObjectMapper objectMapper = new ObjectMapper();
Map<String, Object> serviceOrder = new LinkedHashMap()
@@ -186,10 +190,10 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
// service Details
Map<String, Object> service = new LinkedHashMap()
//ServiceName
- String serviceName= "nsi_"+execution.getVariable("networkServiceName")
+ String serviceName= "ns_"+execution.getVariable("networkServiceName")+"_"+execution.getVariable("serviceInstanceId")
service.put("name", serviceName)
// Service Type
- service.put("serviceType", execution.getVariable("serviceType"))
+ service.put("serviceType", execution.getVariable("subscriptionServiceType"))
//Service State
service.put("serviceState", "active")
Map<String, String> serviceSpecification = new LinkedHashMap()
@@ -198,7 +202,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
//serviceCharacteristic List
List serviceCharacteristicList = new ArrayList()
Map<String, Object> serviceCharacteristic = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class);
- List serviceCharacteristicListMap = retrieveServiceCharacteristicsAsKeyValue(serviceCharacteristic)
+ List serviceCharacteristicListMap = retrieveServiceCharacteristicsAsKeyValue(execution, serviceCharacteristic)
logger.debug("serviceCharacteristicListMap "+serviceCharacteristicListMap)
serviceCharacteristicList.add(serviceCharacteristic)
//service.put("serviceCharacteristic", serviceCharacteristicList)
@@ -213,10 +217,23 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice ::: prepareServiceOrderRequest****")
}
- private List retrieveServiceCharacteristicsAsKeyValue(Map serviceCharacteristics) {
+ private void getVnfInstanceName(DelegateExecution execution) {
+ //Get NetworkService modelInvariantUuid
+ String networkServiceModelUuid = execution.getVariable("networkServiceModelUuid")
+ String json = catalogDbUtils.getServiceResourcesByServiceModelUuid(execution, networkServiceModelUuid, "v2")
+ logger.debug("json returned: "+json)
+ logger.debug(("Service Vnfs JSON: "+jsonUtil.getJsonValue(json, "serviceResources.serviceVnfs")))
+ List serviceVnfs = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(json, "serviceResources.serviceVnfs"))
+ String networkServiceVnfJson = serviceVnfs.get(0)
+ String vnfInstanceName = (jsonUtil.getJsonValue(networkServiceVnfJson, "modelInfo.modelInstanceName")).trim() ?: ""
+ execution.setVariable("vnfInstanceName", vnfInstanceName)
+ }
+
+ private List retrieveServiceCharacteristicsAsKeyValue(DelegateExecution execution, Map serviceCharacteristics) {
logger.debug(Prefix+ " **** Enter DoAllocateCoreNonSharedSlice ::: retrieveServiceCharacteristicsAsKeyValue ****")
List serviceCharacteristicsList = new ArrayList()
ObjectMapper mapperObj = new ObjectMapper();
+ String vnfInstanceName = execution.getVariable("vnfInstanceName")
Map<String, Object> serviceCharacteristicsObject = new LinkedHashMap()
for (Map.Entry<String, Integer> entry : serviceCharacteristics.entrySet()) {
Map<String, Object> ServiceCharacteristicValueObject = new LinkedHashMap<>()
@@ -224,7 +241,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
//For G Release we are sending single value from snssaiList
if(entry.getKey().equals("snssaiList")) {
List sNssaiValue = entry.getValue()
- serviceCharacteristicsObject.put("name", "snssai")
+ serviceCharacteristicsObject.put("name", vnfInstanceName+"_snssai")
ServiceCharacteristicValueObject.put("serviceCharacteristicValue", sNssaiValue.get(0))
serviceCharacteristicsObject.put("value", ServiceCharacteristicValueObject)
}
@@ -303,18 +320,12 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
JSONObject item = items.get(0)
JSONObject service = item.get("service")
String networkServiceId = service.get("id")
- if (networkServiceId == null || networkServiceId.equals("null")) {
- prepareFailedOperationStatusUpdate(execution)
- return
- }
+
execution.setVariable("networkServiceId", networkServiceId)
String serviceOrderState = item.get("state")
execution.setVariable("ServiceOrderState", serviceOrderState)
// Get serviceOrder State and process progress
- if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState)) {
- execution.setVariable("status", "processing")
- }
- else if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) {
+ if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState) || "INPROGRESS".equalsIgnoreCase(serviceOrderState)) {
execution.setVariable("status", "processing")
}
else if("COMPLETED".equalsIgnoreCase(serviceOrderState)) {
@@ -328,6 +339,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
msg = "ServiceOrder failed"
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
+ logger.debug("NBI serviceOrder state: "+serviceOrderState)
}
else{
msg = "Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode
@@ -340,9 +352,6 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice ::: getNBIServiceOrderProgress ****")
}
- /**
- * delay 5 sec
- */
public void timeDelay(DelegateExecution execution) {
try {
logger.debug(Prefix+ " **** DoAllocateCoreNonSharedSlice ::: timeDelay going to sleep for 5 sec")
@@ -353,47 +362,42 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
}
}
-
void updateRelationship(DelegateExecution execution) {
logger.debug(Prefix+ " **** Enter DoAllocateCoreNonSharedSlice ::: updateRelationship ****")
-
String networkServiceInstanceId = execution.getVariable("networkServiceId")
String nssiId = execution.getVariable("nssiServiceInstanceId")
String globalCustId = execution.getVariable("globalSubscriberId")
- String serviceType = execution.getVariable("serviceType")
+ String serviceType = execution.getVariable("subscriptionServiceType")
+ logger.debug("networkServiceInstanceId: "+networkServiceInstanceId +" nssiId: "+nssiId +" globalCustId: "+globalCustId+ " serviceType: "+serviceType)
try{
//Update NSSI orchestration status nssiServiceInstance
ServiceInstance si = execution.getVariable("nssiServiceInstance")
+ logger.debug("nssiServiceInstance "+si)
si.setOrchestrationStatus("activated")
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(nssiId))
+ logger.debug("uri to call: "+uri)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(networkServiceInstanceId))
try {
getAAIClient().update(uri, si)
} catch (Exception e) {
logger.info("Update OrchestrationStatus in AAI failed")
- String msg = "Update OrchestrationStatus in AAI failed, " + e.getMessage()
+ String msg = "Update OrchestrationStatus in AAI failed, " + e
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
-
//URI for NSSI
AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId));
-
+ logger.debug("nssiUri to update RelationShip : "+nssiUri)
//URI for Network Service Instance
AAIResourceUri networkServiceInstanceUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(networkServiceInstanceId))
-
+ logger.debug("networkServiceInstanceUri to update RelationShip : "+networkServiceInstanceUri)
// Update Relationship in AAI
- Response response = getAAIClient().connect(nssiUri, networkServiceInstanceUri, AAIEdgeLabel.COMPOSED_OF);
-
- if(response.getStatus()!=200 || response.getStatus()!=201 || response.getStatus()!=202) {
- exceptionUtil.buildAndThrowWorkflowException(execution, response.getStatus(), "Set association of NSSI and Network service instance has failed in AAI")
- } else {
- //end point update
- createEndPointsInAai(execution)
- execution.setVariable("progress", 100)
- execution.setVariable("status", "finished")
- execution.setVariable("statusDescription", "DoAllocateCoreNonSharedNSSI success")
- setResourceOperationStatus(execution)
- }
+ getAAIClient().connect(nssiUri, networkServiceInstanceUri, AAIEdgeLabel.COMPOSED_OF);
+ //end point update
+ createEndPointsInAai(execution)
+ execution.setVariable("progress", "100")
+ execution.setVariable("status", "finished")
+ execution.setVariable("statusDescription", "DoAllocateCoreNonSharedNSSI success")
+ setResourceOperationStatus(execution)
}catch(Exception ex) {
String msg = "Exception while creating relationship " + ex.getMessage()
logger.info(msg)
@@ -402,78 +406,81 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice ::: updateRelationship ****")
}
- private void createEndPointsInAai(DelegateExecution execution) {
- String type = "endpoint"
- String function = "core_EP"
- int prefixLength = 24
- String addressFamily = "ipv4"
- //BH RAN end point update
- String bh_endpoint = execution.getVariable("bhEndPoints")
- String bh_routeId = UUID.randomUUID().toString()
- execution.setVariable("coreEp_ID_bh", bh_routeId)
- String role = "CN"
- String cnIpAddress = jsonUtil.getJsonValue(bh_endpoint, "IpAddress")
- String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "LogicalLinkId")
- String nextHopInfo = jsonUtil.getJsonValue(bh_endpoint, "nextHopInfo")
- NetworkRoute bh_ep = new NetworkRoute()
- bh_ep.setRouteId(bh_routeId)
- bh_ep.setFunction(function)
- bh_ep.setRole(role)
- bh_ep.setType(type)
- bh_ep.setIpAddress(cnIpAddress)
- bh_ep.setLogicalInterfaceId(LogicalLinkId)
- bh_ep.setNextHop(nextHopInfo)
- bh_ep.setPrefixLength(prefixLength)
- bh_ep.setAddressFamily(addressFamily)
- try {
- AAIResourcesClient client = new AAIResourcesClient()
- logger.debug("creating bh endpoint . ID : "+bh_routeId+" node details : "+bh_ep.toString())
- AAIResourceUri networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), bh_routeId)
- client.create(networkRouteUri, bh_ep)
- //relationship b/w bh_ep and Core NSSI
- def coreNssi = execution.getVariable("NSSIserviceInstanceId")
- Relationship relationship = new Relationship()
- String relatedLink = "aai/v21/network/network-routes/network-route/${bh_routeId}"
- relationship.setRelatedLink(relatedLink)
- relationship.setRelatedTo("network-route")
- relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
- try {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
- execution.getVariable("globalSubscriberId"),
- execution.getVariable("subscriptionServiceType"),
- coreNssi).relationshipAPI()
- client.create(uri, relationship)
- } catch (BpmnError e) {
- throw e
- } catch (Exception ex) {
- String msg = "Exception in CreateCommunicationService.createRelationShipInAAI. " + ex.getMessage()
- logger.info(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- } catch (BpmnError e) {
- throw e
- } catch (Exception ex) {
- String msg = "Exception in createEndPointsInAai " + ex.getMessage()
- logger.info(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- }
-
/**
- * prepare ResourceOperation status
+ * creates EndPoints in AAI
* @param execution
- * @param operationType
*/
+ private void createEndPointsInAai(DelegateExecution execution) {
+ String type = "endpoint"
+ String function = "core_EP"
+ int prefixLength = 24
+ String addressFamily = "ipv4"
+ //BH end point update
+ String bh_endpoint = execution.getVariable("bh_endpoint")
+ String bh_routeId = UUID.randomUUID().toString()
+ execution.setVariable("coreEp_ID_bh", bh_routeId)
+ String role = "CN"
+ String cnIpAddress = jsonUtil.getJsonValue(bh_endpoint, "IpAddress")
+ String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "LogicalLinkId")
+ String nextHopInfo = jsonUtil.getJsonValue(bh_endpoint, "nextHopInfo")
+ NetworkRoute bh_ep = new NetworkRoute()
+ logger.debug("bh_endpoint: "+bh_endpoint +" "+ "bh_routeId: "+bh_routeId +" "+ "cnIpAddress: "+cnIpAddress +" "+ "role: "+role +" "+ "cnIpAddress: "+cnIpAddress +" "+ "LogicalLinkId: "+LogicalLinkId +" "+ "nextHopInfo: "+nextHopInfo +" "+ "bh_ep: "+bh_ep)
+ bh_ep.setRouteId(bh_routeId)
+ bh_ep.setFunction(function)
+ bh_ep.setRole(role)
+ bh_ep.setType(type)
+ bh_ep.setIpAddress(cnIpAddress)
+ bh_ep.setLogicalInterfaceId(LogicalLinkId)
+ bh_ep.setNextHop(nextHopInfo)
+ bh_ep.setPrefixLength(prefixLength)
+ bh_ep.setAddressFamily(addressFamily)
+ try {
+ AAIResourcesClient client = new AAIResourcesClient()
+ logger.debug("creating bh endpoint . ID : "+bh_routeId+" node details : "+bh_ep.toString())
+ AAIResourceUri networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), bh_routeId)
+ client.create(networkRouteUri, bh_ep)
+ //relationship b/w bh_ep and Core NSSI
+ def coreNssi = execution.getVariable("nssiServiceInstanceId")
+ Relationship relationship = new Relationship()
+ String relatedLink = "aai/v21/network/network-routes/network-route/${bh_routeId}"
+ relationship.setRelatedLink(relatedLink)
+ relationship.setRelatedTo("network-route")
+ relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+ logger.debug("networkRouteUri: "+networkRouteUri+"relationship: "+relationship)
+ try {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ execution.getVariable("globalSubscriberId"),
+ execution.getVariable("subscriptionServiceType"),
+ coreNssi).relationshipAPI()
+ logger.debug("uri: "+uri)
+ client.create(uri, relationship)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in createRelationShipInAAI. " + ex.getMessage()
+ logger.debug(msg+": "+ex)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in createEndPointsInAai " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
private void setResourceOperationStatus(DelegateExecution execution) {
logger.debug(Prefix+ " **** Enter DoAllocateCoreNonSharedSlice ::: setResourceOperationStatus ****")
- String serviceId = execution.getVariable("nssiId")
+ String serviceId = execution.getVariable("nsiId")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
- String operationType = execution.getVariable("operationType")
+ String operationType = "ALLOCATE"
ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
resourceOperationStatus.setServiceId(serviceId)
resourceOperationStatus.setOperationId(jobId)
resourceOperationStatus.setResourceTemplateUUID(nsiId)
+ resourceOperationStatus.setResourceInstanceID(nssiId)
resourceOperationStatus.setOperType(operationType)
resourceOperationStatus.setStatus(execution.getVariable("status"))
resourceOperationStatus.setProgress(execution.getVariable("progress"))
@@ -484,17 +491,21 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
void prepareFailedOperationStatusUpdate(DelegateExecution execution){
logger.debug(Prefix + " **** Enter DoAllocateCoreNonSharedSlice ::: prepareFailedOperationStatusUpdate ****")
- String serviceId = execution.getVariable("nssiId")
+ String serviceId = execution.getVariable("nsiId")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
- String operationType = execution.getVariable("operationType")
-
+ String nssiId = execution.getVariable("nssiId")
+ String operationType = "ALLOCATE"
+ //modelUuid
+ String modelUuid= execution.getVariable("modelUuid")
+ logger.debug("serviceId: "+serviceId +" "+ "jobId: "+jobId +" "+ "nsiId: "+nsiId +" "+ "operationType: "+operationType)
ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
resourceOperationStatus.setServiceId(serviceId)
+ resourceOperationStatus.setJobId(jobId)
resourceOperationStatus.setOperationId(jobId)
- resourceOperationStatus.setResourceTemplateUUID(nsiId)
+ resourceOperationStatus.setResourceTemplateUUID(modelUuid)
resourceOperationStatus.setOperType(operationType)
- resourceOperationStatus.setProgress(0)
+ resourceOperationStatus.setProgress("0")
resourceOperationStatus.setStatus("failed")
resourceOperationStatus.setStatusDescription("Core NSSI Allocate Failed")
requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy
index 5ecfc9a872..b3c99c6e9a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy
@@ -115,7 +115,7 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: getNetworkInstanceAssociatedWithNssiId ****")
//NSSI Id as service Instance Id to get from Request
- String serviceInstanceId = execution.getVariable("serviceInstanceID")
+ String serviceInstanceId = execution.getVariable("nssiId")
String errorMsg = "query Network Service Instance from AAI failed"
AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, serviceInstanceId, errorMsg)
@@ -304,14 +304,6 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: getVnfRelationships ****")
}
-
- /**
- * query AAI
- * @param execution
- * @param aaiObjectName
- * @param instanceId
- * @return AAIResultWrapper
- */
private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectName aaiObjectName, String instanceId, String errorMsg) {
logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: queryAAI ****")
String globalSubscriberId = execution.getVariable("globalSubscriberId")
@@ -368,6 +360,8 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
Map vnfMap = vnfList.get(0)
ModelInfo vnfModelInfo = vnfMap.get("modelInfo")
+ vnfModelInfo.setModelCustomizationId(vnfModelInfo.getModelCustomizationUuid())
+ vnfModelInfo.setModelVersionId(vnfModelInfo.getModelId())
logger.debug("vnfModelInfo "+vnfModelInfo)
//List of VFModules
@@ -380,6 +374,8 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
//Traverse VFModules List and add in vfModelInfoList
for (vfModule in vfModuleList) {
ModelInfo vfModelInfo = vfModule.get("modelInfo")
+ vfModelInfo.setModelCustomizationId(vfModelInfo.getModelCustomizationUuid())
+ vfModelInfo.setModelVersionId(vfModelInfo.getModelId())
logger.debug("vfModelInfo "+vfModelInfo)
vfModelInfoList.add(vfModelInfo)
}
@@ -410,25 +406,31 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
//Individual VFModule List
Map<String, Object> vfModuleValues = new LinkedHashMap<>()
vfModuleValues.put("modelInfo", vfModuleModelInfo)
- vfModuleValues.put("instanceName", vfModuleModelInfo.getModelInstanceName())
+ vfModuleValues.put("instanceName", vfModuleModelInfo.getModelName())
//VFModule InstanceParams should be empty or this field should not be there?
List<Map<String, Object>> vfModuleInstanceParams = new ArrayList<>()
vfModuleValues.put("instanceParams", vfModuleInstanceParams)
+ vfModules.add(vfModuleValues)
}
//Vnf intsanceParams
Map<String, Object> sliceProfile = mapper.readValue(execution.getVariable("sliceProfile"), Map.class);
- List vnfInstanceParamsList = new ArrayList<>()
+ List<Map<String, Object>> vnfInstanceParamsList = new ArrayList<>()
String supportedsNssaiJson= prepareVnfInstanceParamsJson(execution)
- vnfInstanceParamsList.add(supportedsNssaiJson)
+
+ Map<String, Object> supportedNssai= new LinkedHashMap<>()
+ supportedNssai.put("supportedsNssai", supportedsNssaiJson)
+ vnfInstanceParamsList.add(supportedNssai)
Platform platform = new Platform()
- platform.setPlatformName(execution.getVariable("platform"))
+ String platformName = execution.getVariable("platformName")
+ platform.setPlatformName(platformName)
LineOfBusiness lineOfbusiness = new LineOfBusiness()
- lineOfbusiness.setLineOfBusinessName(execution.getVariable("lineOfBusiness"))
+ String lineOfBusinessName = execution.getVariable("lineOfBusinessName")
+ lineOfbusiness.setLineOfBusinessName(lineOfBusinessName)
//Vnf Values
Map<String, Object> vnfValues = new LinkedHashMap<>()
@@ -438,7 +440,7 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
vnfValues.put("cloudConfiguration", cloudConfiguration)
vnfValues.put("vfModules", vfModules)
vnfValues.put("modelInfo", vnfModelInfo)
- vnfValues.put("instanceName", execution.getVariable("vnfInstanceName"))
+ vnfValues.put("instanceName", vnfModelInfo.getModelInstanceName())
vnfValues.put("instanceParams",vnfInstanceParamsList)
vnfModelInfoList.add(vnfValues)
@@ -496,10 +498,8 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
Map<String, Object> requestDetailsMap = new LinkedHashMap<>()
requestDetailsMap.put("requestDetails", requestDetails)
String requestPayload = mapper.writeValueAsString(requestDetailsMap)
-
logger.debug("requestDetails "+requestPayload)
execution.setVariable("requestPayload", requestPayload)
-
logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareSOMacroRequestPayLoad ****")
}
@@ -508,14 +508,11 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
List instanceParamsvalues = execution.getVariable("snssaiAndOrchStatusList")
Map<String, Object> nSsai= new LinkedHashMap<>()
nSsai.put("sNssai", instanceParamsvalues)
-
String supportedsNssaiJson = mapper.writeValueAsString(nSsai)
//SupportedNssai
- Map<String, Object> supportedNssai= new LinkedHashMap<>()
- supportedNssai.put("supportedNssai", supportedsNssaiJson)
- logger.debug("**** supportedsNssaiJson**** "+supportedNssai)
+ logger.debug("**** supportedsNssaiJson**** "+supportedsNssaiJson)
logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareVnfInstanceParamsJson ****")
- return supportedNssai
+ return supportedsNssaiJson
}
public void sendPutRequestToSOMacro(DelegateExecution execution) {
@@ -523,14 +520,9 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
try {
String msoEndpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution)
String url = msoEndpoint+"/serviceInstantiation/v7/serviceInstances/"+execution.getVariable("networkServiceInstanceId")+"/vnfs/"+execution.getVariable("vnfId")
-
String requestBody = execution.getVariable("requestPayload")
-
- String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
- String basicAuth = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution)
- String basicAuthValue = utils.encrypt(basicAuth, msoKey)
- String encodeString = utils.getBasicAuth(basicAuthValue, msoKey)
-
+ String encodeString = "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA=="
+ logger.debug("msoEndpoint: "+msoEndpoint +" "+ "url: "+url +" requestBody: "+requestBody +" "+ "encodeString: "+encodeString)
HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO)
httpClient.addAdditionalHeader("Authorization", encodeString)
httpClient.addAdditionalHeader("Accept", "application/json")
@@ -546,84 +538,93 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: sendPostRequestToSOMacro ****")
}
- /**
- * Handle SO Response for PUT and prepare update operation status
- * @param execution
- */
private void handleSOResponse(Response httpResponse, DelegateExecution execution){
logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: handleSOResponse ****")
-
int soResponseCode = httpResponse.getStatus()
logger.debug("soResponseCode : "+soResponseCode)
if (soResponseCode >= 200 && soResponseCode < 204 && httpResponse.hasEntity()) {
String soResponse = httpResponse.readEntity(String.class)
- String operationId = execution.getVariable("operationId")
- def macroOperationId = jsonUtil.getJsonValue(soResponse, "operationId")
+ logger.debug("soResponse: "+soResponse)
+ logger.debug("soResponse JsonUtil: "+jsonUtil.getJsonValue(soResponse, "requestReferences.requestId"))
+ def macroOperationId = jsonUtil.getJsonValue(soResponse, "requestReferences.requestId")
+ def requestSelfLink = jsonUtil.getJsonValue(soResponse, "requestReferences.requestSelfLink")
execution.setVariable("macroOperationId", macroOperationId)
+ execution.setVariable("requestSelfLink", requestSelfLink)
execution.setVariable("isSOTimeOut", "no")
execution.setVariable("isSOResponseSucceed","yes")
}
else {
- String serviceName = execution.getVariable("serviceInstanceName")
execution.setVariable("isSOResponseSucceed","no")
prepareFailedOperationStatusUpdate(execution)
}
logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: handleSOResponse ****")
}
- /**
- * prepare to call sub process CheckProcessStatus
- * @param execution
- */
- void prepareCallCheckProcessStatus(DelegateExecution execution){
- logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: prepareCallCheckProcessStatus ****")
- def successConditions = new ArrayList<>()
- successConditions.add("finished")
- execution.setVariable("successConditions", successConditions)
- def errorConditions = new ArrayList<>()
- errorConditions.add("error")
- execution.setVariable("errorConditions", errorConditions)
- execution.setVariable("processServiceType", "Network service")
- execution.setVariable("subOperationType", "PUT")
- execution.setVariable("initProgress", 20)
- execution.setVariable("endProgress",90)
- execution.setVariable("timeOut", TIMEOUT)
- logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareCallCheckProcessStatus ****")
+ public void getSOPUTProgress(DelegateExecution execution) {
+ logger.debug(Prefix+ " **** Enter DoAllocateCoreSharedSlice ::: getSOPUTProgress ****")
+ String url= execution.getVariable("requestSelfLink")
+ logger.debug("url "+url)
+ HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO)
+ //Hardcoding for now, will be updated in next patch
+ httpClient.addAdditionalHeader("Authorization", "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==")
+ httpClient.addAdditionalHeader("Accept", "application/json")
+ Response httpResponse = httpClient.get()
+ logger.debug("httpResponse "+httpResponse)
+ int soResponseCode = httpResponse.getStatus()
+ logger.debug("soResponseCode : "+soResponseCode)
+ if (soResponseCode >= 200 && soResponseCode < 204 && httpResponse.hasEntity()) {
+ String soResponse = httpResponse.readEntity(String.class)
+ logger.debug("soResponse: "+soResponse)
+ String requestState= jsonUtil.getJsonValue(soResponse, "request.requestStatus.requestState")
+ logger.debug("requestState: "+requestState)
+ execution.setVariable("requestState", requestState)
+ } else {
+ execution.setVariable("isSOResponseSucceed","no")
+ prepareFailedOperationStatusUpdate(execution)
+ }
+ logger.debug(Prefix+ " **** Exit DoAllocateCoreSharedSlice ::: getSOPUTProgress ****")
+ }
+
+ public void timeDelay(DelegateExecution execution) {
+ try {
+ logger.debug(Prefix+ " **** DoAllocateCoreSharedSlice ::: timeDelay going to sleep for 5 sec")
+ Thread.sleep(5000)
+ logger.debug("**** DoAllocateCoreNonSharedSlice ::: timeDelay wakeup after 5 sec")
+ } catch(InterruptedException e) {
+ logger.error(Prefix+ " **** DoAllocateCoreSharedSlice ::: timeDelay exception" + e)
+ }
}
void prepareUpdateResourceOperationStatus(DelegateExecution execution) {
logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: prepareUpdateResourceOperationStatus ****")
//Prepare Update Status for PUT failure and success
- if(execution.getVariable("isTimeOut").equals("YES")) {
- logger.debug("TIMEOUT - SO PUT Failure")
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SO PUT Failure")
- } else {
+ if("COMPLETED".equals(execution.getVariable("requestState"))) {
execution.setVariable("progress", "100")
execution.setVariable("status", "finished")
execution.setVariable("operationContent", "AllocteCoreNSSI successful.")
- logger.debug("prepareFailureStatus,result:${execution.getVariable("result")}, reason: ${execution.getVariable("reason")}")
+ logger.debug("Success ,result:${execution.getVariable("result")}, reason: ${execution.getVariable("reason")}")
+ } else {
+ logger.debug("SO PUT Failure")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SO PUT Failure")
}
setResourceOperationStatus(execution)
logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareUpdateResourceOperationStatus ****")
}
- /**
- * prepare ResourceOperation status
- * @param execution
- * @param operationType
- */
private void setResourceOperationStatus(DelegateExecution execution) {
logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: setResourceOperationStatus ****")
String serviceId = execution.getVariable("nssiId")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
String operationType = execution.getVariable("operationType")
+ logger.debug("serviceId: "+serviceId +" "+ " jobId: "+jobId +" "+ " nsiId: "+nsiId+" nssiId: "+nssiId+" operationType: "+operationType)
ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
resourceOperationStatus.setServiceId(serviceId)
resourceOperationStatus.setOperationId(jobId)
resourceOperationStatus.setResourceTemplateUUID(nsiId)
+ resourceOperationStatus.setResourceInstanceID(nssiId)
resourceOperationStatus.setOperType(operationType)
resourceOperationStatus.setStatus("finished")
resourceOperationStatus.setProgress("100")
@@ -634,17 +635,19 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
void prepareFailedOperationStatusUpdate(DelegateExecution execution){
logger.debug(Prefix + " **** Enter DoAllocateCoreSharedSlice ::: prepareFailedOperationStatusUpdate ****")
- String serviceId = execution.getVariable("nssiId")
+ String serviceId = execution.getVariable("nsiId")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
- String operationType = execution.getVariable("operationType")
-
+ String operationType = "ALLOCATE"
+ logger.debug("serviceId: "+serviceId +" "+ " jobId: "+jobId +" "+ " nsiId: "+nsiId+" operationType: "+operationType)
+ String modelUuid= execution.getVariable("modelUuid")
ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
resourceOperationStatus.setServiceId(serviceId)
+ resourceOperationStatus.setJobId(jobId)
resourceOperationStatus.setOperationId(jobId)
- resourceOperationStatus.setResourceTemplateUUID(nsiId)
+ resourceOperationStatus.setResourceTemplateUUID(modelUuid)
resourceOperationStatus.setOperType(operationType)
- resourceOperationStatus.setProgress(0)
+ resourceOperationStatus.setProgress("0")
resourceOperationStatus.setStatus("failed")
resourceOperationStatus.setStatusDescription("Core NSSI Allocate Failed")
requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy
index 6b15407dd0..fa1cef291e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy
@@ -20,7 +20,8 @@
package org.onap.so.bpmn.infrastructure.scripts
-import static org.junit.Assert.*
+import static org.junit.Assert.assertNotNull
+import static org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
@@ -49,14 +50,19 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest {
@Test
public void testPreProcessRequest() {
- String networkServiceModelInfo=""" {
- "modelName" : "5GC-eMBB Service Proxy",
- "modelUuid" : "b666119e-4400-47c6-a0c1-bbe050a33b47",
- "modelInvariantUuid" : "a26327e1-4a9b-4883-b7a5-5f37dcb7405a",
+ String networkServiceModelInfo="""{
+ "modelInfo" : {
+ "modelName" : "vfw_cnf_service_2310 Service Proxy",
+ "modelUuid" : "35386eb0-b673-48c5-9757-45ecfc506bf8",
+ "modelInvariantUuid" : "b048d7bc-8bfd-4950-aea5-22b1aaf5d76b",
"modelVersion" : "1.0",
- "modelCustomizationUuid" : "cbc12c2a-67e6-4336-9236-eaf51eacdc75",
- "modelInstanceName" : "5gcembb_proxy 0"
- }"""
+ "modelCustomizationUuid" : "82f4db76-e7ad-47eb-b5e3-661683f14de6",
+ "modelInstanceName" : "vfw_cnf_service_2310_proxy 0"
+ },
+ "toscaNodeType" : "org.openecomp.nodes.vfw_cnf_service_2310_proxy",
+ "description" : "A Proxy for Service vfw_cnf_service_2310",
+ "sourceModelUuid" : "f3666c56-744e-4055-9f4a-0726460898e0"
+ }"""
String sliceParams= """{\r\n\t\"sliceProfile\": {\r\n\t\t\"snssaiList\": [\r\n\t\t\t\"001-100001\"\r\n\t\t],\r\n\t\t\"sliceProfileId\": \"ab9af40f13f721b5f13539d87484098\",\r\n\t\t\"plmnIdList\": [\r\n\t\t\t\"460-00\",\r\n\t\t\t\"460-01\"\r\n\t\t],\r\n\t\t\"perfReq\": {\r\n\t\t\t\"perfReqEmbbList \": [{\r\n\t\t\t\t\"activityFactor\": 50\r\n\t\t\t}]\r\n\t\t},\r\n\t\t\"maxNumberofUEs\": 200,\r\n\t\t\"coverageAreaTAList\": [\r\n\t\t\t\"1\",\r\n\t\t\t\"2\",\r\n\t\t\t\"3\",\r\n\t\t\t\"4\"\r\n\t\t],\r\n\t\t\"latency\": 2,\r\n\t\t\"resourceSharingLevel\": \"non-shared\"\r\n\t},\r\n\t\"endPoints\": [{\r\n\t\t\"IpAdress\": \"\",\r\n\t\t\"LogicalLinkId\": \"\",\r\n\t\t\"nextHopInfo\": \"\"\r\n\t}],\r\n\t\"nsiInfo\": {\r\n\t\t\"nsiId\": \"NSI-M-001-HDBNJ-NSMF-01-A-ZX\",\r\n\t\t\"nsiName\": \"eMBB-001\"\r\n\t},\r\n\t\"scriptName\": \"AN1\"\r\n}"""
@@ -70,10 +76,10 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest {
Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceModelUuid"), captor.capture())
captor.getValue()
- assertEquals("b666119e-4400-47c6-a0c1-bbe050a33b47", captor.getValue())
+ assertEquals("f3666c56-744e-4055-9f4a-0726460898e0", captor.getValue())
Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceName"), captor.capture())
- assertEquals("5GC-eMBB", captor.getValue())
+ assertEquals("vfw_cnf_service_2310", captor.getValue())
Mockito.verify(mockExecution, times(1)).setVariable(eq("orchestrationStatus"), captor.capture())
assertEquals("created", captor.getValue())
@@ -90,6 +96,7 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest {
when(mockExecution.getVariable("networkServiceName")).thenReturn("5g_embb")
when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
when(mockExecution.getVariable("networkServiceModelUuid")).thenReturn("12345")
+ when(mockExecution.getVariable("vnfInstanceName")).thenReturn("vf00")
DoAllocateCoreNonSharedSlice allocateNssi = new DoAllocateCoreNonSharedSlice()
allocateNssi.prepareServiceOrderRequest(mockExecution)
@@ -106,7 +113,7 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest {
Map<String, Object> ServiceCharacteristicValue = new LinkedHashMap<>()
Map<String, Object> ServiceCharacteristicValueObject = new LinkedHashMap<>()
ServiceCharacteristicValueObject.put("serviceCharacteristicValue","001-100001")
- ServiceCharacteristicValue.put("name", "snssai")
+ ServiceCharacteristicValue.put("name", "vf00_snssai")
ServiceCharacteristicValue.put("value", ServiceCharacteristicValueObject)
List expectedList= new ArrayList()
@@ -116,8 +123,7 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest {
Map<String, Object> serviceCharacteristic = objectMapper.readValue(sliceProfile, Map.class);
DoAllocateCoreNonSharedSlice allocateNssi = new DoAllocateCoreNonSharedSlice()
- List characteristicList=allocateNssi.retrieveServiceCharacteristicsAsKeyValue(serviceCharacteristic)
-
+ List characteristicList=allocateNssi.retrieveServiceCharacteristicsAsKeyValue(mockExecution, serviceCharacteristic)
assertEquals(expectedList, characteristicList)
}
} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy
index 0ac48ad189..9068692e30 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy
@@ -20,6 +20,9 @@
package org.onap.so.bpmn.infrastructure.scripts
+import static org.junit.Assert.assertNotNull
+import static org.junit.Assert.assertEquals
+
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
import org.junit.Before
import org.junit.Test
@@ -32,7 +35,6 @@ import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
import static org.mockito.Mockito.spy
import static org.mockito.Mockito.times
@@ -91,7 +93,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
}
@Test
- public void tesPrepareSOMacroRequestPayload() {
+ public void testPrepareSOMacroRequestPayload() {
String json ="{ \"serviceResources\" : {\r\n\t\"modelInfo\" : {\r\n\t\t\"modelName\" : \"MSOTADevInfra_vSAMP10a_Service\",\r\n\t\t\"modelUuid\" : \"5df8b6de-2083-11e7-93ae-92361f002671\",\r\n\t\t\"modelInvariantUuid\" : \"9647dfc4-2083-11e7-93ae-92361f002671\",\r\n\t\t\"modelVersion\" : \"1.0\"\r\n\t},\r\n\t\"serviceType\" : \"PortMirroring\",\r\n\t\"serviceRole\" : \"InfraRole\",\r\n\t\"environmentContext\" : \"Luna\",\r\n\t\"workloadContext\" : \"Oxygen\",\r\n\t\"serviceVnfs\": [\r\n\t\r\n\t\t{ \"modelInfo\" : {\r\n\t\t\t\"modelName\" : \"vSAMP10a\",\r\n\t\t\t\"modelUuid\" : \"ff2ae348-214a-11e7-93ae-92361f002671\",\r\n\t\t\t\"modelInvariantUuid\" : \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\t\t\t\"modelVersion\" : \"1.0\",\r\n\t\t\t\"modelCustomizationUuid\" : \"68dc9a92-214c-11e7-93ae-92361f002671\",\r\n\t\t\t\"modelInstanceName\" : \"vSAMP10a 1\"\r\n\t\t\t},\r\n\t\t\"toscaNodeType\" : \"VF\",\r\n\t\t\"nfFunction\" \t: null,\r\n\t\t\"nfType\" \t\t: null,\r\n\t\t\"nfRole\" \t\t: null,\r\n\t\t\"nfNamingCode\" \t: null,\r\n\t\t\"multiStageDesign\"\t\t: null,\r\n\t\t\t\"vfModules\": [\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"NetworkFqdnTest4\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"025606c1-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : \"06bd0a18-65c0-4418-83c7-5b0d13cba01a\",\r\n\t\t\t\t\t\t\"modelVersion\" : \"2.0\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"06bd0a18-65c0-4418-83c7-5b0d13cba01a\"\r\n\t\t\t\t\t},\t\t\"isBase\" : true,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"label\",\r\n\t\t\t\t\t\"initialCount\" : 0,\r\n\t\t\t\t\t\"hasVolumeGroup\" : true\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"NetworkFqdnTest3\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"02560575-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : \"06bd0a18-65c0-4418-83c7-5b0d13cba0bb\",\r\n\t\t\t\t\t\t\"modelVersion\" : \"1.0\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"06bd0a18-65c0-4418-83c7-5b0d13cba0bb\"\r\n\t\t\t\t\t},\t\t\"isBase\" : true,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"label\",\r\n\t\t\t\t\t\"initialCount\" : 0,\r\n\t\t\t\t\t\"hasVolumeGroup\" : false\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"NetworkFqdnTest5\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"025607e4-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : \"06bd0a18-65c0-4418-83c7-5b0d14cba01a\",\r\n\t\t\t\t\t\t\"modelVersion\" : \"1.0\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"06bd0a18-65c0-4418-83c7-5b0d14cba01a\"\r\n\t\t\t\t\t},\t\t\"isBase\" : false,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"label\",\r\n\t\t\t\t\t\"initialCount\" : 0,\r\n\t\t\t\t\t\"hasVolumeGroup\" : false\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"vSAMP10aDEV::PCM::module-2\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"7774b4e4-7d37-11e7-bb31-be2e44b06b34\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : \"93e9c1d2-7d37-11e7-bb31-be2e44b06b34\",\r\n\t\t\t\t\t\t\"modelVersion\" : \"2\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"6728bee8-7d3a-11e7-bb31-be2e44b06b34\"\r\n\t\t\t\t\t},\t\t\"isBase\" : false,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"PCM\",\r\n\t\t\t\t\t\"initialCount\" : 0,\r\n\t\t\t\t\t\"hasVolumeGroup\" : true\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"vSAMP10aDEV::PCM::module-1\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"066de97e-253e-11e7-93ae-92361f002671\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\t\t\t\t\t\t\"modelVersion\" : \"2\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"b4ea86b4-253f-11e7-93ae-92361f002671\"\r\n\t\t\t\t\t},\t\t\"isBase\" : false,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"PCM\",\r\n\t\t\t\t\t\"initialCount\" : 0,\r\n\t\t\t\t\t\"hasVolumeGroup\" : true\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"vSAMP10aDEV::base::module-0\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"20c4431c-246d-11e7-93ae-92361f002671\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\t\t\t\t\t\t\"modelVersion\" : \"2\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"cb82ffd8-252a-11e7-93ae-92361f002671\"\r\n\t\t\t\t\t},\t\t\"isBase\" : true,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"base\",\r\n\t\t\t\t\t\"initialCount\" : 1,\r\n\t\t\t\t\t\"hasVolumeGroup\" : true\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"vSAMP10a::base::module-0\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"02560de2-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : null,\r\n\t\t\t\t\t\t\"modelVersion\" : \"2\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"MIGRATED_36e76920-ef30-4793-9979-cbd7d4b2bfc4\"\r\n\t\t\t\t\t},\t\t\"isBase\" : true,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"base\",\r\n\t\t\t\t\t\"initialCount\" : 1,\r\n\t\t\t\t\t\"hasVolumeGroup\" : true\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"base::module-0\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"02561381-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : null,\r\n\t\t\t\t\t\t\"modelVersion\" : \"1\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"MIGRATED_51baae4c-b7c7-4f57-b77e-6e01acca89e5\"\r\n\t\t\t\t\t},\t\t\"isBase\" : true,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"module-0\",\r\n\t\t\t\t\t\"initialCount\" : 1,\r\n\t\t\t\t\t\"hasVolumeGroup\" : false\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"vSAMP10a::PCM::module-1\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"02560f1b-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : null,\r\n\t\t\t\t\t\t\"modelVersion\" : \"1\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"MIGRATED_e9be2ed7-45b6-479c-b06e-9093899f8ce8\"\r\n\t\t\t\t\t},\t\t\"isBase\" : true,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"PCM\",\r\n\t\t\t\t\t\"initialCount\" : 1,\r\n\t\t\t\t\t\"hasVolumeGroup\" : true\r\n\t\t\t\t}\r\n\t\t\t]\r\n\t\t}\r\n\t],\r\n\t\"serviceNetworks\": [],\r\n\t\"serviceAllottedResources\": [\r\n\t\t{\r\n\t\t\t\"modelInfo\" : {\r\n\t\t\t\t\"modelName\" : \"Tunnel_Xconn\",\r\n\t\t\t\t\"modelUuid\" : \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\t\t\t\t\"modelInvariantUuid\" : \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\t\t\t\t\"modelVersion\" : \"1.0\",\r\n\t\t\t\t\"modelCustomizationUuid\" : \"5b9bee43-f537-4fb3-9e8b-4de9f714d28a\",\r\n\t\t\t\t\"modelInstanceName\" : \"Pri_Tunnel_Xconn 9\"\r\n\t\t\t},\r\n\t\t\t\"toscaNodeType\" : null,\r\n\t\t\t\"allottedResourceType\" : null,\r\n\t\t\t\"allottedResourceRole\" : null,\r\n\t\t\t\"providingServiceModelInvariantUuid\" : null,\r\n\t\t\t\"nfFunction\" : null,\r\n\t\t\t\"nfType\" : null,\r\n\t\t\t\"nfRole\" : null,\r\n\t\t\t\"nfNamingCode\" : null\r\n\t\t}\r\n\t],\r\n\t\"serviceConfigs\": [\r\n\t\t{\r\n\t\t\t\"modelInfo\" : {\r\n\t\t\t\t\"modelName\" : \"Mulder\",\r\n\t\t\t\t\"modelUuid\" : \"025606c1-4fff-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelInvariantUuid\" : \"025606c1-4eee-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelVersion\" : \"1.0\",\r\n\t\t\t\t\"modelCustomizationUuid\" : \"025606c1-4ddd-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelInstanceName\" : \"X_FILES_001\"\r\n\t\t\t},\r\n\t\t\t\"toscaNodeType\" : \"Scully\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"modelInfo\" : {\r\n\t\t\t\t\"modelName\" : \"Krychuk\",\r\n\t\t\t\t\"modelUuid\" : \"025606c1-5fff-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelInvariantUuid\" : \"025606c1-5eee-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelVersion\" : \"1.0\",\r\n\t\t\t\t\"modelCustomizationUuid\" : \"025606c1-5ddd-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelInstanceName\" : \"X_FILES_002\"\r\n\t\t\t},\r\n\t\t\t\"toscaNodeType\" : \"Skinner\"\r\n\t\t}\r\n\t]\r\n\t}}\r\n\r\n"
String sliceProfile = "{\r\n \"snssaiList\": [ \r\n \"001-100001\"\r\n ],\r\n \"sliceProfileId\": \"ab9af40f13f721b5f13539d87484098\",\r\n \"plmnIdList\": [\r\n \"460-00\",\r\n \"460-01\"\r\n ],\r\n \"perfReq\": {\r\n \"perfReqEmbbList \": [\r\n {\r\n \"activityFactor\": 50\r\n }\r\n ]\r\n },\r\n \"maxNumberofUEs\": 200, \r\n \"coverageAreaTAList\": [ \r\n \"1\",\r\n \"2\",\r\n \"3\",\r\n \"4\"\r\n ],\r\n \"latency\": 2,\r\n \"resourceSharingLevel\": \"non-shared\" \r\n }"
@@ -125,7 +127,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
when(mockExecution.getVariable("snssaiAndOrchStatusList")).thenReturn(snssaiList)
String returnedJsonAsString= allocate.prepareVnfInstanceParamsJson(mockExecution)
- String expectedJsonAsString = """{supportedNssai={"sNssai":[{"snssai":"01-5C83F071","status":"activated"},{"snssai":"01-5B179BD4","status":"activated"}]}}"""
+ String expectedJsonAsString = """{"sNssai":[{"snssai":"01-5C83F071","status":"activated"},{"snssai":"01-5B179BD4","status":"activated"}]}"""
assertEquals(expectedJsonAsString, returnedJsonAsString)
}
@@ -137,6 +139,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
DoAllocateCoreSharedSlice obj = spy(DoAllocateCoreSharedSlice.class)
when(obj.getAAIClient()).thenReturn(client)
+
AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX"))
when(client.exists(resourceUri1)).thenReturn(true)
AAIResultWrapper wrapper1 = new AAIResultWrapper(mockQuerySliceServiceReturn())
@@ -149,15 +152,14 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
when(client.exists(resourceUri2)).thenReturn(true)
AAIResultWrapper wrapper2 = new AAIResultWrapper(mockQueryNS())
when(client.get(resourceUri2, NotFoundException.class)).thenReturn(wrapper2)
-
//Check Vnf
when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912")
- AAIResourceUri resourceUri3 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("eeb66c6f-36bd-47ad-8294-48f46b1aa912"))
+
+ AAIResourceUri resourceUri3 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(mockExecution.getVariable("vnfId")))
when(client.exists(resourceUri3)).thenReturn(true)
AAIResultWrapper wrapper3 = new AAIResultWrapper(mockQueryVnf())
when(client.get(resourceUri3, NotFoundException.class)).thenReturn(wrapper3)
-
//Allotted Resources-1
AAIResourceUri resourceUri4 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("0d3d3cce-46a8-486d-816a-954e71697c4e"))
when(client.exists(resourceUri4)).thenReturn(true)
@@ -185,22 +187,19 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
Mockito.verify(mockExecution, times(1)).setVariable(eq("owningEntityId"), captor.capture())
assertEquals("OE-generic", captor.getValue())
- //assertEquals("206535e7-77c9-4036-9387-3f1cf57b4379", captor.getValue())
-
//VnfId
Mockito.verify(mockExecution, times(1)).setVariable(eq("vnfId"), captor.capture())
assertEquals("eeb66c6f-36bd-47ad-8294-48f46b1aa912", captor.getValue())
- //
Mockito.verify(mockExecution, times(1)).setVariable(eq("snssaiAndOrchStatusList"), captor.capture())
List<Map<String, Object>> snssaiList = new ArrayList<>()
Map<String, Object> snssaiMap = new LinkedHashMap<>()
snssaiMap.put("snssai", "01-5C83F071")
- snssaiMap.put("orchestrationStatus", "activated")
+ snssaiMap.put("status", "activated")
snssaiList.add(snssaiMap)
Map<String, Object> snssaiMap1 = new LinkedHashMap<>()
snssaiMap1.put("snssai", "01-5B179BD4")
- snssaiMap1.put("orchestrationStatus", "activated")
+ snssaiMap1.put("status", "activated")
snssaiList.add(snssaiMap1)
assertEquals(snssaiList, captor.getValue())
@@ -237,6 +236,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
when(mockExecution.getVariable("msoRequestId")).thenReturn("5ad89cf9-0569-4a93-4509-d8324321e2be")
when(mockExecution.getVariable("serviceInstanceID")).thenReturn("NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX")
+ when(mockExecution.getVariable("nssiId")).thenReturn("NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX")
when(mockExecution.getVariable("nsiId")).thenReturn("NSI-M-001-HDBNJ-NSMF-01-A-ZX")
when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G")
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNSSI.bpmn
index 92407e9b2a..45ebfb9664 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNSSI.bpmn
@@ -78,6 +78,7 @@ allocateNssi.prepareOOFRequest(execution)</bpmn:script>
<camunda:in source="servicename" target="servicename" />
<camunda:in source="msoRequestId" target="msoRequestId" />
<camunda:in source="sliceProfile" target="sliceProfile" />
+ <camunda:in source="jobId" target="jobId" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1ygklb8</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0tytimn</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreSharedSlice.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreSharedSlice.bpmn
index 0a482beca0..88902d1c91 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreSharedSlice.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreSharedSlice.bpmn
@@ -39,37 +39,15 @@ allocateNssi.prepareSOMacroRequestPayload(execution)</bpmn:script>
def allocateNssi = new DoAllocateCoreSharedSlice()
allocateNssi.sendPutRequestToSOMacro(execution)</bpmn:script>
</bpmn:scriptTask>
- <bpmn:scriptTask id="Activity_0ge2y0l" name="Prepare Call CheckServiceProcessStatus" scriptFormat="groovy">
+ <bpmn:scriptTask id="Activity_0ge2y0l" name="Call Get SO PUT progress" scriptFormat="groovy">
<bpmn:incoming>Flow_0x7shtq</bpmn:incoming>
+ <bpmn:incoming>Flow_163kxug</bpmn:incoming>
<bpmn:outgoing>Flow_1c9nkx4</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def allocateNssi = new DoAllocateCoreSharedSlice()
-allocateNssi.prepareCallCheckProcessStatus(execution)</bpmn:script>
+allocateNssi.getSOPUTProgress(execution)</bpmn:script>
</bpmn:scriptTask>
- <bpmn:callActivity id="Activity_19xwwnc" name="CallCheckServiceProcessStatus" calledElement="CheckServiceProcessStatus">
- <bpmn:extensionElements>
- <camunda:in source="networkServiceInstanceId" target="serviceInstanceId" />
- <camunda:in source="macroOperationId" target="operationId" />
- <camunda:in source="successConditions" target="successConditions" />
- <camunda:in source="errorConditions" target="errorConditions" />
- <camunda:in source="processServiceType" target="processServiceType" />
- <camunda:in source="timeOut" target="timeOut" />
- <camunda:out source="operationStatus" target="result" />
- <camunda:out source="operationContent" target="reason" />
- <camunda:out source="WorkflowException" target="WorkflowException" />
- <camunda:out source="isTimeOut" target="isTimeOut" />
- <camunda:in source="subOperationType" target="operationType" />
- <camunda:in source="initProgress" target="initProgress" />
- <camunda:in source="endProgress" target="endProgress" />
- <camunda:in source="serviceInstanceID" target="parentServiceInstanceId" />
- <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
- <camunda:in source="operationId" target="parentOperationId" />
- </bpmn:extensionElements>
- <bpmn:incoming>Flow_1c9nkx4</bpmn:incoming>
- <bpmn:outgoing>Flow_0c94gye</bpmn:outgoing>
- </bpmn:callActivity>
- <bpmn:sequenceFlow id="Flow_1c9nkx4" sourceRef="Activity_0ge2y0l" targetRef="Activity_19xwwnc" />
- <bpmn:sequenceFlow id="Flow_0c94gye" sourceRef="Activity_19xwwnc" targetRef="Activity_1t49t6c" />
+ <bpmn:sequenceFlow id="Flow_1c9nkx4" sourceRef="Activity_0ge2y0l" targetRef="Gateway_1boyqt9" />
<bpmn:scriptTask id="Activity_0no0sxa" name="Get VNF/VFs modelInfo from CatalogDB" scriptFormat="groovy">
<bpmn:incoming>Flow_1973d9m</bpmn:incoming>
<bpmn:outgoing>Flow_0da7dao</bpmn:outgoing>
@@ -78,13 +56,13 @@ def allocateNssi = new DoAllocateCoreSharedSlice()
allocateNssi.getServiceVNFAndVFsFromCatalogDB(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:scriptTask id="Activity_1t49t6c" name="Prepare Update Operation Status" scriptFormat="groovy">
- <bpmn:incoming>Flow_0c94gye</bpmn:incoming>
+ <bpmn:incoming>Flow_15lksyg</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1re5jor</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def allocateNssi = new DoAllocateCoreSharedSlice()
allocateNssi.prepareUpdateResourceOperationStatus(execution)</bpmn:script>
</bpmn:scriptTask>
- <bpmn:serviceTask id="Activity_0t6viuq" name="Update Service Operation Status">
+ <bpmn:serviceTask id="Activity_0t6viuq" name="Update Resource Operation Status">
<bpmn:extensionElements>
<camunda:connector>
<camunda:inputOutput>
@@ -95,7 +73,7 @@ allocateNssi.prepareUpdateResourceOperationStatus(execution)</bpmn:script>
<camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
</camunda:map>
</camunda:inputParameter>
- <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
<camunda:inputParameter name="method">POST</camunda:inputParameter>
<camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
<camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
@@ -111,11 +89,11 @@ allocateNssi.prepareUpdateResourceOperationStatus(execution)</bpmn:script>
<bpmn:sequenceFlow id="SequenceFlow_08q2fd9" sourceRef="Activity_12jcmzc" targetRef="Gateway_0sfmiku" />
<bpmn:sequenceFlow id="SequenceFlow_1re5jor" sourceRef="Activity_1t49t6c" targetRef="Activity_0t6viuq" />
<bpmn:sequenceFlow id="SequenceFlow_1j1qqcs" sourceRef="Task_16983t3" targetRef="IntermediateThrowEvent_09rhn4h" />
- <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_09rhn4h" name="Call SO macro api">
+ <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_09rhn4h" name="CallSO">
<bpmn:incoming>SequenceFlow_1j1qqcs</bpmn:incoming>
<bpmn:linkEventDefinition name="CallSO" />
</bpmn:intermediateThrowEvent>
- <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0qh9wy2" name="Call SO macro api">
+ <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0qh9wy2" name="CallSO">
<bpmn:outgoing>SequenceFlow_013bc74</bpmn:outgoing>
<bpmn:linkEventDefinition name="CallSO" />
</bpmn:intermediateCatchEvent>
@@ -178,16 +156,33 @@ allocateNssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
<bpmn:sequenceFlow id="Flow_0kadgoq" sourceRef="Activity_0sqggtb" targetRef="Activity_1btidug" />
<bpmn:sequenceFlow id="Flow_128o22z" sourceRef="Activity_1btidug" targetRef="Activity_1150yu6" />
</bpmn:subProcess>
+ <bpmn:exclusiveGateway id="Gateway_1boyqt9" default="Flow_15lksyg">
+ <bpmn:incoming>Flow_1c9nkx4</bpmn:incoming>
+ <bpmn:outgoing>Flow_15lksyg</bpmn:outgoing>
+ <bpmn:outgoing>Flow_1lzv4jo</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="Flow_15lksyg" sourceRef="Gateway_1boyqt9" targetRef="Activity_1t49t6c" />
+ <bpmn:sequenceFlow id="Flow_1lzv4jo" name="requestState=IN_PROGRESS" sourceRef="Gateway_1boyqt9" targetRef="Activity_1qm4des">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("requestState" ) == "IN_PROGRESS")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:scriptTask id="Activity_1qm4des" name="Time Delay 5s" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1lzv4jo</bpmn:incoming>
+ <bpmn:outgoing>Flow_163kxug</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreSharedSlice()
+allocateNssi.timeDelay(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_163kxug" sourceRef="Activity_1qm4des" targetRef="Activity_0ge2y0l" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateCoreSharedSlice">
<bpmndi:BPMNEdge id="Flow_1nn15tq_di" bpmnElement="Flow_1nn15tq">
- <di:waypoint x="420" y="306" />
- <di:waypoint x="420" y="360" />
- <di:waypoint x="967" y="360" />
- <di:waypoint x="967" y="321" />
+ <di:waypoint x="420" y="256" />
+ <di:waypoint x="420" y="200" />
+ <di:waypoint x="967" y="200" />
+ <di:waypoint x="967" y="241" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="687" y="342" width="14" height="12" />
+ <dc:Bounds x="687" y="182" width="15" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0x7shtq_di" bpmnElement="Flow_0x7shtq">
@@ -232,16 +227,9 @@ allocateNssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
<dc:Bounds x="931.5" y="336" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_0c94gye_di" bpmnElement="Flow_0c94gye">
- <di:waypoint x="736" y="281" />
- <di:waypoint x="778" y="281" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="652" y="336" width="90" height="20" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1c9nkx4_di" bpmnElement="Flow_1c9nkx4">
<di:waypoint x="584" y="281" />
- <di:waypoint x="636" y="281" />
+ <di:waypoint x="655" y="281" />
<bpmndi:BPMNLabel>
<dc:Bounds x="505" y="336" width="90" height="20" />
</bpmndi:BPMNLabel>
@@ -271,6 +259,22 @@ allocateNssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
<dc:Bounds x="207" y="179" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_15lksyg_di" bpmnElement="Flow_15lksyg">
+ <di:waypoint x="705" y="281" />
+ <di:waypoint x="778" y="281" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1lzv4jo_di" bpmnElement="Flow_1lzv4jo">
+ <di:waypoint x="680" y="306" />
+ <di:waypoint x="680" y="340" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="603" y="315" width="78" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_163kxug_di" bpmnElement="Flow_163kxug">
+ <di:waypoint x="630" y="380" />
+ <di:waypoint x="534" y="380" />
+ <di:waypoint x="534" y="321" />
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="248" y="102" width="36" height="36" />
<bpmndi:BPMNLabel>
@@ -298,9 +302,6 @@ allocateNssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
<bpmndi:BPMNShape id="Activity_0ge2y0l_di" bpmnElement="Activity_0ge2y0l">
<dc:Bounds x="484" y="241" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_19xwwnc_di" bpmnElement="Activity_19xwwnc">
- <dc:Bounds x="636" y="241" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0k70k5i_di" bpmnElement="Activity_0no0sxa">
<dc:Bounds x="654" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
@@ -313,21 +314,27 @@ allocateNssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
<bpmndi:BPMNShape id="IntermediateThrowEvent_06785ru_di" bpmnElement="IntermediateThrowEvent_09rhn4h">
<dc:Bounds x="949" y="102" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="923" y="142" width="90" height="14" />
+ <dc:Bounds x="950" y="142" width="36" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateCatchEvent_09u3rdp_di" bpmnElement="IntermediateThrowEvent_0qh9wy2">
<dc:Bounds x="182" y="263" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="156" y="303" width="90" height="14" />
+ <dc:Bounds x="183" y="303" width="36" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_0sfmiku_di" bpmnElement="Gateway_0sfmiku" isMarkerVisible="true">
<dc:Bounds x="395" y="256" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="380" y="226" width="80" height="27" />
+ <dc:Bounds x="380" y="315.5" width="80" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_1boyqt9_di" bpmnElement="Gateway_1boyqt9" isMarkerVisible="true">
+ <dc:Bounds x="655" y="256" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1iksno7_di" bpmnElement="Activity_1qm4des">
+ <dc:Bounds x="630" y="340" width="100" height="80" />
+ </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_08h38js_di" bpmnElement="Activity_08h38js" isExpanded="true">
<dc:Bounds x="250" y="440" width="781" height="196" />
</bpmndi:BPMNShape>
diff --git a/pom.xml b/pom.xml
index 5ffa2d2292..dd78d138a9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -962,7 +962,7 @@
<dependency>
<groupId>org.onap.aai.schema-service</groupId>
<artifactId>aai-schema</artifactId>
- <version>1.7.10</version>
+ <version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>