summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java18
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java97
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn8
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java3
6 files changed, 87 insertions, 43 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index 61c0cdbf2e..44ea2a25a2 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -971,8 +971,10 @@ public class ASDCController {
private void processNsstNotification(INotificationData iNotif, ToscaResourceStructure toscaResourceStructure) {
Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata();
try {
- if (serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY).equalsIgnoreCase("NSST")) {
-
+ String category = serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
+ boolean isNeedInital = (category.contains("NSST") || category.equalsIgnoreCase("TN Network Requirement"))
+ && iNotif.getResources().isEmpty();
+ if (isNeedInital) {
String artifactContent = null;
List<IArtifactInfo> serviceArtifacts = iNotif.getServiceArtifacts();
Optional<IArtifactInfo> artifactOpt = serviceArtifacts.stream()
@@ -986,14 +988,18 @@ public class ASDCController {
artifactContent = zipParserInstance.parseJsonForZip(filePath);
logger.debug(
"serviceArtifact parsing success! serviceArtifactUUID: " + artifactInfo.getArtifactUUID());
+
+ ResourceStructure resourceStructure = new VfResourceStructure(iNotif, new ResourceInstance());
+ resourceStructure.setResourceType(ResourceType.OTHER);
+ toscaInstaller.installNsstService(toscaResourceStructure, (VfResourceStructure) resourceStructure,
+ artifactContent);
} else {
logger.debug("serviceArtifact is null");
+ toscaInstaller.installNsstService(toscaResourceStructure, null, null);
}
- ResourceStructure resourceStructure = new VfResourceStructure(iNotif, new ResourceInstance());
- resourceStructure.setResourceType(ResourceType.OTHER);
- toscaInstaller.installTheNsstService(toscaResourceStructure, (VfResourceStructure) resourceStructure,
- artifactContent);
+
}
+
} catch (IOException e) {
logger.error("serviceArtifact parse failure for service uuid: "
+ serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index d023df3b79..49fef1d3f0 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -2870,7 +2870,15 @@ public class ToscaResourceInstaller {
List<Input> serviceInputs = sdcCsarHelper.getServiceInputs();
if (!serviceInputs.isEmpty()) {
serviceInputList = new ArrayList<>();
- serviceInputs.forEach(input -> {
+ List<Input> filterList;
+ filterList = serviceInputs.stream()
+ .filter(input -> !SKIP_POST_INST_CONF.equals(input.getName())
+ && !CDS_MODEL_NAME.equalsIgnoreCase(input.getName())
+ && !CDS_MODEL_VERSION.equalsIgnoreCase(input.getName())
+ && !CONTROLLER_ACTOR.equalsIgnoreCase(input.getName()))
+ .collect(Collectors.toList());
+
+ filterList.forEach(input -> {
Map<String, Object> serviceInputMap = new HashMap<>();
serviceInputMap.put("name", input.getName());
serviceInputMap.put("type", input.getType());
@@ -2894,7 +2902,7 @@ public class ToscaResourceInstaller {
}
@Transactional(rollbackFor = {ArtifactInstallerException.class})
- public void installTheNsstService(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStruct,
+ public void installNsstService(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStruct,
String artifactContent) {
createToscaCsar(toscaResourceStruct);
createService(toscaResourceStruct, vfResourceStruct);
@@ -2925,6 +2933,10 @@ public class ToscaResourceInstaller {
}
private void createServiceInfo(ToscaResourceStructure toscaResourceStruct, Service service) {
+ if (!service.getServiceInfos().isEmpty()) {
+ return;
+ }
+
List<ServiceInfo> serviceInfos = new ArrayList<>();
ServiceInfo serviceInfo = new ServiceInfo();
@@ -2945,42 +2957,67 @@ public class ToscaResourceInstaller {
ISdcCsarHelper helper = toscaResourceStruct.getSdcCsarHelper();
String typeName = helper.getServiceSubstitutionMappingsTypeName();
Optional<NodeTemplate> nodeTemplate = helper.getServiceNodeTemplates().stream().findAny();
- List<Object> serviceProperties = new ArrayList<>();
- Map<String, Object> servicePropertiesMap;
+
if (nodeTemplate.isPresent()) {
+ String serviceUUID = nodeTemplate.get().getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID);
LinkedHashMap<String, Object> customDef = nodeTemplate.get().getCustomDef();
- Optional<String> machKey =
- customDef.keySet().stream().filter(key -> key.equalsIgnoreCase(typeName)).findFirst();
- if (machKey.isPresent()) {
- Object obj = customDef.get(machKey.get());
- try {
- if (obj instanceof Map) {
- Object properties = ((HashMap) obj).get("properties");
- if (null != properties) {
- for (Object propertyName : ((Map) properties).keySet()) {
- servicePropertiesMap = new HashMap<>();
- servicePropertiesMap.put("name", propertyName);
- Object object = ((Map) properties).get(propertyName);
- for (Object entry : ((Map) object).entrySet()) {
- servicePropertiesMap.put((String) ((Map.Entry) entry).getKey(),
- ((Map.Entry) entry).getValue());
- }
- servicePropertiesMap.remove("description");
- serviceProperties.add(servicePropertiesMap);
+ List<Object> serviceProperties = getPropertiesFromCustomDef(customDef, typeName);
+
+ try {
+ propertiesJson = objectMapper.writeValueAsString(serviceProperties);
+ propertiesJson = propertiesJson.replace("\"", "\\\"");
+ } catch (JsonProcessingException e) {
+ logger.error("serviceProperties could not be deserialized for service uuid: " + serviceUUID);
+ } catch (Exception ex) {
+ logger.error("service properties parsing failed. service uuid:" + serviceUUID);
+ }
+
+ } else {
+ logger.debug("ServiceNodeTemplates is null");
+ }
+ return propertiesJson;
+ }
+
+ private static List<Object> getPropertiesFromCustomDef(LinkedHashMap<String, Object> customDef,
+ final String typeName) {
+ Optional<String> machKey =
+ customDef.keySet().stream().filter(key -> key.equalsIgnoreCase(typeName)).findFirst();
+ Map<String, Object> servicePropertiesMap;
+ List<Object> serviceProperties = new ArrayList<>();
+
+ if (machKey.isPresent()) {
+ Object obj = customDef.get(machKey.get());
+ if (obj instanceof Map) {
+ Object properties = ((HashMap) obj).get("properties");
+ if (null != properties) {
+ for (Object propertyName : ((Map) properties).keySet()) {
+ if (propertyName.toString().split("_").length >= 2) {
+ continue;
+ }
+
+ servicePropertiesMap = new HashMap<>();
+ servicePropertiesMap.put("name", propertyName);
+ Object object = ((Map) properties).get(propertyName);
+ for (Object entry : ((Map) object).entrySet()) {
+ servicePropertiesMap.put((String) ((Map.Entry) entry).getKey(),
+ ((Map.Entry) entry).getValue());
+ }
+
+ String type = servicePropertiesMap.get("type").toString();
+ if (type.split("\\.").length >= 2) {
+ List<Object> subProperties = getPropertiesFromCustomDef(customDef, type);
+ if (subProperties.size() > 0) {
+ serviceProperties.addAll(subProperties);
}
- propertiesJson = objectMapper.writeValueAsString(serviceProperties);
- propertiesJson = propertiesJson.replace("\"", "\\\"");
+ continue;
}
+ servicePropertiesMap.remove("description");
+ serviceProperties.add(servicePropertiesMap);
}
- } catch (JsonProcessingException e) {
- logger.error("serviceProperties could not be deserialized for service uuid: "
- + nodeTemplate.get().getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
}
}
- } else {
- logger.debug("ServiceNodeTemplates is null");
}
- return propertiesJson;
+ return serviceProperties;
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy
index ebc5f4ac58..644cf5e387 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy
@@ -79,7 +79,7 @@ class DoHandleOofRequest extends AbstractServiceTaskProcessor {
oofRequestPayload.setApiPath(apiPath)
oofRequestPayload.setRequestDetails(requestDetails)
ObjectMapper objectMapper = new ObjectMapper()
- String requestJson = objectMapper.writeValueAsString(oofRequestPayload)
+ String requestJson = objectMapper.writeValueAsString(oofRequestPayload)
execution.setVariable("oofRequestPayload", requestJson)
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
index 389f0a089c..dcbaf746ea 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
@@ -181,7 +181,7 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
public void prepareSelectNSTRequest(DelegateExecution execution) {
logger.debug("Start prepareSelectNSTRequest")
String requestId = execution.getVariable("msoRequestId")
- String messageType = "NSTSelectionResponse"
+ String messageType = "NSTSelectionResponse"
Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
execution.setVariable("nstSelectionUrl", "/api/oof/v1/selection/nst")
execution.setVariable("nstSelection_messageType",messageType)
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn
index 7ca1a62312..d6b251649f 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0nlt5gi" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0nlt5gi" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
<bpmn:process id="DoHandleOofRequest" name="DoHandleOofRequest" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_1jorico</bpmn:outgoing>
@@ -10,8 +10,7 @@
<bpmn:outgoing>Flow_013jfci</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.common.scripts.*
def oofHandler = new DoHandleOofRequest()
-oofHandler .callOofAdapter(execution)
-</bpmn:script>
+oofHandler.callOofAdapter(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="Flow_1jorico" sourceRef="StartEvent_1" targetRef="Activity_0tki17o" />
<bpmn:scriptTask id="Activity_0tki17o" name="Preprocess Request" scriptFormat="groovy">
@@ -19,8 +18,7 @@ oofHandler .callOofAdapter(execution)
<bpmn:outgoing>Flow_1fbzzqg</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.common.scripts.*
def oofHandler = new DoHandleOofRequest()
-oofHandler .preProcessRequest(execution)
-</bpmn:script>
+oofHandler .preProcessRequest(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:subProcess id="Activity_02ru8n9" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
<bpmn:startEvent id="Event_1r00tca">
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java
index 19e875f8bc..3827c0e19f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java
@@ -38,6 +38,8 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import com.openpojo.business.annotation.BusinessKey;
+import org.hibernate.annotations.NotFound;
+import org.hibernate.annotations.NotFoundAction;
import uk.co.blackpepper.bowman.annotation.LinkedResource;
import uk.co.blackpepper.bowman.annotation.RemoteResource;
@@ -76,6 +78,7 @@ public class AllottedResource implements Serializable {
private Date created;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "allottedResource")
+ @NotFound(action = NotFoundAction.IGNORE)
private Set<AllottedResourceCustomization> allotedResourceCustomization;
@Override