aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml32
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml30
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java74
-rw-r--r--bpmn/so-bpmn-tasks/pom.xml30
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java88
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java41
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java55
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java3
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIVersion.java11
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeBase.java (renamed from common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java)34
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLOutputNode.java8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java10
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java64
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLStartNode.java19
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLTraversal.java33
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/Node.java5
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/Output.java7
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/Start.java7
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/TraversalBuilder.java17
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/__.java13
-rw-r--r--common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java11
-rw-r--r--common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java59
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/AAIDeserializeTest.java84
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/AAI.json132
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/UnknownProperty.json1
26 files changed, 600 insertions, 271 deletions
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
index 977541cc16..54f05859d9 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
@@ -103,6 +103,8 @@
</goals>
<configuration>
<sources>
+ <source>${project.basedir}/target/generated-sources/etsicatalog/notification/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/sol003-vnf-packagemanagement/notification/src/gen/java/main</source>
<source>${project.basedir}/target/generated-sources/vnfmadapter/src/gen/java/main</source>
</sources>
</configuration>
@@ -110,6 +112,36 @@
</executions>
</plugin>
</plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <versionRange>[2.2.0,)</versionRange>
+ </pluginExecutionFilter>
+ <action>
+ <execute>
+ <runOnIncremental>false</runOnIncremental>
+ </execute>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
<dependencies>
<dependency>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
index dacd5d96b6..ab524ca808 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
@@ -156,6 +156,36 @@
</executions>
</plugin>
</plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <versionRange>[2.2.0,)</versionRange>
+ </pluginExecutionFilter>
+ <action>
+ <execute>
+ <runOnIncremental>false</runOnIncremental>
+ </execute>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
<dependencies>
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
index 3632d187c9..70c78472ba 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
@@ -23,10 +23,6 @@
package org.onap.so.bpmn.core.domain;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -35,6 +31,10 @@ import org.onap.so.bpmn.core.json.DecomposeJsonUtil;
import org.onap.so.bpmn.core.json.JsonDecomposingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
@@ -71,6 +71,10 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
private List<AllottedResource> allottedResources;
@JsonProperty("configResource")
private List<ConfigResource> configResources;
+ @JsonProperty("serviceInfo")
+ private ServiceInfo serviceInfo;
+ @JsonProperty("serviceProxy")
+ private List<ServiceProxy> serviceProxy;
public ServiceDecomposition() {
super();
@@ -85,6 +89,8 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
this.serviceRole = serviceDecomposition.getServiceRole();
this.serviceType = serviceDecomposition.getServiceType();
this.configResources = serviceDecomposition.getConfigResources();
+ this.serviceProxy = serviceDecomposition.getServiceProxy();
+ this.serviceInfo = serviceDecomposition.getServiceInfo();
}
/**
@@ -109,11 +115,13 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
this.project = serviceDecomposition.getProject();
this.owningEntity = serviceDecomposition.getOwningEntity();
+ this.serviceProxy = serviceDecomposition.getServiceProxy();
+ this.serviceInfo = serviceDecomposition.getServiceInfo();
}
/**
* Constructor taking a Service Decomposition JSON serialization
- *
+ *
* @param catalogRestOutput
* @param serviceInstanceId
*/
@@ -128,7 +136,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
* Return just the service model portion of the Service Decomposition as a Java object. The service model object
* should support retrieval as JSON string that is formatted correctly for sending serviceModelInfo to Building
* Blocks.
- *
+ *
* @return
*/
public ModelInfo getModelInfo() {
@@ -235,6 +243,22 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
this.sdncVersion = sdncVersion;
}
+ public ServiceInfo getServiceInfo() {
+ return serviceInfo;
+ }
+
+ public void setServiceInfo(ServiceInfo serviceInfo) {
+ this.serviceInfo = serviceInfo;
+ }
+
+ public List<ServiceProxy> getServiceProxy() {
+ return serviceProxy;
+ }
+
+ public void setServiceProxy(List<ServiceProxy> serviceProxy) {
+ this.serviceProxy = serviceProxy;
+ }
+
// *****
// *****
@@ -243,7 +267,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* This method returns one combined list of Resources of All Types
- *
+ *
* @return
*/
@JsonIgnore
@@ -275,7 +299,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Returns a JSON list of all Network Resource structures (i.e. the serialized NetworkDecomposition objects).
- *
+ *
* @return
*/
@JsonIgnore
@@ -285,7 +309,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Returns a JSON list of all VnfResource structures (i.e. the serialized VnfResource objects).
- *
+ *
* @return
*/
@JsonIgnore
@@ -295,7 +319,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Returns a JSON list of all Allotted Resource structures (i.e. the serialized AllottedResource objects).
- *
+ *
* @return
*/
@JsonIgnore
@@ -305,7 +329,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Returns a JSON list of all Config Resource structures (i.e. the serialized ConfigResource objects).
- *
+ *
* @return
*/
@JsonIgnore
@@ -328,7 +352,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
// Methods to add Resource to the list
/**
* Add VNF resource to the list
- *
+ *
* @param vnfResource
*/
public void addVnfResource(Resource vnfResource) {
@@ -340,7 +364,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add Network resource to the list
- *
+ *
* @param networkResource
*/
public void addNetworkResource(Resource networkResource) {
@@ -352,7 +376,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add Allotted resource to the list
- *
+ *
* @param allottedResource
*/
public void addAllottedResource(Resource allottedResource) {
@@ -364,7 +388,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add Config resource to the list
- *
+ *
* @param allottedResource
*/
public void addConfigResource(Resource configResource) {
@@ -378,7 +402,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
* Add resource to the list Given a ResourceDecomposition (subclass) object, add it to the Service Decomposition (in
* the appropriate category, e.g. as a VNF, Network, or Allotted Resource). As dependencies are not currently
* supported, add it to the end of any ordered lists.
- *
+ *
* @param resource
*/
public void addResource(Resource resource) {
@@ -403,7 +427,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add resource to the list
- *
+ *
* @param jsonResource
*/
public void addVnfResource(String jsonResource) throws JsonDecomposingException {
@@ -414,7 +438,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add resource to the list
- *
+ *
* @param jsonResource
*/
public void addNetworkResource(String jsonResource) throws JsonDecomposingException {
@@ -425,7 +449,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add resource to the list
- *
+ *
* @param Resource
*/
public void addAllottedResource(String jsonResource) throws JsonDecomposingException {
@@ -436,7 +460,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add resource to the list
- *
+ *
* @param Resource
*/
public void addConfigResource(String jsonResource) throws JsonDecomposingException {
@@ -449,7 +473,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
* Given a ResourceDecomposition (subclass) object, locate it in the Service Decomposition by its unique ID, and
* replace the current version with the new one. This method should support concurrency control via an
* auto-incrementing field in the ResourceDecomposition class.
- *
+ *
* @param newResource
* @return TRUE if replacement was a success
*/
@@ -474,7 +498,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Given a ResourceDecomposition as a JSON string, locate it in the Service Decomposition by its unique ID, and
* replace the current version with the new one.
- *
+ *
* @param jsonString
* @return
*/
@@ -485,7 +509,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Given a resource object ID, locate it in the Service Decomposition by its unique ID, and delete it.
- *
+ *
* @param resource
* @return TRUE if delete was a success
*/
@@ -503,7 +527,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Generic method to get List of Resource objects based on input resource's resourceType
- *
+ *
* @param resource
* @return List matching the resourceType of resource
*/
@@ -530,7 +554,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Generic method to set List of ResourceDecomposition objects
- *
+ *
* @param resources
* @return
*/
diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml
index cffb67a968..47415240f9 100644
--- a/bpmn/so-bpmn-tasks/pom.xml
+++ b/bpmn/so-bpmn-tasks/pom.xml
@@ -97,6 +97,36 @@
</executions>
</plugin>
</plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <versionRange>[2.2.0,)</versionRange>
+ </pluginExecutionFilter>
+ <action>
+ <execute>
+ <runOnIncremental>false</runOnIncremental>
+ </execute>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
<dependencyManagement>
<dependencies>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index a162088cb2..7e5cf19b21 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -45,9 +45,7 @@ import java.util.Map;
@Component
public class AAIUpdateTasks {
private static final Logger logger = LoggerFactory.getLogger(AAIUpdateTasks.class);
- private static final String ALACARTE = "aLaCarte";
- private static final String MULTI_STAGE_DESIGN_OFF = "false";
- private static final String MULTI_STAGE_DESIGN_ON = "true";
+
@Autowired
private AAIServiceInstanceResources aaiServiceInstanceResources;
@Autowired
@@ -149,8 +147,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update HeatStackId and VolumeGroup in AAI
- *
- * @param execution
*/
public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) {
try {
@@ -172,87 +168,27 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of VfModule to Assigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) {
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- vfModule.setHeatStackId("");
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVfModule", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.ASSIGNED);
}
/**
* BPMN access method to update status of VfModule to PendingActivation in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusPendingActivationVfModule(BuildingBlockExecution execution) {
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf,
- OrchestrationStatus.PENDING_ACTIVATION);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusPendingActivationVfModule", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- /**
- * BPMN access method to update status of VfModule to AssignedOrPendingActivation in AAI
- *
- * @param execution
- */
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModule(BuildingBlockExecution execution) {
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- vfModule.setHeatStackId("");
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
- if (vnf.getModelInfoGenericVnf() != null) {
- multiStageDesign = vnf.getModelInfoGenericVnf().getMultiStageDesign();
- }
- boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
- if (aLaCarte && multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf,
- OrchestrationStatus.PENDING_ACTIVATION);
- } else {
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
- }
- } catch (Exception ex) {
- logger.error(
- "Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedOrPendingActivationVfModule",
- ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.PENDING_ACTIVATION);
}
/**
* BPMN access method to update status of VfModule to Created in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) {
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.CREATED);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusCreatedVfModule", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.CREATED);
}
/**
* BPMN access method to update aaiDeactivateVfModuleRollback to true for deactivating the VfModule
- *
- * @param execution
*/
public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) {
execution.setVariable("aaiDeactivateVfModuleRollback", false);
@@ -800,4 +736,20 @@ public class AAIUpdateTasks {
}
}
+ private void updateOrchestrationStatusForVfModule(BuildingBlockExecution execution, OrchestrationStatus status) {
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ if (status.equals(OrchestrationStatus.ASSIGNED)) {
+ vfModule.setHeatStackId("");
+ }
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, status);
+ } catch (Exception ex) {
+ logger.error(
+ "Exception occurred in AAIUpdateTasks during update orchestration status to {} for " + "vf module",
+ status, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index f8a4d910f4..eead1761ea 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -169,12 +169,7 @@ public class WorkflowAction {
}
public void selectExecutionList(DelegateExecution execution) throws Exception {
- final String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
- final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
- final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST);
- final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION);
- String uri = (String) execution.getVariable(BBConstants.G_URI);
final String vnfType = (String) execution.getVariable(VNF_TYPE);
String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
final String createInstanceAction = "createInstance";
@@ -183,40 +178,34 @@ public class WorkflowAction {
List<OrchestrationFlow> orchFlows =
(List<OrchestrationFlow>) execution.getVariable(BBConstants.G_ORCHESTRATION_FLOW);
- List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
List<Resource> resourceList = new ArrayList<>();
execution.setVariable("sentSyncResponse", false);
execution.setVariable("homing", false);
execution.setVariable("calledHoming", false);
+ execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true);
try {
- ObjectMapper mapper = new ObjectMapper();
- execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true);
- ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
+ final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST);
+ ServiceInstancesRequest sIRequest =
+ new ObjectMapper().readValue(bpmnRequest, ServiceInstancesRequest.class);
RequestDetails requestDetails = sIRequest.getRequestDetails();
- boolean suppressRollback = false;
- try {
- suppressRollback = requestDetails.getRequestInfo().getSuppressRollback();
- } catch (Exception ex) {
- logger.warn("Exception in getSuppressRollback", ex);
- suppressRollback = false;
- }
- execution.setVariable("suppressRollback", suppressRollback);
- boolean isResume = false;
- if (isUriResume(uri)) {
- isResume = true;
- if (!aLaCarte) {
- logger.debug("replacing URI {}", uri);
- uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl();
- logger.debug("for RESUME with original value {}", uri);
- }
+ execution.setVariable("suppressRollback", requestDetails.getRequestInfo().getSuppressRollback());
+ String uri = (String) execution.getVariable(BBConstants.G_URI);
+ final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
+ final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
+ boolean isResume = isUriResume(uri);
+ if (!aLaCarte && isResume) {
+ logger.debug("replacing URI {}", uri);
+ uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl();
+ logger.debug("for RESUME with original value {}", uri);
}
Resource resource = extractResourceIdAndTypeFromUri(uri);
WorkflowType resourceType = resource.getResourceType();
execution.setVariable("resourceName", resourceType.toString());
String resourceId = "";
+ final String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
if (resource.isGenerated() && requestAction.equalsIgnoreCase(createInstanceAction)
&& sIRequest.getRequestDetails().getRequestInfo().getInstanceName() != null) {
resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
@@ -230,7 +219,7 @@ public class WorkflowAction {
}
execution.setVariable("resourceId", resourceId);
execution.setVariable("resourceType", resourceType);
-
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
if (isRequestMacroServiceResume(aLaCarte, resourceType, requestAction, serviceInstanceId)) {
flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
if (flowsToExecute == null) {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
index e26009a1de..e5b003a437 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
@@ -40,7 +40,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
-import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import java.util.HashMap;
@@ -258,60 +257,6 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
}
@Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleNoMultiStageTest() throws Exception {
- execution.setVariable("aLaCarte", true);
- ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("false");
- genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.ASSIGNED);
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.ASSIGNED);
- assertEquals("", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleMultiStageButNotAlacarteTest()
- throws Exception {
- execution.setVariable("aLaCarte", false);
- ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("true");
- genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.ASSIGNED);
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.ASSIGNED);
- assertEquals("", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleWithMultiStageTest() throws Exception {
- execution.setVariable("aLaCarte", true);
- ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("true");
- genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.PENDING_ACTIVATION);
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.PENDING_ACTIVATION);
- assertEquals("", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleExceptionTest() throws Exception {
- execution.setVariable("aLaCarte", true);
- doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule,
- genericVnf, OrchestrationStatus.ASSIGNED);
-
- expectedException.expect(BpmnError.class);
-
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- }
-
- @Test
public void updateOrchestrationStatusCreatedVfModuleTest() throws Exception {
doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
OrchestrationStatus.CREATED);
diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java
index 077ba24c2b..30389de742 100644
--- a/common/src/main/java/org/onap/so/client/RestClient.java
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -188,8 +188,7 @@ public abstract class RestClient {
client.register(new PayloadLoggingClientFilter(this.getMaxPayloadSize()));
}
CommonObjectMapperProvider provider = this.getCommonObjectMapperProvider();
- client.register(new JacksonJsonProvider(provider.getMapper()));
-
+ client.register(provider).register(new JacksonJsonProvider(provider.getMapper()));
metricLogClientFilter = new SOMetricLogClientFilter();
mdcSetup.setTargetEntity(getTargetEntity());
client.register(metricLogClientFilter);
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIVersion.java b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java
index 4f06b787f7..42887884db 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIVersion.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java
@@ -23,7 +23,16 @@ package org.onap.so.client.aai;
import org.onap.so.client.graphinventory.GraphInventoryVersion;
public enum AAIVersion implements GraphInventoryVersion {
- V13("v13"), V14("v14"), V15("v15"), V16("v16"), V17("v17"), V18("v18"), V19("v19");
+ V10("V10"),
+ V11("V11"),
+ V12("V12"),
+ V13("v13"),
+ V14("v14"),
+ V15("v15"),
+ V16("v16"),
+ V17("v17"),
+ V18("v18"),
+ V19("v19");
public static final AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1];
private final String value;
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeBase.java
index 7ee5bd328e..5802e9c4e8 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeBase.java
@@ -26,41 +26,51 @@ import java.util.List;
import org.onap.so.client.aai.entities.QueryStep;
import org.onap.so.client.graphinventory.GraphInventoryObjectName;
-public class DSLNode implements QueryStep {
+public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep {
- private final String nodeName;
- private final List<DSLNodeKey> nodeKeys;
- private final StringBuilder query = new StringBuilder();
- private boolean output = false;
+ protected final String nodeName;
+ protected final List<DSLNodeKey> nodeKeys;
+ protected final StringBuilder query;
+ protected boolean output = false;
- public DSLNode() {
+ public DSLNodeBase() {
this.nodeName = "";
this.nodeKeys = new ArrayList<>();
+ this.query = new StringBuilder();
}
- public DSLNode(GraphInventoryObjectName name) {
+ public DSLNodeBase(GraphInventoryObjectName name) {
this.nodeName = name.typeName();
this.nodeKeys = new ArrayList<>();
+ this.query = new StringBuilder();
query.append(nodeName);
}
- public DSLNode(GraphInventoryObjectName name, DSLNodeKey... key) {
+ public DSLNodeBase(GraphInventoryObjectName name, DSLNodeKey... key) {
this.nodeName = name.typeName();
this.nodeKeys = Arrays.asList(key);
+ this.query = new StringBuilder();
query.append(nodeName);
}
- public DSLNode output() {
+ public DSLNodeBase(DSLNodeBase<?> copy) {
+ this.nodeName = copy.nodeName;
+ this.nodeKeys = copy.nodeKeys;
+ this.query = new StringBuilder(copy.query);
+ this.output = copy.output;
+ }
+
+ public DSLOutputNode output() {
this.output = true;
- return this;
+ return new DSLOutputNode(this);
}
- public DSLNode and(DSLNodeKey... key) {
+ public T and(DSLNodeKey... key) {
this.nodeKeys.addAll(Arrays.asList(key));
- return this;
+ return (T) this;
}
@Override
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLOutputNode.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLOutputNode.java
new file mode 100644
index 0000000000..d799795650
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLOutputNode.java
@@ -0,0 +1,8 @@
+package org.onap.so.client.graphinventory.entities;
+
+public class DSLOutputNode extends DSLNodeBase<DSLOutputNode> implements Output {
+
+ public DSLOutputNode(DSLNodeBase<?> copy) {
+ super(copy);
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java
index 3056c9ca80..1fa79a714c 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java
@@ -31,17 +31,11 @@ public class DSLQuery {
}
- public DSLQuery(String dsl) {
- this.dsl = dsl;
+ public DSLQuery(DSLTraversal<? extends Output> dsl) {
+ this.dsl = dsl.get();
}
public String getDsl() {
return dsl;
}
-
- public void setDsl(String dsl) {
- this.dsl = dsl;
- }
-
-
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java
index 540472a88d..7ff6e2ed22 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java
@@ -27,35 +27,31 @@ import java.util.List;
import java.util.stream.Collectors;
import org.onap.so.client.aai.entities.QueryStep;
import org.onap.so.client.graphinventory.GraphInventoryObjectName;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import com.google.common.base.Joiner;
-
-public class DSLQueryBuilder<S, E> implements QueryStep {
+public class DSLQueryBuilder<S, E> {
private List<QueryStep> steps = new ArrayList<>();
private String suffix = "";
- private static final Logger logger = LoggerFactory.getLogger(DSLQueryBuilder.class);
- public DSLQueryBuilder() {
+ protected DSLQueryBuilder() {
}
- public DSLQueryBuilder(DSLNode node) {
+ protected DSLQueryBuilder(QueryStep node) {
steps.add(node);
}
- public DSLQueryBuilder<S, DSLNode> node(DSLNode node) {
+ public <T> DSLQueryBuilder<S, DSLNodeBase<?>> node(DSLNodeBase<?> node) {
steps.add(node);
- return (DSLQueryBuilder<S, DSLNode>) this;
+ return (DSLQueryBuilder<S, DSLNodeBase<?>>) this;
}
- public DSLQueryBuilder<S, E> output() {
+ public DSLQueryBuilder<S, Node> output() {
Object obj = steps.get(steps.size() - 1);
- if (obj instanceof DSLNode) {
- ((DSLNode) steps.get(steps.size() - 1)).output();
+ if (obj instanceof DSLNodeBase) {
+ ((DSLNodeBase) steps.get(steps.size() - 1)).output();
} else if (obj.getClass().getName().contains("$$Lambda$")) {
// process lambda expressions
for (Field f : obj.getClass().getDeclaredFields()) {
@@ -63,27 +59,28 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
Object o;
try {
o = f.get(obj);
- if (o instanceof DSLQueryBuilder && ((DSLQueryBuilder) o).steps.get(0) instanceof DSLNode) {
- ((DSLNode) ((DSLQueryBuilder) o).steps.get(0)).output();
+ if (o instanceof DSLQueryBuilder && ((DSLQueryBuilder) o).steps.get(0) instanceof DSLNodeBase) {
+ ((DSLNodeBase) ((DSLQueryBuilder) o).steps.get(0)).output();
}
} catch (IllegalArgumentException | IllegalAccessException e) {
- logger.error("Exception occured", e);
}
f.setAccessible(false);
break;
}
}
- return this;
+ return (DSLQueryBuilder<S, Node>) this;
}
- public <E2> DSLQueryBuilder<S, E2> union(final DSLQueryBuilder<?, E2>... union) {
+ @SafeVarargs
+ public final <E2> DSLQueryBuilder<S, E2> union(final DSLQueryBuilder<?, E2>... union) {
List<DSLQueryBuilder<?, ?>> unions = Arrays.asList(union);
steps.add(() -> {
StringBuilder query = new StringBuilder();
- query.append("> [ ").append(
- Joiner.on(", ").join(unions.stream().map(item -> item.build()).collect(Collectors.toList())))
+ query.append("> [ ")
+ .append(Joiner.on(", ")
+ .join(unions.stream().map(item -> item.compile()).collect(Collectors.toList())))
.append(" ]");
return query.toString();
});
@@ -95,7 +92,7 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
steps.add(() -> {
StringBuilder query = new StringBuilder();
- query.append(where.build()).append(")");
+ query.append(where.compile()).append(")");
String result = query.toString();
if (!result.startsWith(">")) {
result = "> " + result;
@@ -105,22 +102,22 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
return this;
}
- public DSLQueryBuilder<S, E> to(DSLQueryBuilder<?, ?> to) {
+ public <E2> DSLQueryBuilder<S, E2> to(DSLQueryBuilder<?, E2> to) {
steps.add(() -> {
StringBuilder query = new StringBuilder();
- query.append("> ").append(to.build());
+ query.append("> ").append(to.compile());
return query.toString();
});
- return this;
+ return (DSLQueryBuilder<S, E2>) this;
}
public DSLQueryBuilder<S, E> to(GraphInventoryObjectName name) {
- return to(__.node(name));
+ return (DSLQueryBuilder<S, E>) to(__.node(name));
}
public DSLQueryBuilder<S, E> to(GraphInventoryObjectName name, DSLNodeKey... key) {
- return to(__.node(name, key));
+ return (DSLQueryBuilder<S, E>) to(__.node(name, key));
}
public DSLQueryBuilder<S, E> limit(int limit) {
@@ -128,24 +125,19 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
return this;
}
- @Override
- public String build() {
- return compile();
+ public DSLTraversal<E> build() {
+ return new DSLTraversal<>(compile());
}
@Override
public String toString() {
- return build();
+ return build().get();
}
@Override
public boolean equals(Object o) {
if (o != null) {
- if (o instanceof QueryStep) {
- return ((QueryStep) o).build().equals(this.build());
- } else if (o instanceof String) {
- return o.equals(this.build());
- }
+ return o.toString().equals(toString());
}
return false;
}
@@ -153,11 +145,11 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
@Override
public int hashCode() {
- return build().hashCode();
+ return compile().hashCode();
}
private String compile() {
- return Joiner.on(" ").join(steps.stream().map(item -> item.build()).collect(Collectors.toList())) + suffix;
+ return String.join(" ", steps.stream().map(item -> item.build()).collect(Collectors.toList())) + suffix;
}
protected QueryStep getFirst() {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLStartNode.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLStartNode.java
new file mode 100644
index 0000000000..fb0772726f
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLStartNode.java
@@ -0,0 +1,19 @@
+package org.onap.so.client.graphinventory.entities;
+
+import org.onap.so.client.graphinventory.GraphInventoryObjectName;
+
+public class DSLStartNode extends DSLNodeBase<DSLStartNode> implements Start {
+
+
+ public DSLStartNode() {
+ super();
+ }
+
+ public DSLStartNode(GraphInventoryObjectName name) {
+ super(name);
+ }
+
+ public DSLStartNode(GraphInventoryObjectName name, DSLNodeKey... key) {
+ super(name, key);
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLTraversal.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLTraversal.java
new file mode 100644
index 0000000000..40f80463b2
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLTraversal.java
@@ -0,0 +1,33 @@
+package org.onap.so.client.graphinventory.entities;
+
+public class DSLTraversal<T> {
+
+ private final String traversal;
+
+ protected DSLTraversal(String traversal) {
+ this.traversal = traversal;
+ }
+
+ public String get() {
+ return traversal;
+ }
+
+ @Override
+ public String toString() {
+ return traversal;
+ }
+
+ @Override
+ public int hashCode() {
+ return traversal.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o != null) {
+ return this.toString().equals(o);
+ }
+ return false;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Node.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Node.java
new file mode 100644
index 0000000000..cdaae7d91f
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/Node.java
@@ -0,0 +1,5 @@
+package org.onap.so.client.graphinventory.entities;
+
+public interface Node extends Output {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Output.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Output.java
new file mode 100644
index 0000000000..06b8b65984
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/Output.java
@@ -0,0 +1,7 @@
+package org.onap.so.client.graphinventory.entities;
+
+import org.onap.so.client.aai.entities.QueryStep;
+
+public interface Output extends QueryStep {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Start.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Start.java
new file mode 100644
index 0000000000..c649e36eca
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/Start.java
@@ -0,0 +1,7 @@
+package org.onap.so.client.graphinventory.entities;
+
+import org.onap.so.client.aai.entities.QueryStep;
+
+public interface Start extends QueryStep {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/TraversalBuilder.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/TraversalBuilder.java
new file mode 100644
index 0000000000..0af29f78e6
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/TraversalBuilder.java
@@ -0,0 +1,17 @@
+package org.onap.so.client.graphinventory.entities;
+
+public class TraversalBuilder {
+
+
+ private TraversalBuilder() {
+
+ }
+
+ public static DSLQueryBuilder<Start, Start> fragment(Start node) {
+ return new DSLQueryBuilder<>(node);
+ }
+
+ public static DSLQueryBuilder<Output, Output> traversal(Output node) {
+ return new DSLQueryBuilder<>(node);
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java
index 87d4d84cac..ca0bd9e00d 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java
@@ -32,24 +32,25 @@ public class __ {
return new DSLQueryBuilder<>();
}
- public static <A> DSLQueryBuilder<A, A> start(DSLNode node) {
+ public static <A> DSLQueryBuilder<A, A> start(Start node) {
return new DSLQueryBuilder<>(node);
}
- public static DSLQueryBuilder<DSLNode, DSLNode> node(GraphInventoryObjectName name) {
+ public static DSLQueryBuilder<DSLStartNode, DSLStartNode> node(GraphInventoryObjectName name) {
- return __.<DSLNode>start(new DSLNode(name));
+ return __.<DSLStartNode>start(new DSLStartNode(name));
}
- public static DSLQueryBuilder<DSLNode, DSLNode> node(GraphInventoryObjectName name, DSLNodeKey... key) {
- return __.<DSLNode>start(new DSLNode(name, key));
+ public static DSLQueryBuilder<DSLStartNode, DSLStartNode> node(GraphInventoryObjectName name, DSLNodeKey... key) {
+ return __.<DSLStartNode>start(new DSLStartNode(name, key));
}
public static DSLNodeKey key(String keyName, Object... value) {
return new DSLNodeKey(keyName, value);
}
- public static <A, B> DSLQueryBuilder<A, B> union(final DSLQueryBuilder<?, B>... traversal) {
+ @SafeVarargs
+ public static final <A, B> DSLQueryBuilder<A, B> union(final DSLQueryBuilder<?, B>... traversal) {
return __.<A>identity().union(traversal);
}
diff --git a/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java
index c55370f7dc..334e0f7231 100644
--- a/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java
@@ -20,13 +20,16 @@
package org.onap.so.client.policy;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-public class CommonObjectMapperProvider {
+@Provider
+public class CommonObjectMapperProvider implements ContextResolver<ObjectMapper> {
protected ObjectMapper mapper;
@@ -43,4 +46,10 @@ public class CommonObjectMapperProvider {
public ObjectMapper getMapper() {
return mapper;
}
+
+ @Override
+ public ObjectMapper getContext(Class<?> type) {
+
+ return mapper;
+ }
}
diff --git a/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java b/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
index fb45652d53..1a1a7d124e 100644
--- a/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
@@ -23,17 +23,19 @@ package org.onap.so.client.aai;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
-import org.onap.so.client.graphinventory.entities.DSLNode;
import org.onap.so.client.graphinventory.entities.DSLNodeKey;
import org.onap.so.client.graphinventory.entities.DSLQueryBuilder;
+import org.onap.so.client.graphinventory.entities.DSLStartNode;
+import org.onap.so.client.graphinventory.entities.Output;
+import org.onap.so.client.graphinventory.entities.Start;
+import org.onap.so.client.graphinventory.entities.TraversalBuilder;
import org.onap.so.client.graphinventory.entities.__;
public class DSLQueryBuilderTest {
-
@Test
public void whereTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.CLOUD_REGION,
+ DSLQueryBuilder<Start, Start> builder = TraversalBuilder.fragment(new DSLStartNode(AAIObjectType.CLOUD_REGION,
__.key("cloud-owner", "att-nc"), __.key("cloud-region-id", "test")));
builder.to(__.node(AAIObjectType.VLAN_TAG))
@@ -42,13 +44,13 @@ public class DSLQueryBuilderTest {
assertEquals("cloud-region('cloud-owner', 'att-nc')('cloud-region-id', 'test') > "
+ "vlan-tag (> owning-entity('owning-entity-name', 'name')) > " + "vlan-tag*('vlan-id-outer', '108')",
- builder.build());
+ builder.build().get());
}
@Test
public void unionTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder =
- new DSLQueryBuilder<>(new DSLNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
+ DSLQueryBuilder<Output, Output> builder = TraversalBuilder
+ .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()),
__.node(AAIObjectType.VSERVER)
@@ -56,53 +58,53 @@ public class DSLQueryBuilderTest {
assertEquals(
"generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]",
- builder.build());
+ builder.build().get());
}
@Test
public void whereUnionTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder =
- new DSLQueryBuilder<>(new DSLNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
+ DSLQueryBuilder<Output, Output> builder = TraversalBuilder
+ .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
builder.where(__.union(__.node(AAIObjectType.PSERVER, __.key("hostname", "hostname1")),
__.node(AAIObjectType.VSERVER).to(__.node(AAIObjectType.PSERVER, __.key("hostname", "hostname1")))));
assertEquals("generic-vnf*('vnf-id', 'vnfId') (> [ pserver('hostname', 'hostname1'), "
- + "vserver > pserver('hostname', 'hostname1') ])", builder.build());
+ + "vserver > pserver('hostname', 'hostname1') ])", builder.build().get());
}
@Test
public void notNullTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(
- new DSLNode(AAIObjectType.CLOUD_REGION, __.key("cloud-owner", "", "null").not()).output());
+ DSLQueryBuilder<Output, Output> builder = TraversalBuilder.traversal(
+ new DSLStartNode(AAIObjectType.CLOUD_REGION, __.key("cloud-owner", "", "null").not()).output());
- assertEquals("cloud-region* !('cloud-owner', ' ', ' null ')", builder.build());
+ assertEquals("cloud-region* !('cloud-owner', ' ', ' null ')", builder.build().get());
}
@Test
public void shortCutToTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder =
- new DSLQueryBuilder<>(new DSLNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
+ DSLQueryBuilder<Output, Output> builder = TraversalBuilder
+ .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')",
- builder.build());
+ builder.build().get());
}
@Test
public void limitTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder =
- new DSLQueryBuilder<>(new DSLNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
+ DSLQueryBuilder<Output, Output> builder = TraversalBuilder
+ .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
builder.to(AAIObjectType.P_INTERFACE).limit(2).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id') LIMIT 2",
- builder.build());
+ builder.build().get());
}
@Test
public void equalsTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder =
- new DSLQueryBuilder<>(new DSLNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
+ DSLQueryBuilder<Output, Output> builder = TraversalBuilder
+ .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
assertTrue(
@@ -110,10 +112,9 @@ public class DSLQueryBuilderTest {
assertTrue(builder.equals(builder));
}
-
@Test
public void mixedTypeTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.CLOUD_REGION,
+ DSLQueryBuilder<Start, Start> builder = TraversalBuilder.fragment(new DSLStartNode(AAIObjectType.CLOUD_REGION,
__.key("cloud-owner", "owner"), __.key("cloud-region-id", "id")));
builder.to(__.node(AAIObjectType.VLAN_TAG, __.key("vlan-id-outer", 167), __.key("my-boolean", true)).output());
assertTrue(builder.equals(
@@ -122,19 +123,19 @@ public class DSLQueryBuilderTest {
@Test
public void outputOnNodeLambdasTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder =
- new DSLQueryBuilder<>(new DSLNode(AAIObjectType.L_INTERFACE, new DSLNodeKey("interface-id", "myId")));
+ DSLQueryBuilder<Start, Start> builder = TraversalBuilder
+ .fragment(new DSLStartNode(AAIObjectType.L_INTERFACE, new DSLNodeKey("interface-id", "myId")));
builder.to(AAIObjectType.VSERVER, __.key("vserver-name", "myName")).output().to(AAIObjectType.P_INTERFACE)
.output();
assertEquals("l-interface('interface-id', 'myId') > vserver*('vserver-name', 'myName') > p-interface*",
- builder.build());
+ builder.build().get());
}
@Test
public void skipOutputOnUnionTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder =
- new DSLQueryBuilder<>(new DSLNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
+ DSLQueryBuilder<Output, Output> builder = TraversalBuilder
+ .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()),
__.node(AAIObjectType.VSERVER)
@@ -143,6 +144,6 @@ public class DSLQueryBuilderTest {
assertEquals(
"generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]",
- builder.build());
+ builder.build().get());
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
index 0afc272b0a..168f82bdf3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
@@ -23,9 +23,7 @@ package org.onap.so.apihandlerinfra;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.PostConstruct;
-import javax.servlet.ServletConfig;
import javax.ws.rs.ApplicationPath;
-import javax.ws.rs.core.Context;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletProperties;
import org.onap.logging.filter.base.Constants;
@@ -96,6 +94,7 @@ public class JerseyConfiguration extends ResourceConfig {
// this registration seems to be needed to get predictable
// execution behavior for the above JSON Exception Mappers
register(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.class);
+
register(ModelDistributionRequest.class);
property(ServletProperties.FILTER_FORWARD_ON_404, true);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/AAIDeserializeTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/AAIDeserializeTest.java
new file mode 100644
index 0000000000..e6409fab87
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/AAIDeserializeTest.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra;
+
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static org.junit.Assert.assertEquals;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import javax.ws.rs.core.MediaType;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.aai.domain.yang.Tenant;
+import org.onap.so.client.aai.AAIVersion;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpHeaders;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class AAIDeserializeTest extends BaseTest {
+
+ private final ObjectMapper mapper = new ObjectMapper();
+
+ @Autowired
+ private MsoRequest msoReq;
+
+ @Value("${wiremock.server.port}")
+ private String wiremockPort;
+
+ @Before
+ public void beforeClass() {
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ }
+
+ public String inputStream(String JsonInput) throws IOException {
+ JsonInput = "src/test/resources/MsoRequestTest" + JsonInput;
+ return new String(Files.readAllBytes(Paths.get(JsonInput)));
+ }
+
+ @Test
+ public void doNotFailOnUnknownPropertiesTest() throws JsonParseException, JsonMappingException, IOException {
+ wireMockServer.stubFor(get(("/aai/" + AAIVersion.LATEST
+ + "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/mdt1/tenants/tenant/88a6ca3ee0394ade9403f075db23167e"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("aai/UnknownProperty.json")
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+ ServiceInstancesRequest sir = mapper.readValue(inputStream("/AAI.json"), ServiceInstancesRequest.class);
+ String tenantId = "88a6ca3ee0394ade9403f075db23167e";
+ String tenantNameFromAAI = "testTenantName";
+ String cloudOwner = "cloudOwner";
+ sir.getRequestDetails().getCloudConfiguration().setCloudOwner(cloudOwner);
+ Tenant tenant = new Tenant();
+ tenant.setTenantId(tenantId);
+ tenant.setTenantName(tenantNameFromAAI);
+ String tenantName = msoReq.getTenantNameFromAAI(sir);
+ assertEquals(tenantNameFromAAI, tenantName);
+ }
+
+}
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/AAI.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/AAI.json
new file mode 100644
index 0000000000..455d73a13b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/AAI.json
@@ -0,0 +1,132 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelName": "model-name",
+ "modelVersion": "10"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "owningEntity": {
+ "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+ "owningEntityName": "PACKET CORE"
+ },
+ "project": {
+ "projectName": "{some project name}"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "{some subscriber id}"
+ },
+ "requestInfo": {
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "xxxxxx"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "type",
+ "aLaCarte": false,
+ "userParams": [
+ {
+ "service": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelName": "model-name",
+ "modelVersion": "10"
+ },
+ "instanceParams": [],
+ "resources": {
+ "vnfs": [
+ {
+ "modelInfo": {
+ "modelCustomizationName": "model-name 0",
+ "modelName": "model-name",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "platform": {
+ "platformName": "someValue"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "someValue"
+ },
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "instanceParams": [
+ {
+ "instanceName": "someVnfInstanceName"
+ }
+ ],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelName": "name._base__BV..module-0",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
+ },
+ "instanceParams": [
+ {
+ "vmx_int_net_len": "24",
+ "asn": "someValue"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "name._vRE_BV..module-1",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8",
+ "modelType": "vfModule"
+ },
+ "instanceParams": [
+ {
+ "availability_zone_0": "mtpocdv-kvm-az01",
+ "vre_a_volume_size_0": "100"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "name._vRE_BV..module-1",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
+ },
+ "instanceParams": [
+ {
+ "availability_zone_0": "mtpocdv-kvm-az01",
+ "vre_a_volume_size_0": "50"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "name.BV..module-2",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969"
+ },
+ "instanceParams": [
+ {
+ "availability_zone_0": "mtpocdv-kvm-az01",
+ "vmx_vpfe_int_ip_0": "192.168.0.16"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/UnknownProperty.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/UnknownProperty.json
new file mode 100644
index 0000000000..e606f8aa30
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/UnknownProperty.json
@@ -0,0 +1 @@
+{"tenant-id":"78491aac74be4fab9873db114774b475","tenant-name":"testTenantName", "test":"test", "parent-id": "25239", "tenant-context":"Development","resource-version":"1581690782612"} \ No newline at end of file