aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java148
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java34
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java123
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java56
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java53
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java46
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java37
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java37
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java61
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java102
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java83
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java163
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java148
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java187
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java58
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java28
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java59
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java96
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java142
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java58
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java60
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java61
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java28
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java159
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java113
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java77
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java77
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java49
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java50
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java94
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java64
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java84
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java45
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java82
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java75
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java82
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java32
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java66
60 files changed, 2712 insertions, 673 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
index 612051f903..55f898742c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
@@ -1,18 +1,23 @@
-/*
- * Copyright (C) 2018 Bell Canada.
- *
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) Copyright (C) 2018 Bell Canada.
+ * ================================================================================
* 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.bpmn.buildingblock;
import java.util.Map;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
index 0190f3df56..e83c27c400 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
@@ -23,13 +23,13 @@ package org.onap.so.bpmn.buildingblock;
import static org.apache.commons.lang3.StringUtils.*;
import java.time.Duration;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.commons.lang.SerializationUtils;
import org.camunda.bpm.engine.delegate.BpmnError;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.json.JSONArray;
import org.json.JSONObject;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -58,7 +58,14 @@ import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.sniro.SniroClient;
import static org.onap.so.client.sniro.SniroValidator.*;
+import org.onap.so.client.sniro.beans.Demand;
+import org.onap.so.client.sniro.beans.LicenseInfo;
+import org.onap.so.client.sniro.beans.ModelInfo;
+import org.onap.so.client.sniro.beans.PlacementInfo;
+import org.onap.so.client.sniro.beans.RequestInfo;
+import org.onap.so.client.sniro.beans.ServiceInfo;
import org.onap.so.client.sniro.beans.SniroManagerRequest;
+import org.onap.so.client.sniro.beans.SubscriberInfo;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
@@ -107,7 +114,7 @@ public class SniroHomingV2 {
* @param execution
*/
public void callSniro(BuildingBlockExecution execution){
- log.trace("Started Sniro Homing Call Sniro");
+ log.debug("Started Sniro Homing Call Sniro");
try{
GeneralBuildingBlock bb = execution.getGeneralBuildingBlock();
@@ -123,27 +130,27 @@ public class SniroHomingV2 {
timeout = env.getProperty("sniro.manager.timeout", "PT30M");
}
- SniroManagerRequest request = new SniroManagerRequest(); //TODO Add additional pojos for each section
+ SniroManagerRequest request = new SniroManagerRequest();
- JSONObject requestInfo = buildRequestInfo(requestId, timeout);
- request.setRequestInformation(requestInfo.toString());
+ RequestInfo requestInfo = buildRequestInfo(requestId, timeout);
+ request.setRequestInformation(requestInfo);
- JSONObject serviceInfo = buildServiceInfo(serviceInstance);
- request.setServiceInformation(serviceInfo.toString());
+ ServiceInfo serviceInfo = buildServiceInfo(serviceInstance);
+ request.setServiceInformation(serviceInfo);
- JSONObject placementInfo = buildPlacementInfo(customer, requestParams);
+ PlacementInfo placementInfo = buildPlacementInfo(customer, requestParams);
- JSONArray placementDemands = buildPlacementDemands(serviceInstance);
- placementInfo.put("placementDemands", placementDemands);
- request.setPlacementInformation(placementInfo.toString());
+ List<Demand> placementDemands = buildPlacementDemands(serviceInstance);
+ placementInfo.setDemands(placementDemands);
+ request.setPlacementInformation(placementInfo);
- JSONObject licenseInfo = new JSONObject();
+ LicenseInfo licenseInfo = new LicenseInfo();
- JSONArray licenseDemands = buildLicenseDemands(serviceInstance);
- licenseInfo.put("licenseDemands", licenseDemands);
- request.setLicenseInformation(licenseInfo.toString());
+ List<Demand> licenseDemands = buildLicenseDemands(serviceInstance);
+ licenseInfo.setDemands(licenseDemands);
+ request.setLicenseInformation(licenseInfo);
- if(placementDemands.length() > 0 || licenseDemands.length() > 0){
+ if(placementDemands.size() > 0 || licenseDemands.size() > 0){
client.postDemands(request);
}else{
log.debug(SERVICE_MISSING_DATA + "resources eligible for homing or licensing");
@@ -157,10 +164,13 @@ public class SniroHomingV2 {
log.trace("Completed Sniro Homing Call Sniro");
}catch(BpmnError e){
+ log.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
}catch(BadResponseException e){
+ log.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
}catch(Exception e){
+ log.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while preparing sniro request: " + e.getMessage());
}
}
@@ -204,10 +214,13 @@ public class SniroHomingV2 {
log.trace("Completed Sniro Homing Process Solution");
}catch(BpmnError e){
+ log.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
}catch(BadResponseException e){
+ log.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
}catch(Exception e){
+ log.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage());
}
}
@@ -217,18 +230,21 @@ public class SniroHomingV2 {
*
* @throws Exception
*/
- private JSONObject buildRequestInfo(String requestId, String timeout) throws Exception{
+ private RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception{
log.trace("Building request information");
- JSONObject requestInfo = new JSONObject();
+ RequestInfo requestInfo = new RequestInfo();
if(requestId != null){
String host = env.getProperty("mso.workflow.message.endpoint");
String callbackUrl = host + "/" + UriUtils.encodePathSegment("SNIROResponse", "UTF-8") + "/" + UriUtils.encodePathSegment(requestId, "UTF-8");
Duration d = Duration.parse(timeout);
- long timeoutSeconds = d.getSeconds();
- requestInfo.put("transactionId", requestId).put("requestId", requestId).put("callbackUrl", callbackUrl).put("sourceId", "mso").put("requestType", "create")
- .put("timeout", timeoutSeconds);
+ requestInfo.setTransactionId(requestId);
+ requestInfo.setRequestId(requestId);
+ requestInfo.setCallbackUrl(callbackUrl);
+ requestInfo.setRequestType("create");
+ requestInfo.setTimeout(d.getSeconds());
+
} else{
throw new BpmnError(UNPROCESSABLE, "Request Context does not contain: requestId");
}
@@ -239,16 +255,19 @@ public class SniroHomingV2 {
* Builds the request information section for the homing/licensing request
*
*/
- private JSONObject buildServiceInfo(ServiceInstance serviceInstance){
+ private ServiceInfo buildServiceInfo(ServiceInstance serviceInstance){
log.trace("Building service information");
- JSONObject info = new JSONObject();
+ ServiceInfo info = new ServiceInfo();
ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance();
if(isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())){
- info.put("serviceInstanceId", serviceInstance.getServiceInstanceId());
+ info.setServiceInstanceId(serviceInstance.getServiceInstanceId());
if(modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0){ //temp solution
- info.put("serviceName", modelInfo.getServiceType());
+ info.setServiceName(modelInfo.getServiceType());
+ }
+ if(modelInfo.getServiceRole() != null){
+ info.setServiceRole(modelInfo.getServiceRole());
}
- info.put("modelInfo", buildModelInfo(serviceInstance.getModelInfoServiceInstance()));
+ info.setModelInfo(buildModelInfo(modelInfo));
}else{
throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + MODEL_VERSION_ID + ", " + MODEL_INVARIANT_ID);
}
@@ -259,14 +278,18 @@ public class SniroHomingV2 {
* Builds initial section of placement info for the homing/licensing request
*
*/
- private JSONObject buildPlacementInfo(Customer customer, RequestParameters requestParams){
- JSONObject placementInfo = new JSONObject();
+ private PlacementInfo buildPlacementInfo(Customer customer, RequestParameters requestParams){
+ PlacementInfo placementInfo = new PlacementInfo();
if(customer != null){
log.debug("Adding subscriber to placement information");
- placementInfo.put("subscriberInfo", new JSONObject().put("globalSubscriberId", customer.getGlobalCustomerId()).put("subscriberName", customer.getSubscriberName()).put("subscriberCommonSiteId", customer.getSubscriberCommonSiteId()));
+ SubscriberInfo subscriber = new SubscriberInfo();
+ subscriber.setGlobalSubscriberId(customer.getGlobalCustomerId());
+ subscriber.setSubscriberName(customer.getSubscriberName());
+ subscriber.setSubscriberCommonSiteId(customer.getSubscriberCommonSiteId());
+ placementInfo.setSubscriberInfo(subscriber);
if(requestParams != null){
log.debug("Adding request parameters to placement information");
- placementInfo.put("requestParameters", new JSONObject(requestParams.toJsonString()));
+ placementInfo.setRequestParameters(requestParams.toJsonString());
}
}else{
throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "customer");
@@ -279,9 +302,9 @@ public class SniroHomingV2 {
* Builds the placement demand list for the homing/licensing request
*
*/
- private JSONArray buildPlacementDemands(ServiceInstance serviceInstance){
+ private List<Demand> buildPlacementDemands(ServiceInstance serviceInstance){
log.trace("Building placement information demands");
- JSONArray placementDemands = new JSONArray();
+ List<Demand> placementDemands = new ArrayList<Demand>();
List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources();
if(!allottedResourceList.isEmpty()){
@@ -290,9 +313,9 @@ public class SniroHomingV2 {
if(isBlank(ar.getId())){
ar.setId(UUID.randomUUID().toString());
}
- JSONObject demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource());
+ Demand demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource());
addCandidates(ar, demand);
- placementDemands.put(demand);
+ placementDemands.add(demand);
}
}
List<VpnBondingLink> vpnBondingLinkList = serviceInstance.getVpnBondingLinks();
@@ -304,9 +327,9 @@ public class SniroHomingV2 {
if(isBlank(sp.getId())){
sp.setId(UUID.randomUUID().toString());
}
- JSONObject demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy());
+ Demand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy());
addCandidates(sp, demand);
- placementDemands.put(demand);
+ placementDemands.add(demand);
}
}
}
@@ -317,15 +340,15 @@ public class SniroHomingV2 {
* Builds the license demand list for the homing/licensing request
*
*/
- private JSONArray buildLicenseDemands(ServiceInstance serviceInstance){
+ private List<Demand> buildLicenseDemands(ServiceInstance serviceInstance){
log.trace("Building license information");
- JSONArray licenseDemands = new JSONArray();
+ List<Demand> licenseDemands = new ArrayList<Demand>();
List<GenericVnf> vnfList = serviceInstance.getVnfs();
if(!vnfList.isEmpty()){
log.debug("Adding vnfs to license demands list");
for(GenericVnf vnf : vnfList){
- JSONObject demand = buildDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf());
- licenseDemands.put(demand);
+ Demand demand = buildDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf());
+ licenseDemands.add(demand);
}
}
return licenseDemands;
@@ -335,13 +358,13 @@ public class SniroHomingV2 {
* Builds a single demand object
*
*/
- private JSONObject buildDemand(String id, ModelInfoMetadata metadata){
+ private Demand buildDemand(String id, ModelInfoMetadata metadata){
log.debug("Building demand for service or resource: " + id);
- JSONObject demand = new JSONObject();
+ Demand demand = new Demand();
if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){
- demand.put(SERVICE_RESOURCE_ID, id);
- demand.put(RESOURCE_MODULE_NAME, metadata.getModelInstanceName());
- demand.put(RESOURCE_MODEL_INFO, buildModelInfo(metadata));
+ demand.setServiceResourceId(id);
+ demand.setResourceModuleName(metadata.getModelInstanceName());
+ demand.setModelInfo(buildModelInfo(metadata));
}else{
throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName");
}
@@ -352,12 +375,15 @@ public class SniroHomingV2 {
* Builds the resource model info section
*
*/
- private JSONObject buildModelInfo(ModelInfoMetadata metadata){
- JSONObject object = new JSONObject();
+ private ModelInfo buildModelInfo(ModelInfoMetadata metadata){
+ ModelInfo object = new ModelInfo();
String invariantUuid = metadata.getModelInvariantUuid();
String modelUuid = metadata.getModelUuid();
if(isNotBlank(invariantUuid) && isNotBlank(modelUuid)){
- object.put(MODEL_INVARIANT_ID, invariantUuid).put(MODEL_VERSION_ID, modelUuid).put(MODEL_NAME, metadata.getModelName()).put(MODEL_VERSION, metadata.getModelVersion());
+ object.setModelInvariantId(invariantUuid);
+ object.setModelVersionId(modelUuid);
+ object.setModelName(metadata.getModelName());
+ object.setModelVersion(metadata.getModelVersion());
}else if(isNotBlank(invariantUuid)){
throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_VERSION_ID);
}else{
@@ -370,14 +396,34 @@ public class SniroHomingV2 {
* Adds required, excluded, and existing candidates to a demand
*
*/
- private void addCandidates(SolutionCandidates candidates, JSONObject demand){
+ private void addCandidates(SolutionCandidates candidates, Demand demand){
List<Candidate> required = candidates.getRequiredCandidates();
List<Candidate> excluded = candidates.getExcludedCandidates();
if(!required.isEmpty()){
- demand.put("requiredCandidates", required);
+ List<org.onap.so.client.sniro.beans.Candidate> cans = new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
+ for(Candidate c:required){
+ org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
+ org.onap.so.client.sniro.beans.CandidateType type = new org.onap.so.client.sniro.beans.CandidateType();
+ type.setName(c.getCandidateType().getName());
+ can.setCandidateType(type);
+ can.setCandidates(c.getCandidates());
+ can.setCloudOwner(c.getCloudOwner());
+ cans.add(can);
+ }
+ demand.setRequiredCandidates(cans);
}
if(!excluded.isEmpty()){
- demand.put("excludedCandidates", excluded);
+ List<org.onap.so.client.sniro.beans.Candidate> cans = new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
+ for(Candidate c:excluded){
+ org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
+ org.onap.so.client.sniro.beans.CandidateType type = new org.onap.so.client.sniro.beans.CandidateType();
+ type.setName(c.getCandidateType().getName());
+ can.setCandidateType(type);
+ can.setCandidates(c.getCandidates());
+ can.setCloudOwner(c.getCloudOwner());
+ cans.add(can);
+ }
+ demand.setExcludedCandidates(cans);
}
//TODO support existing candidates
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
index 887c51e179..4a3cb01b74 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
@@ -20,8 +20,13 @@
package org.onap.so.bpmn.infrastructure.aai.tasks;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
import org.camunda.bpm.engine.delegate.BpmnError;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -52,6 +57,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
@@ -78,6 +84,8 @@ public class AAICreateTasks {
private AAIVpnBindingResources aaiVpnBindingResources;
@Autowired
private AAIConfigurationResources aaiConfigurationResources;
+ @Autowired
+ private Environment env;
public void createServiceInstance(BuildingBlockExecution execution) {
try {
@@ -354,6 +362,41 @@ public class AAICreateTasks {
* @param execution
* @throws Exception
*/
+ public void connectVnfToCloudRegion(BuildingBlockExecution execution) {
+ try {
+ boolean cloudRegionsToSkip = false;
+ String[] cloudRegions = env.getProperty("mso.bpmn.cloudRegionIdsToSkipAddingVnfEdgesTo", String[].class);
+ if (cloudRegions != null){
+ cloudRegionsToSkip = Arrays.stream(cloudRegions).anyMatch(execution.getGeneralBuildingBlock().getCloudRegion().getLcpCloudRegionId()::equals);
+ }
+ if(!cloudRegionsToSkip) {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ aaiVnfResources.connectVnfToCloudRegion(vnf, execution.getGeneralBuildingBlock().getCloudRegion());
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to establish relationships in AAI
+ * @param execution
+ * @throws Exception
+ */
+ public void connectVnfToTenant(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ aaiVnfResources.connectVnfToTenant(vnf, execution.getGeneralBuildingBlock().getCloudRegion());
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * BPMN access method to establish relationships in AAI
+ * @param execution
+ * @throws Exception
+ */
public void connectNetworkToNetworkCollectionServiceInstance(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java
index 0079b351f2..46ff8495f9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java
@@ -29,6 +29,7 @@ import org.modelmapper.PropertyMap;
import org.onap.aai.domain.yang.NetworkPolicy;
import org.onap.aai.domain.yang.RouteTableReference;
import org.onap.aai.domain.yang.RouteTargets;
+import org.onap.aai.domain.yang.Subnet;
import org.onap.aai.domain.yang.VpnBinding;
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -222,4 +223,28 @@ public class AAIQueryTasks {
}
return mappedRouteTargets;
}
+
+ public void querySubnet(BuildingBlockExecution execution) {
+ try {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
+ execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
+ Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
+ if (!networkRelationships.isPresent()) {
+ throw (new Exception(ERROR_MSG));
+ }
+ List<AAIResourceUri> subnetsUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.SUBNET);
+
+ if(!subnetsUriList.isEmpty()) {
+ for(AAIResourceUri subnetUri : subnetsUriList) {
+ Optional<Subnet> oSubnet = aaiNetworkResources.getSubnet(subnetUri);
+ if(oSubnet.isPresent()) {
+ l3network.getSubnets().add(modelMapper.map(oSubnet.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet.class));
+ }
+ }
+ }
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
} \ No newline at end of file
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 38261c0f1a..ed6379a6a4 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
@@ -156,7 +156,9 @@ public class AAIUpdateTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
String heatStackId = execution.getVariable("heatStackId");
-
+ if (heatStackId == null) {
+ heatStackId = "";
+ }
VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
CloudRegion cloudRegion = gBBInput.getCloudRegion();
volumeGroup.setHeatStackId(heatStackId);
@@ -320,6 +322,9 @@ public class AAIUpdateTasks {
public void updateHeatStackIdVfModule(BuildingBlockExecution execution) {
try {
String heatStackId = execution.getVariable("heatStackId");
+ if (heatStackId == null) {
+ heatStackId = "";
+ }
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
vfModule.setHeatStackId(heatStackId);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java
index bc3845d760..4c531d46f9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java
@@ -21,8 +21,8 @@
package org.onap.so.bpmn.infrastructure.adapter.network.tasks;
import java.util.Map;
-import java.util.Optional;
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
@@ -30,24 +30,23 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.NetworkAdapterResources;
-import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class NetworkAdapterCreateTasks {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkAdapterCreateTasks.class);
@Autowired
private ExtractPojosForBB extractPojosForBB;
@Autowired
- private NetworkAdapterResources networkAdapterResources;
- @Autowired
private ExceptionBuilder exceptionUtil;
-
-
+ @Autowired
+ private NetworkAdapterObjectMapper networkAdapterObjectMapper;
+ @Autowired
+ private NetworkAdapterResources networkAdapterResources;
public void createNetwork(BuildingBlockExecution execution) {
execution.setVariable("networkAdapterCreateRollback", false);
@@ -59,18 +58,29 @@ public class NetworkAdapterCreateTasks {
Map<String, String> userInput = gBBInput.getUserInput();
String cloudRegionPo = execution.getVariable("cloudRegionPo");
- Optional<CreateNetworkResponse> oCreateNetworkResponse = networkAdapterResources.createNetwork(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, userInput, cloudRegionPo, gBBInput.getCustomer());
- if (oCreateNetworkResponse.isPresent()){
- CreateNetworkResponse createNetworkResponse = oCreateNetworkResponse.get();
+ CreateNetworkRequest createNetworkRequest = networkAdapterObjectMapper.createNetworkRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, userInput, cloudRegionPo, gBBInput.getCustomer());
+
+ execution.setVariable("networkAdapterRequest", createNetworkRequest);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void processResponseFromOpenstack(BuildingBlockExecution execution) {
+ try {
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+
+ CreateNetworkResponse createNetworkResponse = execution.getVariable("createNetworkResponse");
+ if(createNetworkResponse != null) {
l3Network.setHeatStackId(createNetworkResponse.getNetworkStackId());
if (createNetworkResponse.getNetworkCreated()){
//setting rollback TRUE only if network was actually created (not a silent success OP)
- execution.setVariable("createNetworkResponse", createNetworkResponse);
execution.setVariable("networkAdapterCreateRollback", true);
}
+ } else {
+ throw new Exception("No response was sent back from NetworkAdapterRestV1 subflow.");
}
-
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java
index 0f0f73ddf1..41dabf9302 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java
@@ -20,30 +20,26 @@
package org.onap.so.bpmn.infrastructure.adapter.network.tasks;
-import java.util.Optional;
-
-import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
+import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper;
import org.onap.so.client.exception.ExceptionBuilder;
-import org.onap.so.client.orchestration.NetworkAdapterResources;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class NetworkAdapterDeleteTasks {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkAdapterDeleteTasks.class);
@Autowired
private ExtractPojosForBB extractPojosForBB;
@Autowired
- private NetworkAdapterResources networkAdapterResources;
+ private NetworkAdapterObjectMapper networkAdapterObjectMapper;
@Autowired
private ExceptionBuilder exceptionUtil;
@@ -54,14 +50,9 @@ public class NetworkAdapterDeleteTasks {
L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- Optional<DeleteNetworkResponse> oDeleteNetworkResponse = networkAdapterResources.deleteNetwork(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, l3Network);
+ DeleteNetworkRequest deleteNetworkRequest = networkAdapterObjectMapper.deleteNetworkRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, l3Network);
- if (oDeleteNetworkResponse.isPresent()){
- DeleteNetworkResponse deleteNetworkResponse = oDeleteNetworkResponse.get();
- if (deleteNetworkResponse.getNetworkDeleted()) {
- execution.setVariable("deleteNetworkResponse", deleteNetworkResponse);
- }
- }
+ execution.setVariable("networkAdapterRequest", deleteNetworkRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
new file mode 100644
index 0000000000..d919c53c9c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
@@ -0,0 +1,123 @@
+package org.onap.so.bpmn.infrastructure.adapter.network.tasks;
+
+import java.io.StringReader;
+import java.util.Optional;
+
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.adapters.nwrest.CreateNetworkError;
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
+import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.adapters.nwrest.DeleteNetworkError;
+import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
+import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.NetworkAdapterResources;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class NetworkAdapterRestV1 {
+
+ private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterRestV1.class);
+
+ private static final String NETWORK_REQUEST = "networkAdapterRequest";
+ private static final String NETWORK_MESSAGE = "NetworkAResponse_MESSAGE";
+ private static final String NETWORK_SYNC_CODE = "NETWORKREST_networkAdapterStatusCode";
+ private static final String NETWORK_SYNC_RESPONSE = "NETWORKREST_networkAdapterResponse";
+ private static final String NETWORK_CORRELATOR = "NetworkAResponse_CORRELATOR";
+
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+
+ @Autowired
+ private NetworkAdapterResources networkAdapterResources;
+
+ public void callNetworkAdapter (DelegateExecution execution) {
+ try {
+ Object networkAdapterRequest = execution.getVariable(NETWORK_REQUEST);
+ if (networkAdapterRequest != null) {
+ Optional<Response> response = Optional.empty();
+ if (networkAdapterRequest instanceof CreateNetworkRequest) {
+ CreateNetworkRequest createNetworkRequest = (CreateNetworkRequest) networkAdapterRequest;
+ execution.setVariable(NETWORK_CORRELATOR, createNetworkRequest.getMessageId());
+ response = networkAdapterResources.createNetworkAsync(createNetworkRequest);
+ } else if (networkAdapterRequest instanceof DeleteNetworkRequest) {
+ DeleteNetworkRequest deleteNetworkRequest = (DeleteNetworkRequest) networkAdapterRequest;
+ execution.setVariable(NETWORK_CORRELATOR, deleteNetworkRequest.getMessageId());
+ response = networkAdapterResources.deleteNetworkAsync(deleteNetworkRequest);
+ }
+ if(response.isPresent()) {
+ String statusCode = Integer.toString(response.get().getStatus());
+ String responseString = "";
+ if(response.get().getEntity() != null) {
+ responseString = (String) response.get().getEntity();
+ }
+ execution.setVariable(NETWORK_SYNC_CODE, statusCode);
+ execution.setVariable(NETWORK_SYNC_RESPONSE, responseString);
+ } else {
+ throw new Exception("No Ack response from Openstack Adapter");
+ }
+ } else {
+ throw new Exception("No Network Request was created. networkAdapterRequest was null.");
+ }
+ } catch (Exception ex) {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void processCallback (DelegateExecution execution) {
+ try {
+ Object networkAdapterRequest = execution.getVariable(NETWORK_REQUEST);
+ String callback = (String) execution.getVariable(NETWORK_MESSAGE);
+ String logCallbackMessage = "Callback from OpenstackAdapter: " + callback;
+ logger.debug(logCallbackMessage);
+ if (networkAdapterRequest != null) {
+ if (networkAdapterRequest instanceof CreateNetworkRequest) {
+ if(callback.contains("createNetworkError")) {
+ CreateNetworkError createNetworkError = (CreateNetworkError) unmarshalXml(callback, CreateNetworkError.class);
+ throw new Exception(createNetworkError.getMessage());
+ } else {
+ CreateNetworkResponse createNetworkResponse = (CreateNetworkResponse) unmarshalXml(callback, CreateNetworkResponse.class);
+ execution.setVariable("createNetworkResponse", createNetworkResponse);
+ }
+ } else if (networkAdapterRequest instanceof DeleteNetworkRequest) {
+ if(callback.contains("deleteNetworkError")) {
+ DeleteNetworkError deleteNetworkError = (DeleteNetworkError) unmarshalXml(callback, DeleteNetworkError.class);
+ throw new Exception(deleteNetworkError.getMessage());
+ } else {
+ DeleteNetworkResponse deleteNetworkResponse = (DeleteNetworkResponse) unmarshalXml(callback, DeleteNetworkResponse.class);
+ execution.setVariable("deleteNetworkResponse", deleteNetworkResponse);
+ }
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error in Openstack Adapter callback", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
+ }
+ }
+
+ protected <T> Object unmarshalXml(String xmlString, Class<T> resultClass) throws JAXBException {
+ StringReader reader = new StringReader(xmlString);
+ JAXBContext context = JAXBContext.newInstance(resultClass);
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+ return unmarshaller.unmarshal(reader);
+ }
+
+ public void handleTimeOutException (DelegateExecution execution) {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error timed out waiting on Openstack Async-Response");
+ }
+
+ public void handleSyncError (DelegateExecution execution) {
+ String statusCode = (String) execution.getVariable(NETWORK_SYNC_CODE);
+ String responseString = (String) execution.getVariable(NETWORK_SYNC_RESPONSE);
+ String errorMessage = "Error with Openstack Adapter Sync Request: StatusCode = " + statusCode + " Response = " + responseString;
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
index db54b219a9..f1a9e955b6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
@@ -62,8 +62,6 @@ public class VnfAdapterImpl {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
-
- execution.setVariable("isDebugLogEnabled", "true");
execution.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId());
execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId());
execution.setVariable("heatStackId", null);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java
new file mode 100644
index 0000000000..32c852b0e1
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ActivateVfModule.java
@@ -0,0 +1,35 @@
+package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ActivateVfModule {
+
+ private static final Logger logger = LoggerFactory.getLogger(ActivateVfModule.class);
+
+ protected static final String VF_MODULE_TIMER_DURATION_PATH = "mso.workflow.vfModuleActivate.timer.duration";
+ protected static final String DEFAULT_TIMER_DURATION = "PT180S";
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ @Autowired
+ private Environment environment;
+
+
+ public void setTimerDuration(BuildingBlockExecution execution) {
+ try {
+ String waitDuration = this.environment.getProperty(VF_MODULE_TIMER_DURATION_PATH, DEFAULT_TIMER_DURATION);
+ logger.debug("Sleeping before proceeding with SDNC activate. Timer duration: {}", waitDuration);
+ execution.setVariable("vfModuleActivateTimerDuration", waitDuration);
+ } catch (Exception e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java
index 534e93637a..ee80ba4c55 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java
@@ -58,7 +58,7 @@ public class AssignVnf {
aaiInstanceGroupResources.createInstanceGroup(instanceGroup);
aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.BELONGS_TO);
}
- else if(ModelInfoInstanceGroup.TYPE_NETWORK_INSTANCE_GROUP.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
+ else if(ModelInfoInstanceGroup.TYPE_L3_NETWORK.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.USES);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java
index 7051da150f..945c693d47 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java
@@ -30,9 +30,7 @@ import org.onap.so.logger.MsoLogger;
import org.springframework.stereotype.Component;
@Component
-public class NetworkBBUtils {
-
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkBBUtils.class);
+public class NetworkBBUtils {
private static final String CLOUD_REGION_VER25 = "2.5";
private static final String CLOUD_REGION_AAIAIC25 = "AAIAIC25";
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
new file mode 100644
index 0000000000..cb4ac5c9d9
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
@@ -0,0 +1,56 @@
+/*-
+ * ============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.bpmn.infrastructure.namingservice.tasks;
+
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.NamingServiceResources;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class NamingServiceCreateTasks {
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ private NamingServiceResources namingServiceResources;
+
+ public void createInstanceGroupName(BuildingBlockExecution execution) throws Exception {
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID));
+ String policyInstanceName = execution.getVariable("policyInstanceName");
+ String nfNamingCode = execution.getVariable("nfNamingCode");
+ String generatedInstanceGroupName = "";
+ try {
+ generatedInstanceGroupName = namingServiceResources.generateInstanceGroupName(instanceGroup, policyInstanceName, nfNamingCode);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ instanceGroup.setInstanceGroupName(generatedInstanceGroupName);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
new file mode 100644
index 0000000000..ddea2724bc
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
@@ -0,0 +1,53 @@
+/*-
+ * ============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.bpmn.infrastructure.namingservice.tasks;
+
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.NamingServiceResources;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class NamingServiceDeleteTasks {
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ private NamingServiceResources namingServiceResources;
+
+ public void deleteInstanceGroupName(BuildingBlockExecution execution) throws Exception {
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID));
+
+ try {
+ namingServiceResources.deleteInstanceGroupName(instanceGroup);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java
index e587e80251..43ee71e676 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java
@@ -20,6 +20,9 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
@@ -36,6 +39,8 @@ import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.SDNCNetworkResources;
import org.onap.so.client.orchestration.SDNCVfModuleResources;
import org.onap.so.client.orchestration.SDNCVnfResources;
+import org.onap.so.client.sdnc.beans.SDNCRequest;
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -63,8 +68,11 @@ public class SDNCActivateTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
CloudRegion cloudRegion = gBBInput.getCloudRegion();
Customer customer = gBBInput.getCustomer();
- String response = sdncVnfResources.activateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
- execution.setVariable("SDNCResponse", response);
+ GenericResourceApiVnfOperationInformation req = sdncVnfResources.activateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VNF);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -76,18 +84,18 @@ public class SDNCActivateTasks {
* @throws BBObjectNotFoundException
*/
public void activateNetwork(BuildingBlockExecution execution) throws BBObjectNotFoundException {
- execution.setVariable("sdncNetworkActivateRollback", false);
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
-
- Customer customer = gBBInput.getCustomer();
- RequestContext requestContext = gBBInput.getRequestContext();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- try {
- sdncNetworkResources.activateNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion);
- execution.setVariable("sdncNetworkActivateRollback", true);
+ try{
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ Customer customer = gBBInput.getCustomer();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.activateNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.NETWORK);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -108,12 +116,12 @@ public class SDNCActivateTasks {
execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
- execution.setVariable("sdncActivateVfModuleRollback", false);
-
- String response = sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer,
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer,
cloudRegion, requestContext);
- execution.setVariable("SDNCActivateVfModuleResponse", response);
- execution.setVariable("sdncActivateVfModuleRollback", true);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VFMODULE);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
index ec79b2825a..2695a170b4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
@@ -20,6 +20,10 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
@@ -38,6 +42,8 @@ import org.onap.so.client.orchestration.SDNCNetworkResources;
import org.onap.so.client.orchestration.SDNCServiceInstanceResources;
import org.onap.so.client.orchestration.SDNCVfModuleResources;
import org.onap.so.client.orchestration.SDNCVnfResources;
+import org.onap.so.client.sdnc.beans.SDNCRequest;
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -64,8 +70,11 @@ public class SDNCAssignTasks {
RequestContext requestContext = gBBInput.getRequestContext();
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
Customer customer = gBBInput.getCustomer();
- String response = sdncSIResources.assignServiceInstance(serviceInstance, customer, requestContext);
- execution.setVariable("SDNCResponse", response);
+ GenericResourceApiServiceOperationInformation req = sdncSIResources.assignServiceInstance(serviceInstance, customer, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.SERVICE);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -79,8 +88,11 @@ public class SDNCAssignTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
- String response = sdncVnfResources.assignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext, Boolean.TRUE.equals(vnf.isCallHoming()));
- execution.setVariable("SDNCResponse", response);
+ GenericResourceApiVnfOperationInformation req = sdncVnfResources.assignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext, Boolean.TRUE.equals(vnf.isCallHoming()));
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VNF);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -101,9 +113,11 @@ public class SDNCAssignTasks {
}
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
-
- String response = sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext);
- execution.setVariable("SDNCAssignResponse_"+ vfModule.getVfModuleId(), response);
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VFMODULE);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -117,15 +131,16 @@ public class SDNCAssignTasks {
public void assignNetwork(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
-
Customer customer = gBBInput.getCustomer();
RequestContext requestContext = gBBInput.getRequestContext();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
-
- sdncNetworkResources.assignNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion);
+ GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.assignNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.NETWORK);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java
index cae4dc26de..592b831d62 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java
@@ -20,6 +20,10 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
@@ -36,6 +40,8 @@ import org.onap.so.client.orchestration.SDNCNetworkResources;
import org.onap.so.client.orchestration.SDNCServiceInstanceResources;
import org.onap.so.client.orchestration.SDNCVfModuleResources;
import org.onap.so.client.orchestration.SDNCVnfResources;
+import org.onap.so.client.sdnc.beans.SDNCRequest;
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -58,9 +64,11 @@ public class SDNCChangeAssignTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
-
- String response = sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext());
- execution.setVariable("SDNCChangeAssignTasks.changeModelServiceInstance.response", response);
+ GenericResourceApiServiceOperationInformation req = sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext());
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.SERVICE);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch(Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -71,9 +79,11 @@ public class SDNCChangeAssignTasks {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
-
- String response = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, gBBInput.getCustomer(), gBBInput.getCloudRegion(), gBBInput.getRequestContext());
- execution.setVariable("SDNCChangeModelVnfResponse", response);
+ GenericResourceApiVnfOperationInformation req = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, gBBInput.getCustomer(), gBBInput.getCloudRegion(), gBBInput.getRequestContext());
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VNF);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch(Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -84,9 +94,11 @@ public class SDNCChangeAssignTasks {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
-
- String sdncResponse = sdncNetworkResources.changeAssignNetwork(network, serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext(), gBBInput.getCloudRegion());
- execution.setVariable("SDNCChangeAssignNetworkResponse", sdncResponse);
+ GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.changeAssignNetwork(network, serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext(), gBBInput.getCloudRegion());
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.NETWORK);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch(Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -101,8 +113,11 @@ public class SDNCChangeAssignTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
Customer customer = gBBInput.getCustomer();
- String response = sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext);
- execution.setVariable("SDNCChangeAssignVfModuleResponse", response);
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VFMODULE);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
index 1f6ec72f34..eb078e04b4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
@@ -20,6 +20,10 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
@@ -36,6 +40,8 @@ import org.onap.so.client.orchestration.SDNCNetworkResources;
import org.onap.so.client.orchestration.SDNCServiceInstanceResources;
import org.onap.so.client.orchestration.SDNCVfModuleResources;
import org.onap.so.client.orchestration.SDNCVnfResources;
+import org.onap.so.client.sdnc.beans.SDNCRequest;
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -61,23 +67,17 @@ public class SDNCDeactivateTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
RequestContext requestContext = gBBInput.getRequestContext();
-
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID,
- execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID,
- execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID,
- execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
-
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
- execution.setVariable("sdncDeactivateVfModuleRollback", false);
-
- String response = sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer,
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer,
cloudRegion, requestContext);
- execution.setVariable("SDNCDeactivateVfModuleResponse", response);
- execution.setVariable("sdncDeactivateVfModuleRollback", true);
- } catch (Exception ex) {
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VFMODULE);
+ execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -93,15 +93,15 @@ public class SDNCDeactivateTasks {
RequestContext requestContext = gBBInput.getRequestContext();
ServiceInstance serviceInstance = null;
GenericVnf vnf = null;
-
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID,
- execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID,
- execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
CloudRegion cloudRegion = gBBInput.getCloudRegion();
Customer customer = gBBInput.getCustomer();
- String response = sdncVnfResources.deactivateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
- execution.setVariable("SDNCDeactivateVnfResponse", response);
+ GenericResourceApiVnfOperationInformation req = sdncVnfResources.deactivateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VNF);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -119,10 +119,11 @@ public class SDNCDeactivateTasks {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID,
execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
Customer customer = gBBInput.getCustomer();
- execution.setVariable("sdncServiceInstanceRollback", false);
- String response = sdncSIResources.deactivateServiceInstance(serviceInstance, customer, requestContext);
- execution.setVariable("deactivateServiceInstanceSDNCResponse", response);
- execution.setVariable("sdncServiceInstanceRollback", true);
+ GenericResourceApiServiceOperationInformation req = sdncSIResources.deactivateServiceInstance(serviceInstance, customer, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.SERVICE);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -134,7 +135,6 @@ public class SDNCDeactivateTasks {
* @param execution
*/
public void deactivateNetwork(BuildingBlockExecution execution) {
- execution.setVariable("SDNCDeactivateTasks.deactivateNetwork.rollback", false);
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
@@ -142,11 +142,12 @@ public class SDNCDeactivateTasks {
Customer customer = gBBInput.getCustomer();
RequestContext requestContext = gBBInput.getRequestContext();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
-
- String response = sdncNetworkResources.deactivateNetwork(l3Network, serviceInstance, customer,
+ GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.deactivateNetwork(l3Network, serviceInstance, customer,
requestContext, cloudRegion);
- execution.setVariable("SDNCDeactivateTasks.deactivateNetwork.response", response);
- execution.setVariable("SDNCDeactivateTasks.deactivateNetwork.rollback", true);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.NETWORK);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
index 1fe3143c4a..81ebfb1f41 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
@@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
@@ -46,10 +47,17 @@ public class SDNCQueryTasks {
@Autowired
private ExtractPojosForBB extractPojosForBB;
- public void queryVnf(BuildingBlockExecution execution) throws Exception {
+ public void queryVnf(BuildingBlockExecution execution) throws Exception {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ String selfLink = "restconf/config/GENERIC-RESOURCE-API:services/service/"
+ + serviceInstance.getServiceInstanceId() + "/service-data/vnfs/vnf/"
+ + genericVnf.getVnfId() + "/vnf-data/vnf-topology/";
try {
+ if(genericVnf.getSelflink() == null) {
+ genericVnf.setSelflink(selfLink);
+ }
String response = sdncVnfResources.queryVnf(genericVnf);
execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), response);
} catch (Exception ex) {
@@ -59,12 +67,20 @@ public class SDNCQueryTasks {
public void queryVfModule(BuildingBlockExecution execution) throws Exception {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
-
+ String selfLink = "restconf/config/GENERIC-RESOURCE-API:services/service/"
+ + serviceInstance.getServiceInstanceId() + "/service-data/vnfs/vnf/"
+ + genericVnf.getVnfId() + "/vnf-data/vf-modules/vf-module/"
+ + vfModule.getVfModuleId() + "/vf-module-data/vf-module-topology/";
try {
+ if(vfModule.getSelflink() == null || (vfModule.getSelflink() != null && vfModule.getSelflink().isEmpty())) {
+ vfModule.setSelflink(selfLink);
+ }
if(vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) {
String response = sdncVfModuleResources.queryVfModule(vfModule);
- execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response);
+ execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response);
}
else {
throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value");
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
new file mode 100644
index 0000000000..a4ef28496e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.bpmn.infrastructure.sdnc.tasks;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.exception.MapperException;
+import org.onap.so.client.sdnc.SDNCClient;
+import org.onap.so.client.sdnc.beans.SDNCRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.HttpClientErrorException;
+
+import com.jayway.jsonpath.JsonPath;
+import com.jayway.jsonpath.PathNotFoundException;
+
+@Component
+public class SDNCRequestTasks {
+
+ private static final Logger logger = LoggerFactory.getLogger(SDNCRequestTasks.class);
+
+ private static final String SDNC_REQUEST = "SDNCRequest";
+ private static final String MESSAGE = "_MESSAGE";
+ private static final String CORRELATOR = "_CORRELATOR";
+ protected static final String IS_CALLBACK_COMPLETED = "isCallbackCompleted";
+
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+
+ @Autowired
+ private SDNCClient sdncClient;
+
+ public void createCorrelationVariables (DelegateExecution execution) {
+ SDNCRequest request = (SDNCRequest)execution.getVariable(SDNC_REQUEST);
+ execution.setVariable(request.getCorrelationName()+CORRELATOR, request.getCorrelationValue());
+ execution.setVariable("sdncTimeout", request.getTimeOut());
+ }
+
+ public void callSDNC (DelegateExecution execution) {
+ SDNCRequest request = (SDNCRequest)execution.getVariable(SDNC_REQUEST);
+ try {
+ String response = sdncClient.post(request.getSDNCPayload(),request.getTopology());
+ String finalMessageIndicator = JsonPath.read(response, "$.output.ack-final-indicator");
+ execution.setVariable("isSDNCCompleted", convertIndicatorToBoolean(finalMessageIndicator));
+ } catch(PathNotFoundException e) {
+ logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,"Recieved invalid response from SDNC, unable to read message content.");
+ } catch (MapperException e) {
+ logger.error("Failed to map SDNC object to JSON prior to POST.", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,"Failed to map SDNC object to JSON prior to POST.");
+ } catch (BadResponseException e) {
+ logger.error("Did not receive a successful response from SDNC.", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage());
+ } catch (HttpClientErrorException e){
+ logger.error("HttpClientErrorException: 404 Not Found, Failed to contact SDNC", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.");
+ }
+ }
+
+ public void processCallback (DelegateExecution execution) {
+ try {
+ SDNCRequest request = (SDNCRequest)execution.getVariable(SDNC_REQUEST);
+ String asyncRequest = (String) execution.getVariable(request.getCorrelationName()+MESSAGE);
+ String finalMessageIndicator = JsonPath.read(asyncRequest, "$.input.ack-final-indicator");
+ boolean isCallbackCompleted = convertIndicatorToBoolean(finalMessageIndicator);
+ execution.setVariable(IS_CALLBACK_COMPLETED, isCallbackCompleted);
+ } catch (Exception e) {
+ logger.error("Error procesing SDNC callback", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error procesing SDNC callback");
+ }
+ }
+
+ public void handleTimeOutException (DelegateExecution execution) {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error timed out waiting on SDNC Async-Response");
+ }
+
+ protected boolean convertIndicatorToBoolean(String finalMessageIndicator) {
+ return "Y".equals(finalMessageIndicator);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java
index 13639daa44..960fb9988a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java
@@ -20,10 +20,15 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
@@ -31,17 +36,16 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.SDNCNetworkResources;
import org.onap.so.client.orchestration.SDNCServiceInstanceResources;
import org.onap.so.client.orchestration.SDNCVfModuleResources;
import org.onap.so.client.orchestration.SDNCVnfResources;
-import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.client.sdnc.beans.SDNCRequest;
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
-import org.onap.so.client.orchestration.SDNCNetworkResources;
-
@Component
public class SDNCUnassignTasks {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCUnassignTasks.class);
@@ -62,15 +66,13 @@ public class SDNCUnassignTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
-
- if (serviceInstance.getOrchestrationStatus() == OrchestrationStatus.INVENTORIED) {
- return; // If INVENTORIED then SDNC unassign is not necessary
- }
-
RequestContext requestContext = gBBInput.getRequestContext();
Customer customer = gBBInput.getCustomer();
- String sdncUnassignResponse = sdncSIResources.unassignServiceInstance(serviceInstance, customer, requestContext);
- execution.setVariable("sdncUnassignResponse", sdncUnassignResponse);
+ GenericResourceApiServiceOperationInformation req = sdncSIResources.unassignServiceInstance(serviceInstance, customer, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.SERVICE);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -81,17 +83,11 @@ public class SDNCUnassignTasks {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
-
- if (OrchestrationStatus.INVENTORIED == vfModule.getOrchestrationStatus() || OrchestrationStatus.PENDING_CREATE == vfModule.getOrchestrationStatus()) {
- return; // If INVENTORIED or PENDING_CREATE then SDNC unassign is not necessary
- }
-
- execution.setVariable("sdncVfModuleRollback", false);
-
- String response = sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance);
- execution.setVariable("SDNCResponse", response);
- execution.setVariable("sdncVfModuleRollback", true);
- } catch (Exception ex) {
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VFMODULE);
+ execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -101,41 +97,34 @@ public class SDNCUnassignTasks {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
-
- if (OrchestrationStatus.INVENTORIED == vnf.getOrchestrationStatus() || OrchestrationStatus.CREATED == vnf.getOrchestrationStatus()) {
- return; // If INVENTORIED or CREATED then SDNC unassign is not necessary
- }
-
RequestContext requestContext = gBBInput.getRequestContext();
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
- execution.setVariable("sdncVnfRollback", false);
- String response = sdncVnfResources.unassignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
- execution.setVariable("sdncUnassignVnfResponse", response);
- execution.setVariable("sdncVnfRollback", true);
+ GenericResourceApiVnfOperationInformation req = sdncVnfResources.unassignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.VNF);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
public void unassignNetwork(BuildingBlockExecution execution) throws Exception {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
-
- if (OrchestrationStatus.INVENTORIED == network.getOrchestrationStatus()) {
- return; // If INVENTORIED then SDNC unassign is not necessary
- }
-
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- Customer customer = gBBInput.getCustomer();
- RequestContext requestContext = gBBInput.getRequestContext();
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- String cloudRegionSdnc = execution.getVariable("cloudRegionSdnc");
- cloudRegion.setLcpCloudRegionId(cloudRegionSdnc);
try {
- String response = sdncNetworkResources.unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
- execution.setVariable("SDNCUnAssignNetworkResponse", response);
- execution.setVariable("isRollbackNeeded", true);
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ Customer customer = gBBInput.getCustomer();
+ RequestContext requestContext = gBBInput.getRequestContext();
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ String cloudRegionSdnc = execution.getVariable("cloudRegionSdnc");
+ cloudRegion.setLcpCloudRegionId(cloudRegionSdnc);
+ GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
+ SDNCRequest sdncRequest = new SDNCRequest();
+ sdncRequest.setSDNCPayload(req);
+ sdncRequest.setTopology(SDNCTopology.NETWORK);
+ execution.setVariable("SDNCRequest", sdncRequest);
} catch (Exception 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 e9dcdade9f..bff320a0b6 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
@@ -27,7 +27,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.Set;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -50,6 +49,9 @@ import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource;
+import org.onap.so.client.aai.AAICommonObjectMapperProvider;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.Relationships;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
@@ -62,6 +64,7 @@ import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.Networks;
@@ -72,6 +75,7 @@ import org.onap.so.serviceinstancebeans.VfModules;
import org.onap.so.serviceinstancebeans.Vnfs;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -105,7 +109,9 @@ public class WorkflowAction {
private static final String USERPARAMSERVICE = "service";
private static final String supportedTypes = "vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances";
private static final String HOMINGSOLUTION = "Homing_Solution";
- private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
+ private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
+ private static final String G_SERVICE_TYPE = "serviceType";
+ private static final String SERVICE_TYPE_TRANSPORT = "TRANSPORT";
private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class);
@Autowired
@@ -118,6 +124,12 @@ public class WorkflowAction {
private CatalogDbClient catalogDbClient;
@Autowired
private AAIConfigurationResources aaiConfigurationResources;
+ @Autowired
+ private WorkflowActionExtractResourcesAAI workflowActionUtils;
+
+ @Autowired
+ private Environment environment;
+ private String defaultCloudOwner = "org.onap.so.cloud-owner";
public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) {
this.bbInputSetupUtils = bbInputSetupUtils;
@@ -135,6 +147,9 @@ public class WorkflowAction {
final String apiVersion = (String) execution.getVariable(G_APIVERSION);
final String uri = (String) execution.getVariable(G_URI);
final String vnfType = (String) execution.getVariable(VNF_TYPE);
+ String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
+ final String serviceType = Optional.ofNullable((String) execution.getVariable(G_SERVICE_TYPE)).orElse("");
+
List<OrchestrationFlow> orchFlows = (List<OrchestrationFlow>) execution.getVariable(G_ORCHESTRATION_FLOW);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
@@ -149,6 +164,19 @@ public class WorkflowAction {
execution.setVariable(G_ISTOPLEVELFLOW, true);
ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
RequestDetails requestDetails = sIRequest.getRequestDetails();
+ String cloudOwner = "";
+ try{
+ cloudOwner = requestDetails.getCloudConfiguration().getCloudOwner();
+ } catch (Exception ex) {
+ cloudOwner = environment.getProperty(defaultCloudOwner);
+ }
+ boolean suppressRollback = false;
+ try{
+ suppressRollback = requestDetails.getRequestInfo().getSuppressRollback();
+ } catch (Exception ex) {
+ suppressRollback = false;
+ }
+ execution.setVariable("suppressRollback", suppressRollback);
Resource resource = extractResourceIdAndTypeFromUri(uri);
WorkflowType resourceType = resource.getResourceType();
execution.setVariable("resourceName", resourceType.toString());
@@ -160,12 +188,15 @@ public class WorkflowAction {
} else {
resourceId = resource.getResourceId();
}
+ if((serviceInstanceId == null || serviceInstanceId.equals("")) && resourceType == WorkflowType.SERVICE){
+ serviceInstanceId = resourceId;
+ }
execution.setVariable("resourceId", resourceId);
execution.setVariable("resourceType", resourceType);
if (aLaCarte) {
if (orchFlows == null || orchFlows.isEmpty()) {
- orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte);
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner, serviceType);
}
orchFlows = filterOrchFlows(orchFlows, resourceType, execution);
String key = "";
@@ -238,10 +269,11 @@ public class WorkflowAction {
} else if (resourceType == WorkflowType.SERVICE
&& requestAction.equalsIgnoreCase("deactivateInstance")) {
resourceCounter.add(new Resource(WorkflowType.SERVICE,"",false));
+ } else if (resourceType == WorkflowType.VNF && (requestAction.equalsIgnoreCase("replaceInstance") || (requestAction.equalsIgnoreCase("recreateInstance")))) {
+ traverseAAIVnf(execution, resourceCounter, workflowResourceIds.getServiceInstanceId(), workflowResourceIds.getVnfId(), aaiResourceIds);
} else {
buildAndThrowException(execution, "Current Macro Request is not supported");
}
-
String foundObjects = "";
for(WorkflowType type : WorkflowType.values()){
foundObjects = foundObjects + type + " - " + resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size() + " ";
@@ -249,7 +281,7 @@ public class WorkflowAction {
logger.info("Found {}", foundObjects);
if (orchFlows == null || orchFlows.isEmpty()) {
- orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte);
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner, serviceType);
}
flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceCounter, requestId, apiVersion, resourceId,
resourceType, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails);
@@ -265,14 +297,15 @@ public class WorkflowAction {
execution.setVariable("calledHoming", false);
}
if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase(ASSIGNINSTANCE) || requestAction.equalsIgnoreCase(CREATEINSTANCE))){
- generateResourceIds(flowsToExecute, resourceCounter);
+ generateResourceIds(flowsToExecute, resourceCounter, serviceInstanceId);
}else{
- updateResourceIdsFromAAITraversal(flowsToExecute, resourceCounter, aaiResourceIds);
+ updateResourceIdsFromAAITraversal(flowsToExecute, resourceCounter, aaiResourceIds, serviceInstanceId);
}
}
- // If the user set "Homing_Solution" to "none", disable homing, else if "Homing_Solution" is specified, enable it.
- if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
+ // If the user set "Homing_Solution" to "none", disable homing, else if "Homing_Solution" is specified, enable it.
+ if (sIRequest.getRequestDetails().getRequestParameters() != null &&
+ sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams();
for (Map<String, Object> params : userParams) {
if (params.containsKey(HOMINGSOLUTION)) {
@@ -316,9 +349,21 @@ public class WorkflowAction {
}
return vfModuleResources;
}
+
+ protected List<Resource> sortVfModulesByBaseLast(List<Resource> vfModuleResources) {
+ int count = 0;
+ for(Resource resource : vfModuleResources){
+ if(resource.isBaseVfModule()){
+ Collections.swap(vfModuleResources, vfModuleResources.size()-1, count);
+ break;
+ }
+ count++;
+ }
+ return vfModuleResources;
+ }
private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute,
- List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds) {
+ List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) {
for(Pair<WorkflowType,String> pair : aaiResourceIds){
logger.debug(pair.getValue0() + ", " + pair.getValue1());
}
@@ -326,7 +371,7 @@ public class WorkflowAction {
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList());
for(int i = 0; i < resources.size(); i++){
- updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type), null);
+ updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type), null, serviceInstanceId);
}
});
}
@@ -342,17 +387,18 @@ public class WorkflowAction {
}
return id;
}
- private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceCounter) {
+ private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceCounter, String serviceInstanceId) {
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList());
for(int i = 0; i < resources.size(); i++){
Resource resource = resourceCounter.stream().filter(x -> type.equals(x.getResourceType()))
.collect(Collectors.toList()).get(i);
- updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null, resource.getVirtualLinkKey()); }
+ updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null, resource.getVirtualLinkKey(),serviceInstanceId);
+ }
});
}
- protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id, String virtualLinkKey){
+ protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id, String virtualLinkKey, String serviceInstanceId){
String resourceId = id;
if(resourceId==null){
resourceId = UUID.randomUUID().toString();
@@ -360,6 +406,7 @@ public class WorkflowAction {
for(ExecuteBuildingBlock ebb : flowsToExecute){
if(key != null && key.equalsIgnoreCase(ebb.getBuildingBlock().getKey()) && ebb.getBuildingBlock().getBpmnFlowName().contains(resource.toString())){
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId(serviceInstanceId);
if(resource == WorkflowType.VNF){
workflowResourceIds.setVnfId(resourceId);
}else if(resource == WorkflowType.VFMODULE){
@@ -378,6 +425,7 @@ public class WorkflowAction {
if(virtualLinkKey != null && ebb.getBuildingBlock().getIsVirtualLink()
&& virtualLinkKey.equalsIgnoreCase(ebb.getBuildingBlock().getVirtualLinkKey())) {
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId(serviceInstanceId);
workflowResourceIds.setNetworkId(resourceId);
ebb.setWorkflowResourceIds(workflowResourceIds);
}
@@ -539,6 +587,67 @@ public class WorkflowAction {
}
}
+ private void traverseAAIVnf(DelegateExecution execution, List<Resource> resourceCounter, String serviceId, String vnfId,
+ List<Pair<WorkflowType, String>> aaiResourceIds) {
+ try{
+ ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceId);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = bbInputSetup
+ .getExistingServiceInstance(serviceInstanceAAI);
+ resourceCounter.add(new Resource(WorkflowType.SERVICE,serviceInstanceMSO.getServiceInstanceId(),false));
+ if (serviceInstanceMSO.getVnfs() != null) {
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO
+ .getVnfs()) {
+ if(vnf.getVnfId().equals(vnfId)){
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VNF, vnf.getVnfId()));
+ resourceCounter.add(new Resource(WorkflowType.VNF,vnf.getVnfId(),false));
+ if (vnf.getVfModules() != null) {
+ for (VfModule vfModule : vnf.getVfModules()) {
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
+ resourceCounter.add(new Resource(WorkflowType.VFMODULE,vfModule.getVfModuleId(),false));
+ findConfigurationsInsideVfModule(execution, vnf.getVnfId(), vfModule.getVfModuleId(), resourceCounter, aaiResourceIds);
+ }
+ }
+ if (vnf.getVolumeGroups() != null) {
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf
+ .getVolumeGroups()) {
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId()));
+ resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,volumeGroup.getVolumeGroupId(),false));
+ }
+ }
+ break;
+ }
+ }
+ }
+ } catch (Exception ex) {
+ buildAndThrowException(execution,
+ "Could not find existing Vnf or related Instances to execute the request on.");
+ }
+ }
+
+ private void findConfigurationsInsideVfModule(DelegateExecution execution, String vnfId, String vfModuleId, List<Resource> resourceCounter,
+ List<Pair<WorkflowType, String>> aaiResourceIds) {
+ try{
+ org.onap.aai.domain.yang.VfModule aaiVfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId);
+ AAIResultWrapper vfModuleWrapper = new AAIResultWrapper(
+ new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiVfModule));
+ Optional<Relationships> relationshipsOp;
+ relationshipsOp = vfModuleWrapper.getRelationships();
+ if(relationshipsOp.isPresent()) {
+ relationshipsOp = workflowActionUtils.extractRelationshipsVnfc(relationshipsOp.get());
+ if(relationshipsOp.isPresent()){
+ Optional<Configuration> config = workflowActionUtils.extractRelationshipsConfiguration(relationshipsOp.get());
+ if(config.isPresent()){
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION, config.get().getConfigurationId()));
+ resourceCounter.add(new Resource(WorkflowType.CONFIGURATION, config.get().getConfigurationId(), false));
+ }
+ }
+ }
+ }catch (Exception ex){
+ buildAndThrowException(execution,
+ "Failed to find Configuration object from the vfModule.");
+ }
+ }
+
protected boolean traverseUserParamsService(DelegateExecution execution, List<Resource> resourceCounter,
ServiceInstancesRequest sIRequest, String requestAction)
throws IOException {
@@ -877,8 +986,14 @@ public class WorkflowAction {
requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true, resource.getVirtualLinkKey(), false));
}
} else if (orchFlow.getFlowName().contains(VFMODULE)) {
- List<Resource> vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType())
+ List<Resource> vfModuleResourcesSorted = null;
+ if(requestAction.equals("createInstance")||requestAction.equals("assignInstance")||requestAction.equals("activateInstance")){
+ vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType())
.collect(Collectors.toList()));
+ }else{
+ vfModuleResourcesSorted = sortVfModulesByBaseLast(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType())
+ .collect(Collectors.toList()));
+ }
for (int i = 0; i < vfModuleResourcesSorted.size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i), apiVersion, resourceId,
requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
@@ -943,10 +1058,22 @@ public class WorkflowAction {
}
protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
- WorkflowType resourceName, boolean aLaCarte) {
+ WorkflowType resourceName, boolean aLaCarte, String cloudOwner) {
+ return this.queryNorthBoundRequestCatalogDb(execution, requestAction, resourceName, aLaCarte, cloudOwner, "");
+ }
+
+ protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
+ WorkflowType resourceName, boolean aLaCarte, String cloudOwner, String serviceType) {
List<OrchestrationFlow> listToExecute = new ArrayList<>();
- NorthBoundRequest northBoundRequest = catalogDbClient
- .getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(requestAction, resourceName.toString(), aLaCarte);
+ NorthBoundRequest northBoundRequest = null;
+ if (serviceType.equalsIgnoreCase(SERVICE_TYPE_TRANSPORT)) {
+ northBoundRequest = catalogDbClient
+ .getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwnerAndServiceType(requestAction,
+ resourceName.toString(), aLaCarte, cloudOwner, serviceType);
+ } else {
+ northBoundRequest = catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(
+ requestAction, resourceName.toString(), aLaCarte, cloudOwner);
+ }
if(northBoundRequest == null){
if(aLaCarte){
buildAndThrowException(execution,"The request: ALaCarte " + resourceName + " " + requestAction + " is not supported by GR_API.");
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
new file mode 100644
index 0000000000..1812e50328
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
@@ -0,0 +1,148 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.bpmn.infrastructure.workflow.tasks;
+
+import java.util.Optional;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class WorkflowActionBBFailure {
+
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBFailure.class);
+ @Autowired
+ private RequestsDbClient requestDbclient;
+ @Autowired
+ private WorkflowAction workflowAction;
+
+ protected void updateRequestErrorStatusMessage(DelegateExecution execution) {
+ try {
+ String requestId = (String) execution.getVariable("mso-request-id");
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ String errorMsg = "";
+ Optional<String> errorMsgOp = retrieveErrorMessage(execution);
+ if(errorMsgOp.isPresent()){
+ errorMsg = errorMsgOp.get();
+ }else{
+ errorMsg = "Failed to determine error message";
+ }
+ request.setStatusMessage(errorMsg);
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ logger.error("Failed to update Request db with the status message after retry or rollback has been initialized.",e);
+ }
+ }
+
+ public void updateRequestStatusToFailed(DelegateExecution execution) {
+ try {
+ String requestId = (String) execution.getVariable("mso-request-id");
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ String rollbackErrorMsg = "";
+ String errorMsg = "";
+ Boolean rollbackCompletedSuccessfully = (Boolean) execution.getVariable("isRollbackComplete");
+ Boolean isRollbackFailure = (Boolean) execution.getVariable("isRollback");
+ ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock");
+ if(rollbackCompletedSuccessfully==null)
+ rollbackCompletedSuccessfully = false;
+
+ if(isRollbackFailure==null)
+ isRollbackFailure = false;
+
+ if(rollbackCompletedSuccessfully){
+ rollbackErrorMsg = "Rollback has been completed successfully.";
+ request.setRollbackStatusMessage(rollbackErrorMsg);
+ execution.setVariable("RollbackErrorMessage", rollbackErrorMsg);
+ }else if(isRollbackFailure){
+ Optional<String> rollbackErrorMsgOp = retrieveErrorMessage(execution);
+ if(rollbackErrorMsgOp.isPresent()){
+ rollbackErrorMsg = rollbackErrorMsgOp.get();
+ }else{
+ rollbackErrorMsg = "Failed to determine rollback error message.";
+ }
+ request.setRollbackStatusMessage(rollbackErrorMsg);
+ execution.setVariable("RollbackErrorMessage", rollbackErrorMsg);
+ }else{
+ Optional<String> errorMsgOp = retrieveErrorMessage(execution);
+ if(errorMsgOp.isPresent()){
+ errorMsg = errorMsgOp.get();
+ }else{
+ errorMsg = "Failed to determine error message";
+ }
+ request.setStatusMessage(errorMsg);
+ execution.setVariable("ErrorMessage", errorMsg);
+ }
+ if(ebb!=null && ebb.getBuildingBlock()!=null){
+ String flowStatus = "";
+ if(rollbackCompletedSuccessfully){
+ flowStatus = "All Rollback flows have completed successfully";
+ }else{
+ flowStatus = ebb.getBuildingBlock().getBpmnFlowName() + " has failed.";
+ }
+ request.setFlowStatus(flowStatus);
+ execution.setVariable("flowStatus", flowStatus);
+ }
+
+ request.setProgress(Long.valueOf(100));
+ request.setRequestStatus("FAILED");
+ request.setLastModifiedBy("CamundaBPMN");
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ workflowAction.buildAndThrowException(execution, "Error Updating Request Database", e);
+ }
+ }
+
+ private Optional<String> retrieveErrorMessage (DelegateExecution execution){
+ String errorMsg = "";
+ try {
+ WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
+ if(exception != null && (exception.getErrorMessage()!=null || !exception.getErrorMessage().equals(""))){
+ errorMsg = exception.getErrorMessage();
+ }
+ if(errorMsg == null || errorMsg.equals("")){
+ errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage");
+ }
+ return Optional.of(errorMsg);
+ } catch (Exception ex) {
+ logger.error("Failed to extract workflow exception from execution.",ex);
+ }
+ return Optional.empty();
+ }
+
+ public void updateRequestStatusToFailedWithRollback(DelegateExecution execution) {
+ execution.setVariable("isRollbackComplete", true);
+ updateRequestStatusToFailed(execution);
+ }
+
+ public void abortCallErrorHandling(DelegateExecution execution) {
+ String msg = "Flow has failed. Rainy day handler has decided to abort the process.";
+ logger.error(msg);
+ throw new BpmnError(msg);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 4e02ca3f6f..78a84b1772 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -20,8 +20,11 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
+import java.sql.Timestamp;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
+import java.util.Optional;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -57,6 +60,8 @@ public class WorkflowActionBBTasks {
private RequestsDbClient requestDbclient;
@Autowired
private WorkflowAction workflowAction;
+ @Autowired
+ private WorkflowActionBBFailure workflowActionBBFailure;
public void selectBB(DelegateExecution execution) {
List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
@@ -109,7 +114,7 @@ public class WorkflowActionBBTasks {
String statusMessage = this.getStatusMessage(completedBB.getBuildingBlock().getBpmnFlowName(),
nextBB.getBuildingBlock().getBpmnFlowName(), completedBBs, remainingBBs);
Long percentProgress = this.getPercentProgress(completedBBs, totalBBs);
- request.setStatusMessage(statusMessage);
+ request.setFlowStatus(statusMessage);
request.setProgress(percentProgress);
request.setLastModifiedBy("CamundaBPMN");
return request;
@@ -178,57 +183,52 @@ public class WorkflowActionBBTasks {
}
}
- public void setupCompleteMsoProcess(DelegateExecution execution) {
- final String requestId = (String) execution.getVariable(G_REQUEST_ID);
- final String action = (String) execution.getVariable(G_ACTION);
- final String resourceId = (String) execution.getVariable("resourceId");
- final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
- final String resourceName = (String) execution.getVariable("resourceName");
- final String source = (String) execution.getVariable("source");
- String macroAction = "";
- if (aLaCarte) {
- macroAction = "ALaCarte-" + resourceName + "-" + action;
- } else {
- macroAction = "Macro-" + resourceName + "-" + action;
- }
- String msoCompletionRequest = "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns=\"http://org.onap/so/request/types/v1\"><request-info xmlns=\"http://org.onap/so/infra/vnf-request/v1\"><request-id>"
- + requestId + "</request-id><action>" + action + "</action><source>" + source
- + "</source></request-info><status-message>" + macroAction
- + " request was executed correctly.</status-message><serviceInstanceId>" + resourceId
- + "</serviceInstanceId><mso-bpel-name>WorkflowActionBB</mso-bpel-name></aetgt:MsoCompletionRequest>";
- execution.setVariable("CompleteMsoProcessRequest", msoCompletionRequest);
- execution.setVariable("mso-request-id", requestId);
- execution.setVariable("mso-service-instance-id", resourceId);
- }
-
- public void setupFalloutHandler(DelegateExecution execution) {
- final String requestId = (String) execution.getVariable(G_REQUEST_ID);
- final String action = (String) execution.getVariable(G_ACTION);
- final String resourceId = (String) execution.getVariable("resourceId");
- String exceptionMsg = "";
- if (execution.getVariable("WorkflowActionErrorMessage") != null) {
- exceptionMsg = (String) execution.getVariable("WorkflowActionErrorMessage");
- } else {
- exceptionMsg = "Error in WorkflowAction";
+ public void updateRequestStatusToComplete(DelegateExecution execution) {
+ try{
+ final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ final String action = (String) execution.getVariable(G_ACTION);
+ final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
+ final String resourceName = (String) execution.getVariable("resourceName");
+ String macroAction = "";
+ if (aLaCarte) {
+ macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly.";
+ } else {
+ macroAction = "Macro-" + resourceName + "-" + action + " request was executed correctly.";
+ }
+ execution.setVariable("finalStatusMessage", macroAction);
+ Timestamp endTime = new Timestamp(System.currentTimeMillis());
+ request.setEndTime(endTime);
+ request.setFlowStatus("Successfully completed all Building Blocks");
+ request.setStatusMessage(macroAction);
+ request.setProgress(Long.valueOf(100));
+ request.setRequestStatus("COMPLETE");
+ request.setLastModifiedBy("CamundaBPMN");
+ requestDbclient.updateInfraActiveRequests(request);
+ }catch (Exception ex) {
+ workflowAction.buildAndThrowException(execution, "Error Updating Request Database", ex);
}
- execution.setVariable("mso-service-instance-id", resourceId);
- execution.setVariable("mso-request-id", requestId);
- String falloutRequest = "<aetgt:FalloutHandlerRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\"xmlns:ns=\"http://org.onap/so/request/types/v1\"xmlns:wfsch=\"http://org.onap/so/workflow/schema/v1\"><request-info xmlns=\"http://org.onap/so/infra/vnf-request/v1\"><request-id>"
- + requestId + "</request-id><action>" + action
- + "</action><source>VID</source></request-info><aetgt:WorkflowException xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\"><aetgt:ErrorMessage>"
- + exceptionMsg
- + "</aetgt:ErrorMessage><aetgt:ErrorCode>7000</aetgt:ErrorCode></aetgt:WorkflowException></aetgt:FalloutHandlerRequest>";
- execution.setVariable("falloutRequest", falloutRequest);
}
public void checkRetryStatus(DelegateExecution execution) {
String handlingCode = (String) execution.getVariable("handlingCode");
+ String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ String retryDuration = (String) execution.getVariable("RetryDuration");
int retryCount = (int) execution.getVariable(RETRY_COUNT);
+ int nextCount = retryCount +1;
if (handlingCode.equals("Retry")){
+ workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
+ try{
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ request.setRetryStatusMessage("Retry " + nextCount + "/5 will be started in " + retryDuration);
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch(Exception ex){
+ logger.warn("Failed to update Request Db Infra Active Requests with Retry Status",ex);
+ }
if(retryCount<5){
int currSequence = (int) execution.getVariable("gCurrentSequence");
execution.setVariable("gCurrentSequence", currSequence-1);
- execution.setVariable(RETRY_COUNT, retryCount + 1);
+ execution.setVariable(RETRY_COUNT, nextCount);
}else{
workflowAction.buildAndThrowException(execution, "Exceeded maximum retries. Ending flow with status Abort");
}
@@ -266,6 +266,19 @@ public class WorkflowActionBBTasks {
rollbackFlows.add(flowsToExecute.get(i));
}
}
+
+ int flowSize = rollbackFlows.size();
+ String handlingCode = (String) execution.getVariable("handlingCode");
+ if(handlingCode.equals("RollbackToAssigned")){
+ for(int i = 0; i<flowSize; i++){
+ if(rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign")){
+ rollbackFlows.remove(i);
+ }
+ }
+ }
+
+ workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
+
if (rollbackFlows.isEmpty())
execution.setVariable("isRollbackNeeded", false);
else
@@ -274,45 +287,72 @@ public class WorkflowActionBBTasks {
execution.setVariable("handlingCode", "PreformingRollback");
execution.setVariable("isRollback", true);
execution.setVariable("gCurrentSequence", 0);
+ execution.setVariable(RETRY_COUNT, 0);
}else{
workflowAction.buildAndThrowException(execution, "Rollback has already been called. Cannot rollback a request that is currently in the rollback state.");
}
}
+ protected void updateRequestErrorStatusMessage(DelegateExecution execution) {
+ try {
+ String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ String errorMsg = retrieveErrorMessage(execution);
+ if(errorMsg == null || errorMsg.equals("")){
+ errorMsg = "Failed to determine error message";
+ }
+ request.setStatusMessage(errorMsg);
+ logger.debug("Updating RequestDB to failed: errorMsg = " + errorMsg);
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ logger.error("Failed to update Request db with the status message after retry or rollback has been initialized.",e);
+ }
+ }
+
public void abortCallErrorHandling(DelegateExecution execution) {
String msg = "Flow has failed. Rainy day handler has decided to abort the process.";
logger.error(msg);
throw new BpmnError(msg);
}
-
+
public void updateRequestStatusToFailed(DelegateExecution execution) {
try {
String requestId = (String) execution.getVariable(G_REQUEST_ID);
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
String errorMsg = null;
- boolean rollback = (boolean) execution.getVariable("isRollbackComplete");
- try {
- WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
- if(exception != null && (exception.getErrorMessage()!=null || !exception.getErrorMessage().equals(""))){
- errorMsg = exception.getErrorMessage();
- }
- } catch (Exception ex) {
- //log error and attempt to extact WorkflowExceptionMessage
- logger.error("Failed to extract workflow exception from execution.",ex);
- }
- if (errorMsg == null){
- try {
- errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage");
- } catch (Exception ex) {
- logger.error("Failed to extract workflow exception message from WorkflowException",ex);
- errorMsg = "Unexpected Error in BPMN.";
+ String rollbackErrorMsg = null;
+ boolean rollbackCompleted = (boolean) execution.getVariable("isRollbackComplete");
+ boolean isRollbackFailure = (boolean) execution.getVariable("isRollback");
+ ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock");
+
+ if(rollbackCompleted){
+ rollbackErrorMsg = "Rollback has been completed successfully.";
+ request.setRollbackStatusMessage(rollbackErrorMsg);
+ logger.debug("Updating RequestDB to failed: Rollback has been completed successfully");
+ }else{
+ if(isRollbackFailure){
+ rollbackErrorMsg = retrieveErrorMessage(execution);
+ if(rollbackErrorMsg == null || rollbackErrorMsg.equals("")){
+ rollbackErrorMsg = "Failed to determine rollback error message.";
+ }
+ request.setRollbackStatusMessage(rollbackErrorMsg);
+ logger.debug("Updating RequestDB to failed: rollbackErrorMsg = " + rollbackErrorMsg);
+ }else{
+ errorMsg = retrieveErrorMessage(execution);
+ if(errorMsg == null || errorMsg.equals("")){
+ errorMsg = "Failed to determine error message";
+ }
+ request.setStatusMessage(errorMsg);
+ logger.debug("Updating RequestDB to failed: errorMsg = " + errorMsg);
}
}
- if(rollback){
- errorMsg = errorMsg + " + Rollback has been completed successfully.";
+ if(ebb!=null && ebb.getBuildingBlock()!=null){
+ String flowStatus = ebb.getBuildingBlock().getBpmnFlowName() + " has failed.";
+ request.setFlowStatus(flowStatus);
+ execution.setVariable("flowStatus", flowStatus);
}
+
request.setProgress(Long.valueOf(100));
- request.setStatusMessage(errorMsg);
request.setRequestStatus("FAILED");
request.setLastModifiedBy("CamundaBPMN");
requestDbclient.updateInfraActiveRequests(request);
@@ -321,6 +361,29 @@ public class WorkflowActionBBTasks {
}
}
+ private String retrieveErrorMessage (DelegateExecution execution){
+ String errorMsg = "";
+ try {
+ WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
+ if(exception != null && (exception.getErrorMessage()!=null || !exception.getErrorMessage().equals(""))){
+ errorMsg = exception.getErrorMessage();
+ }
+ } catch (Exception ex) {
+ //log error and attempt to extact WorkflowExceptionMessage
+ logger.error("Failed to extract workflow exception from execution.",ex);
+ }
+
+ if (errorMsg == null || errorMsg.equals("")){
+ try {
+ errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage");
+ } catch (Exception ex) {
+ logger.error("Failed to extract workflow exception message from WorkflowException",ex);
+ errorMsg = "Unexpected Error in BPMN.";
+ }
+ }
+ return errorMsg;
+ }
+
public void updateRequestStatusToFailedWithRollback(DelegateExecution execution) {
execution.setVariable("isRollbackComplete", true);
updateRequestStatusToFailed(execution);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java
new file mode 100644
index 0000000000..2b0f8bf946
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.bpmn.infrastructure.workflow.tasks;
+
+import java.util.List;
+import java.util.Optional;
+
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.Relationships;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class WorkflowActionExtractResourcesAAI {
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowActionExtractResourcesAAI.class);
+
+ public Optional<Configuration> extractRelationshipsConfiguration(Relationships relationships) {
+ List<AAIResultWrapper> configurations = relationships.getByType(AAIObjectType.CONFIGURATION);
+ for(AAIResultWrapper configWrapper : configurations) {
+ Optional<Configuration> config = configWrapper.asBean(Configuration.class);
+ if(config.isPresent()){
+ return config;
+ }
+ }
+ return Optional.empty();
+ }
+
+ public Optional<Relationships> extractRelationshipsVnfc(Relationships relationships) {
+ List<AAIResultWrapper> vnfcs = relationships.getByType(AAIObjectType.VNFC);
+ for(AAIResultWrapper vnfcWrapper : vnfcs){
+ if(vnfcWrapper.getRelationships().isPresent()){
+ return vnfcWrapper.getRelationships();
+ }
+ }
+ return Optional.empty();
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java
index 45f28df756..cdb24401b3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java
@@ -20,6 +20,8 @@
package org.onap.so.client.adapter.network;
+import javax.ws.rs.core.Response;
+
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
@@ -44,4 +46,10 @@ public interface NetworkAdapterClient {
UpdateNetworkResponse updateNetwork(String aaiNetworkId, UpdateNetworkRequest req)
throws NetworkAdapterClientException;
+
+ Response createNetworkAsync(CreateNetworkRequest req) throws NetworkAdapterClientException;
+
+ Response deleteNetworkAsync(String aaiNetworkId, DeleteNetworkRequest req) throws NetworkAdapterClientException;
+
+ Response rollbackNetworkAsync(String aaiNetworkId, RollbackNetworkRequest req) throws NetworkAdapterClientException;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java
index 9b052b4484..7092fe04c6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java
@@ -22,6 +22,7 @@ package org.onap.so.client.adapter.network;
import javax.ws.rs.InternalServerErrorException;
import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
@@ -54,6 +55,15 @@ public class NetworkAdapterClientImpl implements NetworkAdapterClient {
throw new NetworkAdapterClientException(e.getMessage());
}
}
+
+ @Override
+ public Response createNetworkAsync(CreateNetworkRequest req) throws NetworkAdapterClientException{
+ try {
+ return new AdapterRestClient(this.props, this.getUri("").build()).post(req);
+ } catch (InternalServerErrorException e) {
+ throw new NetworkAdapterClientException(e.getMessage());
+ }
+ }
@Override
public DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req) throws NetworkAdapterClientException {
@@ -64,6 +74,15 @@ public class NetworkAdapterClientImpl implements NetworkAdapterClient {
throw new NetworkAdapterClientException(e.getMessage());
}
}
+
+ @Override
+ public Response deleteNetworkAsync(String aaiNetworkId, DeleteNetworkRequest req) throws NetworkAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req);
+ } catch (InternalServerErrorException e) {
+ throw new NetworkAdapterClientException(e.getMessage());
+ }
+ }
@Override
public RollbackNetworkResponse rollbackNetwork(String aaiNetworkId, RollbackNetworkRequest req) throws NetworkAdapterClientException {
@@ -74,6 +93,15 @@ public class NetworkAdapterClientImpl implements NetworkAdapterClient {
throw new NetworkAdapterClientException(e.getMessage());
}
}
+
+ @Override
+ public Response rollbackNetworkAsync(String aaiNetworkId, RollbackNetworkRequest req) throws NetworkAdapterClientException {
+ try {
+ return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req);
+ } catch (InternalServerErrorException e) {
+ throw new NetworkAdapterClientException(e.getMessage());
+ }
+ }
@Override
public QueryNetworkResponse queryNetwork(String aaiNetworkId, String cloudSiteId, String tenantId,
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
index 79a75c532a..4c84ee4003 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
@@ -22,6 +22,7 @@ package org.onap.so.client.adapter.network.mapper;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -50,9 +51,12 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.NetworkRollback;
import org.onap.so.openstack.beans.RouteTarget;
import org.onap.so.openstack.beans.Subnet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.util.UriUtils;
@@ -60,6 +64,7 @@ import org.springframework.web.util.UriUtils;
public class NetworkAdapterObjectMapper {
private static final ModelMapper modelMapper = new ModelMapper();
private static String FORWARD_SLASH = "/";
+ private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterObjectMapper.class);
public CreateNetworkRequest createNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> userInput, String cloudRegionPo, Customer customer) throws UnsupportedEncodingException {
CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest();
@@ -83,15 +88,24 @@ public class NetworkAdapterObjectMapper {
//build and set provider Vlan Network
ProviderVlanNetwork providerVlanNetwork = buildProviderVlanNetwork(l3Network);
createNetworkRequest.setProviderVlanNetwork(providerVlanNetwork);
-
- createNetworkRequest.setNetworkTechnology(setNetworkTechnology(l3Network.getModelInfoNetwork().getNetworkTechnology()));
+ String networkTechnology = l3Network.getModelInfoNetwork().getNetworkTechnology();
+ if(networkTechnology == null) {
+ networkTechnology = l3Network.getNetworkTechnology();
+ logger.warn("NetworkTechnology was null in CatalogDB. Using field from AAI: " + networkTechnology);
+ }
+ if (networkTechnology != null) {
+ createNetworkRequest.setNetworkTechnology(networkTechnology.toUpperCase());
+ if (createNetworkRequest.getNetworkTechnology().contains("CONTRAIL")) {
+ createNetworkRequest.setContrailRequest(true);
+ }
+ }
//build and set Contrail Network
ContrailNetwork contrailNetwork = buildContrailNetwork(l3Network, customer);
createNetworkRequest.setContrailNetwork(contrailNetwork);
- //set Network Parameters from VID request
- createNetworkRequest.setNetworkParams(userInput);
+ //set Network Parameters from VID request, add "shared" and "external" to this map
+ createNetworkRequest.setNetworkParams(addSharedAndExternal(userInput, l3Network));
createNetworkRequest = setFlowFlags(createNetworkRequest, orchestrationContext);
@@ -99,22 +113,11 @@ public class NetworkAdapterObjectMapper {
String messageId = getRandomUuid();
createNetworkRequest.setMessageId(messageId);
- //TODO clarify callback URL build process
- //createNetworkRequest.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId));
+ createNetworkRequest.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId));
return createNetworkRequest;
}
- protected NetworkTechnology setNetworkTechnology(String networkTechnology) {
- if(networkTechnology.equalsIgnoreCase("Contrail")) {
- return NetworkTechnology.CONTRAIL;
- } else if(networkTechnology.equalsIgnoreCase("Neutron")){
- return NetworkTechnology.NEUTRON;
- } else {
- return NetworkTechnology.VMWARE;
- }
- }
-
public DeleteNetworkRequest deleteNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, L3Network l3Network) throws UnsupportedEncodingException {
DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest();
@@ -140,6 +143,8 @@ public class NetworkAdapterObjectMapper {
deleteNetworkRequest.setSkipAAI(true);
deleteNetworkRequest.setTenantId(cloudRegion.getTenantId());
+ deleteNetworkRequest.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId));
+
return deleteNetworkRequest;
}
@@ -173,7 +178,7 @@ public class NetworkAdapterObjectMapper {
updateNetworkRequest.setSubnets(buildOpenstackSubnetList(l3Network));
updateNetworkRequest.setProviderVlanNetwork(buildProviderVlanNetwork(l3Network));
updateNetworkRequest.setContrailNetwork(buildContrailNetwork(l3Network, customer));
- updateNetworkRequest.setNetworkParams(userInput);
+ updateNetworkRequest.setNetworkParams(addSharedAndExternal(userInput, l3Network));
updateNetworkRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
setFlowFlags(updateNetworkRequest, orchestrationContext);
@@ -185,11 +190,10 @@ public class NetworkAdapterObjectMapper {
return updateNetworkRequest;
}
- private RollbackNetworkRequest setCommonRollbackRequestFields(RollbackNetworkRequest request,RequestContext requestContext){
- //TODO confirm flag value
+ private RollbackNetworkRequest setCommonRollbackRequestFields(RollbackNetworkRequest request,RequestContext requestContext) throws UnsupportedEncodingException{
request.setSkipAAI(true);
- request.setMessageId(requestContext.getMsoRequestId());
- //TODO clarify callback URL build process. This will also set SYNC flag
+ String messageId = requestContext.getMsoRequestId();
+ request.setMessageId(messageId);
//request.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId));
return request;
}
@@ -258,6 +262,7 @@ public class NetworkAdapterObjectMapper {
map(source.getGatewayAddress(), destination.getGatewayIp());
map(source.getIpVersion(), destination.getIpVersion());
map(source.isDhcpEnabled(), destination.getEnableDHCP());
+ map(source.getSubnetSequence(), destination.getSubnetSequence());
}
};
modelMapper.addMappings(personMap);
@@ -362,4 +367,16 @@ public class NetworkAdapterObjectMapper {
updateNetworkRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
//NetworkTechnology(NetworkTechnology.NEUTRON); NOOP - default
}
+
+ private Map<String, String> addSharedAndExternal(Map<String, String> userInput, L3Network l3Network) {
+ if (userInput == null)
+ userInput = new HashMap<String, String>();
+ if (!userInput.containsKey("shared")) {
+ userInput.put("shared", Optional.ofNullable(l3Network.isIsSharedNetwork()).orElse(false).toString());
+ }
+ if (!userInput.containsKey("external")) {
+ userInput.put("external", Optional.ofNullable(l3Network.isIsExternalNetwork()).orElse(false).toString());
+ }
+ return userInput;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
index 1f01772d7a..352d4ec7d1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
@@ -32,7 +32,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Optional;
import javax.annotation.PostConstruct;
@@ -87,8 +86,8 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.base.Joiner;
-import jersey.repackaged.com.google.common.base.Joiner;
@Component
public class VnfAdapterVfModuleObjectMapper {
@@ -446,7 +445,6 @@ public class VnfAdapterVfModuleObjectMapper {
}
}
}
-
}
private void buildVfModuleNetworkInformation(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) {
@@ -827,4 +825,4 @@ public class VnfAdapterVfModuleObjectMapper {
}
return baseVfModule;
}
-}
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java
new file mode 100644
index 0000000000..0419896444
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClient.java
@@ -0,0 +1,96 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.client.namingservice;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.onap.namingservice.model.NameGenDeleteRequest;
+import org.onap.namingservice.model.NameGenDeleteResponse;
+import org.onap.namingservice.model.NameGenRequest;
+import org.onap.namingservice.model.NameGenResponse;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.HttpStatusCodeException;
+import org.springframework.web.client.RestTemplate;
+
+
+
+@Component
+public class NamingClient{
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NamingClient.class);
+ private static final String ENDPOINT = "mso.naming.endpoint";
+ private static final String AUTH = "mso.naming.auth";
+
+ @Autowired
+ private RestTemplate restTemplate;
+ @Autowired
+ private Environment env;
+ @Autowired
+ private NamingClientResponseValidator namingClientResponseValidator;
+
+ public String postNameGenRequest(NameGenRequest request) throws BadResponseException, IOException {
+ String targetUrl = env.getProperty(ENDPOINT);
+ HttpHeaders headers = setHeaders(env.getProperty(AUTH));
+ msoLogger.info("Sending postNameGenRequest to url: " + targetUrl);
+ HttpEntity<NameGenRequest> requestEntity = new HttpEntity<>(request, headers);
+ ResponseEntity<NameGenResponse> response;
+ try{
+ response = restTemplate.postForEntity(targetUrl, requestEntity, NameGenResponse.class);
+ }catch(HttpStatusCodeException e){
+ throw new BadResponseException(namingClientResponseValidator.formatError(e));
+ }
+ return namingClientResponseValidator.validateNameGenResponse(response);
+ }
+
+ public String deleteNameGenRequest(NameGenDeleteRequest request) throws BadResponseException, IOException {
+ String targetUrl = env.getProperty(ENDPOINT);
+ HttpHeaders headers = setHeaders(env.getProperty(AUTH));
+ msoLogger.info("Sending deleteNameGenRequest to url: " + targetUrl);
+ HttpEntity<NameGenDeleteRequest> requestEntity = new HttpEntity<>(request, headers);
+ ResponseEntity<NameGenDeleteResponse> response;
+ try{
+ response = restTemplate.exchange(targetUrl, HttpMethod.DELETE, requestEntity, NameGenDeleteResponse.class);
+ }catch(HttpStatusCodeException e){
+ throw new BadResponseException(namingClientResponseValidator.formatError(e));
+ }
+ return namingClientResponseValidator.validateNameGenDeleteResponse(response);
+ }
+
+ private HttpHeaders setHeaders(String auth) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ List<MediaType> acceptableMediaTypes = new ArrayList<>();
+ acceptableMediaTypes.add(MediaType.APPLICATION_JSON);
+ headers.setAccept(acceptableMediaTypes);
+ headers.add(HttpHeaders.AUTHORIZATION, auth);
+ return headers;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
new file mode 100644
index 0000000000..3dcafe0ff4
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
@@ -0,0 +1,142 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.client.namingservice;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.http.HttpStatus;
+import org.onap.namingservice.model.NameGenDeleteResponse;
+import org.onap.namingservice.model.NameGenResponse;
+import org.onap.namingservice.model.NameGenResponseError;
+import org.onap.namingservice.model.Respelement;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.HttpStatusCodeException;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class NamingClientResponseValidator {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NamingClientResponseValidator.class);
+ private static final String INSTANCE_GROUP_NAME = "instance-group-name";
+ private static final String NO_RESPONSE_FROM_NAMING_SERVICE = "Error did not receive a response from Naming Service.";
+ private static final String NULL_RESPONSE_FROM_NAMING_SERVICE = "Error received a null response from Naming Service.";
+ private static final String NAMING_SERVICE_ERROR = "Error from Naming Service: %s";
+
+ public String validateNameGenResponse(ResponseEntity<NameGenResponse> response) throws BadResponseException {
+ if (response == null) {
+ msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, NO_RESPONSE_FROM_NAMING_SERVICE, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_NAMING_SERVICE);
+ throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
+ }
+
+ int responseCode = response.getStatusCodeValue();
+ String generatedName = "";
+ NameGenResponse responseBody = response.getBody();
+ if (responseBody == null) {
+ msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NULL_RESPONSE_FROM_NAMING_SERVICE);
+ throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
+ }
+
+ if (isHttpCodeSuccess(responseCode)) {
+ msoLogger.info("Successful Response from Naming Service");
+ List<Respelement> respList = responseBody.getElements();
+
+ if (respList != null) {
+ for (int i=0; i < respList.size(); i++) {
+ Respelement respElement = respList.get(i);
+ if (respElement != null) {
+ String resourceName = respElement.getResourceName();
+ if (INSTANCE_GROUP_NAME.equals(resourceName)) {
+ generatedName = respElement.getResourceValue();
+ break;
+ }
+ }
+ }
+ }
+ return generatedName;
+ } else {
+ NameGenResponseError error = responseBody.getError();
+ String errorMessageString = NAMING_SERVICE_ERROR;
+ if (error != null) {
+ errorMessageString = error.getMessage();
+ }
+ String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
+ msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, errorMessage, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.DataError, errorMessage);
+ throw new BadResponseException(errorMessage);
+ }
+ }
+
+ public String validateNameGenDeleteResponse(ResponseEntity<NameGenDeleteResponse> response) throws BadResponseException {
+ if (response == null) {
+ msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, NO_RESPONSE_FROM_NAMING_SERVICE, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_NAMING_SERVICE);
+ throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
+ }
+
+ int responseCode = response.getStatusCodeValue();
+ String responseMessage = "";
+ NameGenDeleteResponse responseBody = response.getBody();
+ if (responseBody == null) {
+ msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NULL_RESPONSE_FROM_NAMING_SERVICE);
+ throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
+ }
+
+ if (isHttpCodeSuccess(responseCode)) {
+ msoLogger.info("Successful Response from Naming Service");
+ return responseMessage;
+ } else {
+ String errorMessageString = NAMING_SERVICE_ERROR;
+
+ String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
+ msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, errorMessage, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.DataError, errorMessage);
+ throw new BadResponseException(errorMessage);
+ }
+ }
+
+ private boolean isHttpCodeSuccess(int code) {
+ return code >= HttpStatus.SC_OK && code < HttpStatus.SC_MULTIPLE_CHOICES || code == 0;
+ }
+
+ protected String formatError(HttpStatusCodeException e) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ NameGenResponse errorResponse = mapper.readValue(e.getResponseBodyAsString(), NameGenResponse.class);
+ NameGenResponseError error = errorResponse.getError();
+
+ String errorMessageString = null;
+ if (error != null) {
+ errorMessageString = error.getMessage();
+ }
+ String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
+ msoLogger.error(MessageEnum.RA_GENERAL_EXCEPTION, errorMessage, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.DataError, errorMessage);
+ return errorMessage;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java
new file mode 100644
index 0000000000..ba9f170d71
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObjectBuilder.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.client.namingservice;
+
+import java.util.List;
+
+import org.onap.namingservice.model.Deleteelement;
+import org.onap.namingservice.model.Element;
+import org.onap.namingservice.model.NameGenDeleteRequest;
+import org.onap.namingservice.model.NameGenRequest;
+import org.springframework.stereotype.Component;
+
+@Component
+public class NamingRequestObjectBuilder{
+
+ public Element elementMapper(String instanceGroupId, String policyInstanceName, String namingType, String nfNamingCode, String instanceGroupName){
+ Element element = new Element();
+ element.put("external-key", instanceGroupId);
+ element.put("policy-instance-name", policyInstanceName);
+ element.put("naming-type", namingType);
+ element.put("resource-name", instanceGroupName);
+ element.put("nf-naming-code", nfNamingCode);
+ return element;
+ }
+ public Deleteelement deleteElementMapper(String instanceGroupId){
+ Deleteelement deleteElement = new Deleteelement();
+ deleteElement.setExternalKey(instanceGroupId);
+ return deleteElement;
+ }
+ public NameGenRequest nameGenRequestMapper(List<Element> elements){
+ NameGenRequest nameGenRequest = new NameGenRequest();
+ nameGenRequest.setElements(elements);
+ return nameGenRequest;
+ }
+ public NameGenDeleteRequest nameGenDeleteRequestMapper(List<Deleteelement> deleteElements){
+ NameGenDeleteRequest nameGenDeleteRequest = new NameGenDeleteRequest();
+ nameGenDeleteRequest.setElements(deleteElements);
+ return nameGenDeleteRequest;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
index e13a765cf2..a96f01c3d0 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,10 +38,10 @@ import org.springframework.stereotype.Component;
public class AAIConfigurationResources {
@Autowired
private InjectionHelper injectionHelper;
-
+
@Autowired
private AAIObjectMapper aaiObjectMapper;
-
+
/**
* A&AI call to create configuration
*
@@ -142,24 +142,32 @@ public class AAIConfigurationResources {
*
* @param configurationId
* @param vpnId
+ *
*/
public void connectConfigurationToVpnBinding(String configurationId, String vpnId) {
AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId);
injectionHelper.getAaiClient().connect(configurationURI, vpnBindingURI);
}
-
+
public void connectConfigurationToVfModule(String configurationId, String vfModuleId, String vnfId){
AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
injectionHelper.getAaiClient().connect(configurationURI, vfModuleURI);
}
-
+
public void connectConfigurationToVnfc(String configurationId, String vnfcName){
AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
injectionHelper.getAaiClient().connect(configurationURI, vnfcURI);
}
+
+ public void connectConfigurationToL3Network(String configurationId, String networkId){
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId);
+ injectionHelper.getAaiClient().connect(configurationURI, networkURI);
+ }
+
/**
* method to delete Configuration details in A&AI
*
@@ -188,7 +196,7 @@ public class AAIConfigurationResources {
return injectionHelper.getAaiClient()
.get(org.onap.aai.domain.yang.Configuration.class, AAIUriFactory.createResourceFromExistingURI(AAIObjectType.CONFIGURATION, UriBuilder.fromPath(relatedLink).build()));
}
-
+
public void updateOrchestrationStatusConfiguration(Configuration configuration, OrchestrationStatus orchestrationStatus) {
AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
configuration.setOrchestrationStatus(orchestrationStatus);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
index a4c705b0c7..d2bf95a28e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
@@ -7,9 +7,9 @@
* 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.
@@ -47,22 +47,22 @@ import org.springframework.stereotype.Component;
public class AAINetworkResources {
@Autowired
private InjectionHelper injectionHelper;
-
+
@Autowired
private AAIObjectMapper aaiObjectMapper;
-
+
public void updateNetwork(L3Network network) {
AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(network);
injectionHelper.getAaiClient().update(networkURI, aaiL3Network);
}
-
+
public void updateSubnet(L3Network network, Subnet subnet) {
AAIResourceUri subnetURI = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, network.getNetworkId(), subnet.getSubnetId());
org.onap.aai.domain.yang.Subnet aaiSubnet = aaiObjectMapper.mapSubnet(subnet);
injectionHelper.getAaiClient().update(subnetURI, aaiSubnet);
}
-
+
public void createNetworkConnectToServiceInstance(L3Network network, ServiceInstance serviceInstance) {
AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
@@ -76,97 +76,101 @@ public class AAINetworkResources {
AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
injectionHelper.getAaiClient().delete(networkURI);
}
-
+
public Optional<VpnBinding> getVpnBinding(AAIResourceUri netBindingUri) {
- return injectionHelper.getAaiClient().get(netBindingUri).asBean(VpnBinding.class);
+ return injectionHelper.getAaiClient().get(netBindingUri.depth(Depth.TWO)).asBean(VpnBinding.class);
}
-
+
public Optional<NetworkPolicy> getNetworkPolicy(AAIResourceUri netPolicyUri) {
return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.class);
}
+
+ public Optional<org.onap.aai.domain.yang.Subnet> getSubnet(AAIResourceUri subnetUri) {
+ return injectionHelper.getAaiClient().get(subnetUri).asBean(org.onap.aai.domain.yang.Subnet.class);
+ }
public Optional<RouteTableReference> getRouteTable(AAIResourceUri rTableUri) {
return injectionHelper.getAaiClient().get(rTableUri).asBean(RouteTableReference.class);
}
-
+
public Optional<org.onap.aai.domain.yang.L3Network> queryNetworkById(L3Network l3network) {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK,l3network.getNetworkId()).depth(Depth.ALL);
AAIResultWrapper aaiWrapper = injectionHelper.getAaiClient().get(uri);
return aaiWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
- }
-
+ }
+
public AAIResultWrapper queryNetworkWrapperById(L3Network l3network) {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK,l3network.getNetworkId()).depth(Depth.ALL);
return injectionHelper.getAaiClient().get(uri);
}
-
+
public void createNetworkInstanceGroup(InstanceGroup instanceGroup) {
AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup);
injectionHelper.getAaiClient().create(instanceGroupURI, aaiInstanceGroup);
}
-
+
public void createNetworkCollection(Collection networkCollection) {
AAIResourceUri networkCollectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId());
networkCollection.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(networkCollection);
injectionHelper.getAaiClient().create(networkCollectionURI, aaiCollection);
}
-
+
public void connectNetworkToTenant(L3Network l3network, CloudRegion cloudRegion) {
- AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT,
+ AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT,
cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId());
AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
injectionHelper.getAaiClient().connect(tenantURI, networkURI);
}
-
+
public void connectNetworkToCloudRegion(L3Network l3network, CloudRegion cloudRegion) {
- AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
- injectionHelper.getAaiClient().connect(cloudRegionURI, networkURI);
+ injectionHelper.getAaiClient().connect(networkURI,cloudRegionURI);
}
-
+
public void connectNetworkToNetworkCollectionInstanceGroup(L3Network l3network, InstanceGroup instanceGroup) {
AAIResourceUri netwrokCollectionInstanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
injectionHelper.getAaiClient().connect(netwrokCollectionInstanceGroupURI, networkURI);
}
-
+
public void connectNetworkToNetworkCollectionServiceInstance(L3Network l3network, ServiceInstance networkCollectionServiceInstance) {
AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId());
AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
injectionHelper.getAaiClient().connect(networkCollectionServiceInstanceUri, networkURI);
}
-
+
public void connectNetworkCollectionInstanceGroupToNetworkCollection(InstanceGroup instanceGroup, Collection networkCollection) {
AAIResourceUri networkCollectionUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId());
AAIResourceUri netwrokCollectionInstanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
injectionHelper.getAaiClient().connect(networkCollectionUri, netwrokCollectionInstanceGroupURI);
}
-
+
public void connectInstanceGroupToCloudRegion(InstanceGroup instanceGroup, CloudRegion cloudRegion) {
- AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
injectionHelper.getAaiClient().connect(instanceGroupURI, cloudRegionURI, AAIEdgeLabel.USES);
}
-
+
public void connectNetworkCollectionToServiceInstance(Collection networkCollection, ServiceInstance networkCollectionServiceInstance) {
AAIResourceUri networkCollectionUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId());
AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId());
injectionHelper.getAaiClient().connect(networkCollectionUri, networkCollectionServiceInstanceUri);
}
-
+
public void deleteCollection(Collection collection) {
AAIResourceUri collectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId());
injectionHelper.getAaiClient().delete(collectionURI);
}
-
+
public void deleteNetworkInstanceGroup(InstanceGroup instanceGroup) {
AAIResourceUri instanceGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
injectionHelper.getAaiClient().delete(instanceGroupURI);
}
-
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
index 19025b4b9f..a9a52bd115 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
@@ -110,4 +110,18 @@ public class AAIVnfResources {
.orElse(new org.onap.aai.domain.yang.GenericVnf());
return vnf.isInMaint();
}
+
+ public void connectVnfToCloudRegion(GenericVnf vnf, CloudRegion cloudRegion) {
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
+ cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ injectionHelper.getAaiClient().connect(vnfURI,cloudRegionURI);
+ }
+
+ public void connectVnfToTenant(GenericVnf vnf, CloudRegion cloudRegion) {
+ AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT,
+ cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId());
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+ injectionHelper.getAaiClient().connect(tenantURI, vnfURI);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
new file mode 100644
index 0000000000..d0bf6da6c9
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
@@ -0,0 +1,61 @@
+/*-
+ * ============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.client.orchestration;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.onap.namingservice.model.Element;
+import org.onap.namingservice.model.Deleteelement;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.namingservice.NamingClient;
+import org.onap.so.client.namingservice.NamingRequestObjectBuilder;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class NamingServiceResources {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NamingServiceResources.class);
+ private static final String NAMING_TYPE = "instanceGroup";
+
+ @Autowired
+ private NamingClient namingClient;
+
+ @Autowired
+ private NamingRequestObjectBuilder namingRequestObjectBuilder;
+
+ public String generateInstanceGroupName(InstanceGroup instanceGroup, String policyInstanceName, String nfNamingCode) throws BadResponseException, IOException {
+ Element element = namingRequestObjectBuilder.elementMapper(instanceGroup.getId(), policyInstanceName, NAMING_TYPE, nfNamingCode, instanceGroup.getInstanceGroupName());
+ List<Element> elements = new ArrayList<Element>();
+ elements.add(element);
+ return(namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements)));
+ }
+
+ public String deleteInstanceGroupName(InstanceGroup instanceGroup) throws BadResponseException, IOException {
+ Deleteelement deleteElement = namingRequestObjectBuilder.deleteElementMapper(instanceGroup.getId());
+ List<Deleteelement> deleteElements = new ArrayList<Deleteelement>();
+ deleteElements.add(deleteElement);
+ return(namingClient.deleteNameGenRequest(namingRequestObjectBuilder.nameGenDeleteRequestMapper(deleteElements)));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java
index 3e2b66befa..feb6ed4013 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java
@@ -24,6 +24,8 @@ import java.io.UnsupportedEncodingException;
import java.util.Map;
import java.util.Optional;
+import javax.ws.rs.core.Response;
+
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
@@ -47,7 +49,6 @@ import org.springframework.stereotype.Component;
@Component
public class NetworkAdapterResources {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkAdapterResources.class);
@Autowired
private NetworkAdapterClientImpl networkAdapterClient;
@@ -80,4 +81,29 @@ public class NetworkAdapterResources {
DeleteNetworkRequest deleteNetworkRequest = networkAdapterObjectMapper.deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network);
return Optional.of(networkAdapterClient.deleteNetwork(l3Network.getNetworkId(), deleteNetworkRequest));
}
+
+ public Optional<Response> createNetworkAsync(CreateNetworkRequest createNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional.of(networkAdapterClient.createNetworkAsync(createNetworkRequest));
+ }
+
+ public Optional<Response> deleteNetworkAsync(DeleteNetworkRequest deleteNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional.of(networkAdapterClient.deleteNetworkAsync(deleteNetworkRequest.getNetworkId(), deleteNetworkRequest));
+ }
+
+ public Optional<RollbackNetworkResponse> rollbackCreateNetwork(String networkId, RollbackNetworkRequest rollbackNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional.of(networkAdapterClient.rollbackNetwork(networkId, rollbackNetworkRequest));
+ }
+
+ public Optional<UpdateNetworkResponse> updateNetwork(UpdateNetworkRequest updateNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional.of(networkAdapterClient.updateNetwork(updateNetworkRequest.getNetworkId(), updateNetworkRequest));
+ }
+
+ public Optional<DeleteNetworkResponse> deleteNetwork(DeleteNetworkRequest deleteNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException {
+
+ return Optional.of(networkAdapterClient.deleteNetwork(deleteNetworkRequest.getNetworkId(), deleteNetworkRequest));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java
index 5e3e23e2d0..9dc03ecb88 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java
@@ -35,96 +35,89 @@ import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.net.URI;
+
import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
@Component
public class SDNCConfigurationResources {
- @Autowired
- private GCTopologyOperationRequestMapper sdncRM;
-
- @Autowired
- private SDNCClient sdncClient;
-
- /**
- * SDN-C call to assign configuration after it was created in A&AI
- *
- * @param serviceInstance
- * @param requestContext
- * @param vnrConfiguration
- * @param voiceVnf
- * @return
- * @throws MapperException
- * @throws BadResponseException
- */
- public String assignVnrConfiguration(ServiceInstance serviceInstance,
- RequestContext requestContext,
- Customer customer,
- Configuration vnrConfiguration,
- GenericVnf voiceVnf)
- throws MapperException, BadResponseException {
- GenericResourceApiGcTopologyOperationInformation sdncReq = sdncRM.assignOrActivateVnrReqMapper(
- SDNCSvcAction.ASSIGN,
- GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE ,
- serviceInstance , requestContext, customer, vnrConfiguration,voiceVnf);
- return sdncClient.post(sdncReq, SDNCTopology.CONFIGURATION);
- }
-
- /**
- * SDNC Call to Activate VNR Configuration
- *
- * @param serviceInstance
- * @param requestContext
- * @param vnrConfiguration
- * @param voiceVnf
- * @return
- * @throws MapperException
- * @throws BadResponseException
- */
- public String activateVnrConfiguration(ServiceInstance serviceInstance,
- RequestContext requestContext,
- Customer customer,
- Configuration vnrConfiguration,
- GenericVnf voiceVnf)
- throws MapperException, BadResponseException {
+ @Autowired
+ private GCTopologyOperationRequestMapper sdncRM;
- GenericResourceApiGcTopologyOperationInformation sdncReq = sdncRM.assignOrActivateVnrReqMapper(
- SDNCSvcAction.ACTIVATE,
- GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE ,
- serviceInstance , requestContext, customer, vnrConfiguration, voiceVnf);
- return sdncClient.post(sdncReq, SDNCTopology.CONFIGURATION);
- }
+ /**
+ * SDN-C call to assign configuration after it was created in A&AI
+ *
+ * @param serviceInstance
+ * @param requestContext
+ * @param vnrConfiguration
+ * @param voiceVnf
+ * @return
+ * @throws MapperException
+ * @throws BadResponseException
+ */
+ public GenericResourceApiGcTopologyOperationInformation assignVnrConfiguration(ServiceInstance serviceInstance,
+ RequestContext requestContext,
+ Customer customer,
+ Configuration vnrConfiguration,
+ GenericVnf voiceVnf, String sdncRequestId, URI callbackUri)
+ throws MapperException, BadResponseException {
+ return sdncRM.assignOrActivateVnrReqMapper(
+ SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE ,
+ serviceInstance , requestContext, customer, vnrConfiguration,voiceVnf,sdncRequestId,callbackUri);
+ }
- /**
- * method to unAssign Vnr Configuration in SDNC
- *
- * @param serviceInstance
- * @param requestContext
- * @param vnrConfiguration
- * @return
- * @throws BadResponseException
- * @throws MapperException
- */
- public String unAssignVnrConfiguration(ServiceInstance serviceInstance, RequestContext requestContext,
- Configuration vnrConfiguration) throws BadResponseException, MapperException {
+ /**
+ * SDNC Call to Activate VNR Configuration
+ *
+ * @param serviceInstance
+ * @param requestContext
+ * @param vnrConfiguration
+ * @param voiceVnf
+ * @return
+ * @throws MapperException
+ * @throws BadResponseException
+ */
+ public GenericResourceApiGcTopologyOperationInformation activateVnrConfiguration(ServiceInstance serviceInstance,
+ RequestContext requestContext,
+ Customer customer,
+ Configuration vnrConfiguration,
+ GenericVnf voiceVnf, String sdncRequestId, URI callbackUri)
+ throws MapperException, BadResponseException {
+ return sdncRM.assignOrActivateVnrReqMapper(
+ SDNCSvcAction.ACTIVATE,
+ GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE,
+ serviceInstance , requestContext, customer, vnrConfiguration, voiceVnf,sdncRequestId,callbackUri);
+ }
- GenericResourceApiGcTopologyOperationInformation sdncReq = sdncRM.deactivateOrUnassignVnrReqMapper
- (SDNCSvcAction.UNASSIGN,serviceInstance, requestContext, vnrConfiguration);
- return sdncClient.post(sdncReq, SDNCTopology.CONFIGURATION);
- }
+ /**
+ * method to unAssign Vnr Configuration in SDNC
+ *
+ * @param serviceInstance
+ * @param requestContext
+ * @param vnrConfiguration
+ * @return
+ * @throws BadResponseException
+ * @throws MapperException
+ */
+ public GenericResourceApiGcTopologyOperationInformation unAssignVnrConfiguration(ServiceInstance serviceInstance, RequestContext requestContext,
+ Configuration vnrConfiguration, String sdncRequestId, URI callbackUri) throws BadResponseException, MapperException {
+ return sdncRM.deactivateOrUnassignVnrReqMapper
+ (SDNCSvcAction.UNASSIGN,serviceInstance, requestContext, vnrConfiguration,sdncRequestId,callbackUri);
+ }
- /***
- * Deactivate VNR SDNC Call
- * @param serviceInstance
- * @param requestContext
- * @param vnrConfiguration
- * @throws BadResponseException
- * @throws MapperException
- */
- public String deactivateVnrConfiguration(ServiceInstance serviceInstance, RequestContext requestContext, Configuration vnrConfiguration) throws BadResponseException, MapperException {
- GenericResourceApiGcTopologyOperationInformation sdncReq = sdncRM.deactivateOrUnassignVnrReqMapper(
- SDNCSvcAction.DEACTIVATE,
- serviceInstance , requestContext, vnrConfiguration);
- return sdncClient.post(sdncReq, SDNCTopology.CONFIGURATION);
- }
+ /***
+ * Deactivate VNR SDNC Call
+ * @param serviceInstance
+ * @param requestContext
+ * @param vnrConfiguration
+ * @throws BadResponseException
+ * @throws MapperException
+ */
+ public GenericResourceApiGcTopologyOperationInformation deactivateVnrConfiguration(ServiceInstance serviceInstance, RequestContext requestContext, Configuration vnrConfiguration, String sdncRequestId, URI callbackUri) throws BadResponseException, MapperException {
+ return sdncRM.deactivateOrUnassignVnrReqMapper(
+ SDNCSvcAction.DEACTIVATE,
+ serviceInstance , requestContext, vnrConfiguration,sdncRequestId,callbackUri);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
index d3589db101..8b53c28547 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
@@ -20,92 +20,81 @@
package org.onap.so.client.orchestration;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
-import org.onap.so.client.exception.BadResponseException;
-import org.onap.so.client.exception.MapperException;
-import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
-import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
-
@Component
public class SDNCNetworkResources {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCNetworkResources.class);
-
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
+ SDNCNetworkResources.class);
+
@Autowired
private NetworkTopologyOperationRequestMapper sdncRM;
-
- @Autowired
- private SDNCClient sdncClient;
- public String assignNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer,
- RequestContext requestContext, CloudRegion cloudRegion)
- throws MapperException, BadResponseException {
-
- GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION,
- SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
- return sdncClient.post(sdncReq, SDNCTopology.NETWORK);
+ public GenericResourceApiNetworkOperationInformation assignNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
}
-
- public String rollbackAssignNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer,
- RequestContext requestContext, CloudRegion cloudRegion)
- throws MapperException, BadResponseException {
-
- GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION,
- SDNCSvcAction.UNASSIGN, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
- return sdncClient.post(sdncReq, SDNCTopology.NETWORK);
+
+ public GenericResourceApiNetworkOperationInformation rollbackAssignNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
}
- public String activateNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer,
- RequestContext requestContext, CloudRegion cloudRegion)
- throws MapperException, BadResponseException {
-
- GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION,
- SDNCSvcAction.ACTIVATE, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
- return sdncClient.post(sdncReq, SDNCTopology.NETWORK);
+ public GenericResourceApiNetworkOperationInformation activateNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE,
+ GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
}
-
- public String deactivateNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer, RequestContext requestContext, CloudRegion cloudRegion) throws MapperException, BadResponseException {
- GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION,
- SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
- return sdncClient.post(sdncReq, SDNCTopology.NETWORK);
+
+ public GenericResourceApiNetworkOperationInformation deactivateNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
}
- public String deleteNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer,
- RequestContext requestContext, CloudRegion cloudRegion)
- throws MapperException, BadResponseException {
-
- GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION,
- SDNCSvcAction.DELETE, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
- return sdncClient.post(sdncReq, SDNCTopology.NETWORK);
+ public GenericResourceApiNetworkOperationInformation deleteNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
}
-
- public String changeAssignNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer,
- RequestContext requestContext, CloudRegion cloudRegion)
- throws MapperException, BadResponseException {
-
- GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
- return sdncClient.post(sdncReq, SDNCTopology.NETWORK);
+
+ public GenericResourceApiNetworkOperationInformation changeAssignNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
}
- public String unassignNetwork(L3Network network, ServiceInstance serviceInstance, Customer customer,
- RequestContext requestContext, CloudRegion cloudRegion)
- throws MapperException, BadResponseException {
-
- GenericResourceApiNetworkOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION,
- SDNCSvcAction.UNASSIGN, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
- return sdncClient.post(sdncReq, SDNCTopology.NETWORK);
- }
-
+ public GenericResourceApiNetworkOperationInformation unassignNetwork(L3Network network,
+ ServiceInstance serviceInstance, Customer customer, RequestContext requestContext,
+ CloudRegion cloudRegion) {
+ return sdncRM.reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
+ GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
+ requestContext, cloudRegion);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java
index ad9e201862..a4c9b8fe05 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java
@@ -20,37 +20,28 @@
package org.onap.so.client.orchestration;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
-import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.onap.so.client.sdnc.mapper.ServiceTopologyOperationMapper;
-import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
-import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
-
@Component
public class SDNCServiceInstanceResources {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
- SDNCServiceInstanceResources.class);
-
@Autowired
private ServiceTopologyOperationMapper sdncRM;
-
- @Autowired
- private SDNCClient sdncClient;
-
+
/**
- * SDNC call to perform Service Topology Assign for ServiceInsatnce
+ * SDNC call to perform Service Topology Assign for ServiceInsatnce
+ *
* @param serviceInstance
* @param customer
* @param requestContext
@@ -58,16 +49,16 @@ public class SDNCServiceInstanceResources {
* @throws BadResponseException
* @return the response as a String
*/
- public String assignServiceInstance(ServiceInstance serviceInstance, Customer customer,
- RequestContext requestContext) throws MapperException, BadResponseException {
- GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper(
- SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
+ public GenericResourceApiServiceOperationInformation assignServiceInstance(ServiceInstance serviceInstance,
+ Customer customer, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
requestContext);
- return sdncClient.post(sdncReq, SDNCTopology.SERVICE);
}
/**
- * SDNC call to perform Service Topology Delete for ServiceInsatnce
+ * SDNC call to perform Service Topology Delete for ServiceInsatnce
+ *
* @param serviceInstance
* @param customer
* @param requestContext
@@ -75,24 +66,23 @@ public class SDNCServiceInstanceResources {
* @throws BadResponseException
* @return the response as a String
*/
- public String deleteServiceInstance(ServiceInstance serviceInstance, Customer customer,
- RequestContext requestContext) throws MapperException, BadResponseException {
- GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper(
- SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE, GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
+ public GenericResourceApiServiceOperationInformation deleteServiceInstance(ServiceInstance serviceInstance,
+ Customer customer, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
+ GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
requestContext);
- return sdncClient.post(sdncReq, SDNCTopology.SERVICE);
}
-
- public String unassignServiceInstance(ServiceInstance serviceInstance, Customer customer,
- RequestContext requestContext) throws MapperException, BadResponseException {
- GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper(
- SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE, GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
+
+ public GenericResourceApiServiceOperationInformation unassignServiceInstance(ServiceInstance serviceInstance,
+ Customer customer, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DELETE,
+ GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
requestContext);
- return sdncClient.post(sdncReq, SDNCTopology.SERVICE);
}
-
+
/**
* SDNC call to perform Service Topology Deactivate for ServiceInstance
+ *
* @param serviceInstance
* @param customer
* @param requestContext
@@ -100,16 +90,17 @@ public class SDNCServiceInstanceResources {
* @throws BadResponseException
* @return the response as a String
*/
- public String deactivateServiceInstance(ServiceInstance serviceInstance, Customer customer,
- RequestContext requestContext) throws MapperException, BadResponseException {
- GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper(
- SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
+ public GenericResourceApiServiceOperationInformation deactivateServiceInstance(ServiceInstance serviceInstance,
+ Customer customer, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
+ GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE, serviceInstance, customer,
requestContext);
- return sdncClient.post(sdncReq, SDNCTopology.SERVICE);
}
-
+
/**
- * SDNC call to perform Service Topology Change Assign for the ServiceInstance
+ * SDNC call to perform Service Topology Change Assign for the
+ * ServiceInstance
+ *
* @param serviceInstance
* @param customer
* @param requestContext
@@ -117,8 +108,10 @@ public class SDNCServiceInstanceResources {
* @throws BadResponseException
* @return the response as a String
*/
- public String changeModelServiceInstance(ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) throws MapperException, BadResponseException {
- GenericResourceApiServiceOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, requestContext);
- return sdncClient.post(sdncReq, SDNCTopology.SERVICE);
+ public GenericResourceApiServiceOperationInformation changeModelServiceInstance(ServiceInstance serviceInstance,
+ Customer customer, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
+ GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
+ requestContext);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
index 3c192e1b1c..e7f0a40d2a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
@@ -33,7 +33,6 @@ import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
@@ -41,59 +40,51 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCVfModuleResources {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCVfModuleResources.class);
-
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
+ SDNCVfModuleResources.class);
+
@Autowired
private VfModuleTopologyOperationRequestMapper sdncRM;
-
+
@Autowired
private SDNCClient sdncClient;
-
- public String assignVfModule(VfModule vfModule, VolumeGroup volumeGroup,GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException, BadResponseException {
-
- GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
- SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- return sdncClient.post(sdncReq, SDNCTopology.VFMODULE);
- }
- public String unassignVfModule(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance)
- throws MapperException, BadResponseException {
-
- GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
- SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, null, null);
- return sdncClient.post(sdncReq, SDNCTopology.VFMODULE);
+ public GenericResourceApiVfModuleOperationInformation assignVfModule(VfModule vfModule, VolumeGroup volumeGroup,
+ GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion,
+ RequestContext requestContext) throws MapperException {
+ return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule,
+ volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
}
- public String deactivateVfModule(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException, BadResponseException {
+ public GenericResourceApiVfModuleOperationInformation unassignVfModule(VfModule vfModule, GenericVnf vnf,
+ ServiceInstance serviceInstance) throws MapperException {
+ return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null,
+ vnf, serviceInstance, null, null, null, null);
+ }
- GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(
- SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null, vnf, serviceInstance,
- customer, cloudRegion, requestContext, null);
- return sdncClient.post(sdncReq, SDNCTopology.VFMODULE);
+ public GenericResourceApiVfModuleOperationInformation deactivateVfModule(VfModule vfModule, GenericVnf vnf,
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException {
+ return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null,
+ vnf, serviceInstance, customer, cloudRegion, requestContext, null);
}
-
- public String queryVfModule(VfModule vfModule)
- throws MapperException, BadResponseException {
-
- String objectPath = vfModule.getSelflink();
+
+ public String queryVfModule(VfModule vfModule) throws MapperException, BadResponseException {
+ String objectPath = vfModule.getSelflink();
return sdncClient.get(objectPath);
}
-
- public String activateVfModule(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException, BadResponseException {
-
- GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
- SDNCSvcAction.ACTIVATE, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- return sdncClient.post(sdncReq, SDNCTopology.VFMODULE);
+
+ public GenericResourceApiVfModuleOperationInformation activateVfModule(VfModule vfModule, GenericVnf vnf,
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException {
+ return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, vfModule, null,
+ vnf, serviceInstance, customer, cloudRegion, requestContext, null);
}
-
- public String changeAssignVfModule(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext) throws MapperException, BadResponseException {
- GenericResourceApiVfModuleOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
- return sdncClient.post(sdncReq, SDNCTopology.VFMODULE);
+
+ public GenericResourceApiVfModuleOperationInformation changeAssignVfModule(VfModule vfModule, GenericVnf vnf,
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
+ throws MapperException {
+ return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule,
+ null, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
index f8a9390398..e5194e3e37 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
@@ -32,7 +32,6 @@ import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
@@ -48,54 +47,42 @@ public class SDNCVnfResources {
@Autowired
private SDNCClient sdncClient;
- public String assignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext, boolean homing)
- throws MapperException, BadResponseException {
- GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
+ public GenericResourceApiVnfOperationInformation assignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
+ CloudRegion cloudRegion, RequestContext requestContext, boolean homing) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, homing);
- return sdncClient.post(sdncReq, SDNCTopology.VNF);
}
- public String activateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException, BadResponseException {
- GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
+ public GenericResourceApiVnfOperationInformation activateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
+ CloudRegion cloudRegion, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
SDNCSvcAction.ACTIVATE,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,cloudRegion, requestContext, false);
- return sdncClient.post(sdncReq, SDNCTopology.VNF);
}
- public String deactivateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException, BadResponseException {
- GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
+ public GenericResourceApiVnfOperationInformation deactivateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
+ CloudRegion cloudRegion, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
SDNCSvcAction.DEACTIVATE,GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,cloudRegion, requestContext, false);
- return sdncClient.post(sdncReq, SDNCTopology.VNF);
}
- public String unassignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException, BadResponseException {
- GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
+ public GenericResourceApiVnfOperationInformation unassignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
+ CloudRegion cloudRegion, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
SDNCSvcAction.UNASSIGN,GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, false);
- return sdncClient.post(sdncReq, SDNCTopology.VNF);
}
- public String deleteVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException, BadResponseException {
- GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
+ public GenericResourceApiVnfOperationInformation deleteVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
+ CloudRegion cloudRegion, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE,vnf, serviceInstance, customer, cloudRegion, requestContext, false);
- return sdncClient.post(sdncReq, SDNCTopology.VNF);
}
- public String changeModelVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
- CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException, BadResponseException {
- GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
+ public GenericResourceApiVnfOperationInformation changeModelVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer,
+ CloudRegion cloudRegion, RequestContext requestContext) {
+ return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
SDNCSvcAction.CHANGE_ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, false);
- return sdncClient.post(sdncReq, SDNCTopology.VNF);
}
public String queryVnf(GenericVnf vnf) throws MapperException, BadResponseException {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
index 67843a7ef9..7ad2ef00b2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
@@ -21,7 +21,6 @@
package org.onap.so.client.sdnc;
import java.util.LinkedHashMap;
-import java.util.Optional;
import javax.ws.rs.core.UriBuilder;
@@ -36,19 +35,17 @@ import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
@Component
public class SDNCClient {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCClient.class);
- private BaseClient<String, LinkedHashMap<?, ?>> STOClient = new BaseClient<>();
+ private BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
@Autowired
private SDNCProperties properties;
@Autowired
private SdnCommonTasks sdnCommonTasks;
+
/**
*
* @param request
@@ -59,15 +56,25 @@ public class SDNCClient {
* @throws BadResponseException
*/
public String post(Object request, SDNCTopology topology) throws MapperException, BadResponseException {
- String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
- String targetUrl = properties.getHost() + properties.getPath() + ":" + topology.toString() + "/";
- STOClient.setTargetUrl(targetUrl);
- HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
- STOClient.setHttpHeader(httpHeader);
- LinkedHashMap<?, ?> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {});
- return sdnCommonTasks.validateSDNResponse(output);
+ String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
+ String targetUrl = properties.getHost() + properties.getPath() + ":" + topology.toString() + "/";
+ STOClient.setTargetUrl(targetUrl);
+ HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
+ STOClient.setHttpHeader(httpHeader);
+ LinkedHashMap<String, Object> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
+ return sdnCommonTasks.validateSDNResponse(output);
}
-
+
+
+ public String post(Object request, String url) throws MapperException, BadResponseException {
+ String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
+ STOClient.setTargetUrl(url);
+ HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
+ STOClient.setHttpHeader(httpHeader);
+ LinkedHashMap<String, Object> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
+ return sdnCommonTasks.validateSDNResponse(output);
+ }
+
/**
*
* @param queryLink
@@ -79,15 +86,14 @@ public class SDNCClient {
* @throws BadResponseException
*/
public String get(String queryLink) throws MapperException, BadResponseException {
-
- String request = "";
- String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
- String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString();
- STOClient.setTargetUrl(targetUrl);
- HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
- STOClient.setHttpHeader(httpHeader);
- LinkedHashMap<?, ?> output = STOClient.get(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {});
- return sdnCommonTasks.validateSDNGetResponse(output);
+ String request = "";
+ String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
+ String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString();
+ STOClient.setTargetUrl(targetUrl);
+ HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
+ STOClient.setHttpHeader(httpHeader);
+ LinkedHashMap<String, Object> output = STOClient.get(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
+ return sdnCommonTasks.validateSDNGetResponse(output);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
index ee1d432b6f..13ba107576 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
@@ -92,25 +92,33 @@ public class SdnCommonTasks {
* @return
* @throws BadResponseException
*/
- public String validateSDNResponse(LinkedHashMap<?, ?> output) throws BadResponseException {
+ public String validateSDNResponse(LinkedHashMap<String, Object> output) throws BadResponseException {
if (CollectionUtils.isEmpty(output)) {
msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, NO_RESPONSE_FROM_SDNC, "BPMN",
MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_SDNC);
throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
}
- LinkedHashMap<?, ?> embeddedResponse =(LinkedHashMap<?, ?>) output.get("output");
+ LinkedHashMap<String, Object> embeddedResponse =(LinkedHashMap<String, Object>) output.get("output");
String responseCode = "";
String responseMessage = "";
if (embeddedResponse != null) {
responseCode = (String) embeddedResponse.get(RESPONSE_CODE);
responseMessage = (String) embeddedResponse.get(RESPONSE_MESSAGE);
}
-
+ ObjectMapper objMapper = new ObjectMapper();
+ String jsonResponse;
+ try {
+ jsonResponse = objMapper.writeValueAsString(output);
+ msoLogger.debug(jsonResponse);
+ } catch (JsonProcessingException e) {
+ msoLogger.warnSimple("Could not convert SDNC Response to String", e);
+ jsonResponse = "";
+ }
msoLogger.info("ResponseCode: " + responseCode + " ResponseMessage: " + responseMessage);
int code = StringUtils.isNotEmpty(responseCode) ? Integer.parseInt(responseCode) : 0;
if (isHttpCodeSuccess(code)) {
msoLogger.info("Successful Response from SDNC");
- return responseMessage;
+ return jsonResponse;
} else {
String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage);
msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, errorMessage, "BPMN", MsoLogger.getServiceName(),
@@ -125,7 +133,7 @@ public class SdnCommonTasks {
* @return
* @throws BadResponseException
*/
- public String validateSDNGetResponse(LinkedHashMap<?, ?> output) throws BadResponseException {
+ public String validateSDNGetResponse(LinkedHashMap<String, Object> output) throws BadResponseException {
if (CollectionUtils.isEmpty(output)) {
msoLogger.error(MessageEnum.RA_RESPONSE_FROM_SDNC, NO_RESPONSE_FROM_SDNC, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, NO_RESPONSE_FROM_SDNC);
throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
@@ -143,6 +151,7 @@ public class SdnCommonTasks {
msoLogger.debug("Received from GET request: " + stringOutput);
return stringOutput;
}
+
private boolean isHttpCodeSuccess(int code) {
return code >= HttpStatus.SC_OK && code < HttpStatus.SC_MULTIPLE_CHOICES || code == 0;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
new file mode 100644
index 0000000000..3ee560f4f4
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.client.sdnc.beans;
+
+import java.io.Serializable;
+import java.time.Duration;
+import java.util.UUID;
+
+import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+
+public class SDNCRequest implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4679678988657593282L;
+ private String timeOut = "PT1H";
+ private SDNCTopology topology;
+ private String CorrelationValue = UUID.randomUUID().toString();
+ private String CorrelationName = "SDNCCallback";
+ private Object SDNCPayload;
+
+
+ public String getTimeOut() {
+ return timeOut;
+ }
+
+ public void setTimeOut(String timeOut) {
+ this.timeOut = timeOut;
+ }
+
+ public SDNCTopology getTopology() {
+ return topology;
+ }
+
+ public void setTopology(SDNCTopology topology) {
+ this.topology = topology;
+ }
+
+ public String getCorrelationValue() {
+ return CorrelationValue;
+ }
+ public void setCorrelationValue(String correlationValue) {
+ CorrelationValue = correlationValue;
+ }
+ public String getCorrelationName() {
+ return CorrelationName;
+ }
+ public void setCorrelationName(String correlationName) {
+ CorrelationName = correlationName;
+ }
+ public Object getSDNCPayload() {
+ return SDNCPayload;
+ }
+ public void setSDNCPayload(Object sDNCPayload) {
+ SDNCPayload = sDNCPayload;
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof SDNCRequest)) {
+ return false;
+ }
+ SDNCRequest castOther = (SDNCRequest) other;
+ return new EqualsBuilder().append(CorrelationValue, castOther.CorrelationValue)
+ .append(CorrelationName, castOther.CorrelationName).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(CorrelationValue).append(CorrelationName).toHashCode();
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java
index 76a947a299..2cd0947fa8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java
@@ -20,6 +20,8 @@
package org.onap.so.client.sdnc.mapper;
+import java.net.URI;
+
import org.onap.sdnc.northbound.client.model.*;
import org.onap.so.bpmn.servicedecomposition.bbobjects.*;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
@@ -37,11 +39,10 @@ public class GCTopologyOperationRequestMapper {
RequestContext requestContext,
Customer customer,
Configuration vnrConfiguration,
- GenericVnf voiceVnf) {
+ GenericVnf voiceVnf, String sdncReqId,URI callbackUri) {
GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
- String sdncReqId = requestContext.getMsoRequestId();
- GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);// TODO Set URL
+ GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId,callbackUri.toString());
GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, reqAction);
GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, false);
GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = generalTopologyObjectMapper.buildConfigurationInformation(vnrConfiguration,true);
@@ -60,12 +61,11 @@ public class GCTopologyOperationRequestMapper {
public GenericResourceApiGcTopologyOperationInformation deactivateOrUnassignVnrReqMapper(SDNCSvcAction svcAction,
ServiceInstance serviceInstance,
RequestContext requestContext,
- Configuration vnrConfiguration) {
+ Configuration vnrConfiguration, String sdncReqId, URI callbackUri) {
- GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
- String sdncReqId = requestContext.getMsoRequestId();
+ GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation();
GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
- generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);// TODO Set URL
+ generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId,callbackUri.toString());
GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
.buildGenericResourceApiRequestinformationRequestInformation(sdncReqId,
GenericResourceApiRequestActionEnumeration.DELETEGENERICCONFIGURATIONINSTANCE);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
index 3975b25356..9bbd665e4c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
@@ -24,11 +24,14 @@ import org.onap.sdnc.northbound.client.model.*;
import org.onap.so.bpmn.servicedecomposition.bbobjects.*;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.onap.so.client.exception.MapperException;
@Component
public class GeneralTopologyObjectMapper {
+
/*
* Build GenericResourceApiRequestinformationRequestInformation
@@ -135,10 +138,17 @@ public class GeneralTopologyObjectMapper {
vfModuleInformation.setFromPreload(null);
return vfModuleInformation;
}
+
+
public GenericResourceApiSdncrequestheaderSdncRequestHeader buildSdncRequestHeader(SDNCSvcAction svcAction, String sdncReqId){
+ return buildSdncRequestHeader(svcAction, sdncReqId, null);
+ }
+
+ public GenericResourceApiSdncrequestheaderSdncRequestHeader buildSdncRequestHeader(SDNCSvcAction svcAction, String sdncReqId, String callbackUrl){
GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = new GenericResourceApiSdncrequestheaderSdncRequestHeader();
sdncRequestHeader.setSvcAction(svcAction.getSdncApiAction());
sdncRequestHeader.setSvcRequestId(sdncReqId);
+ sdncRequestHeader.setSvcNotificationUrl(callbackUrl);
return sdncRequestHeader;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java
index bf128a4838..e860d3cc48 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java
@@ -123,7 +123,7 @@ public class VnfTopologyOperationRequestMapper {
List<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds> networkInstanceGroupIdList = new ArrayList<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds>();
for (InstanceGroup instanceGroup : instanceGroups) {
- if (ModelInfoInstanceGroup.TYPE_NETWORK_INSTANCE_GROUP
+ if (ModelInfoInstanceGroup.TYPE_L3_NETWORK
.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds instanceGroupId = new GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds();
instanceGroupId.setVnfNetworkInstanceGroupId(instanceGroup.getId());
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
index eb12278528..7f09305d95 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
@@ -72,12 +72,12 @@ public class SniroClient {
header.set("X-patchVersion", managerProperties.getHeaders().get("patchVersion"));
header.set("X-minorVersion", managerProperties.getHeaders().get("minorVersion"));
header.set("X-latestVersion", managerProperties.getHeaders().get("latestVersion"));
- BaseClient<String, LinkedHashMap<?, ?>> baseClient = new BaseClient<>();
+ BaseClient<String, LinkedHashMap<String, Object>> baseClient = new BaseClient<>();
baseClient.setTargetUrl(url);
baseClient.setHttpHeader(header);
- LinkedHashMap<?, ?> response = baseClient.post(homingRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {});
+ LinkedHashMap<String, Object> response = baseClient.post(homingRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
validator.validateDemandsResponse(response);
log.trace("Completed Sniro Client Post Demands");
}
@@ -102,12 +102,12 @@ public class SniroClient {
HttpHeaders header = new HttpHeaders();
header.setContentType(MediaType.APPLICATION_JSON);
header.set("Authorization", UrnPropertiesReader.getVariable("sniro.conductor.headers.auth"));
- BaseClient<String, LinkedHashMap<?, ?>> baseClient = new BaseClient<>();
+ BaseClient<String, LinkedHashMap<String, Object>> baseClient = new BaseClient<>();
baseClient.setTargetUrl(url);
baseClient.setHttpHeader(header);
- LinkedHashMap<?, ?> response = baseClient.post(releaseRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {});
+ LinkedHashMap<String, Object> response = baseClient.post(releaseRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
SniroValidator v = new SniroValidator();
v.validateReleaseResponse(response);
log.trace("Completed Sniro Client Post Release");
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java
index bad45c87f2..0d0c1be5aa 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java
@@ -43,7 +43,7 @@ public class SniroValidator {
*
* @throws BadResponseException
*/
- public void validateDemandsResponse(LinkedHashMap<?, ?> response) throws BadResponseException {
+ public void validateDemandsResponse(LinkedHashMap<String, Object> response) throws BadResponseException {
log.debug("Validating Sniro Managers synchronous response");
if(!response.isEmpty()){
JSONObject jsonResponse = new JSONObject(response);
@@ -105,7 +105,7 @@ public class SniroValidator {
*
* @throws BadResponseException
*/
- public void validateReleaseResponse(LinkedHashMap<?, ?> response) throws BadResponseException {
+ public void validateReleaseResponse(LinkedHashMap<String, Object> response) throws BadResponseException {
log.debug("Validating Sniro Conductors response");
if(!response.isEmpty()){
String status = (String) response.get("status");
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
new file mode 100644
index 0000000000..b42636b078
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.client.sniro.beans;
+
+import java.io.Serializable;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Candidate implements Serializable{
+
+ private static final long serialVersionUID = -5474502255533410907L;
+
+ @JsonProperty("candidateType")
+ private CandidateType candidateType;
+ @JsonProperty("candidates")
+ private List<String> candidates;
+ @JsonProperty("cloudOwner")
+ private String cloudOwner;
+
+
+ public CandidateType getCandidateType(){
+ return candidateType;
+ }
+
+ public void setCandidateType(CandidateType candidateType){
+ this.candidateType = candidateType;
+ }
+
+ public List<String> getCandidates(){
+ return candidates;
+ }
+
+ public void setCandidates(List<String> candidates){
+ this.candidates = candidates;
+ }
+
+ public String getCloudOwner(){
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner){
+ this.cloudOwner = cloudOwner;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java
new file mode 100644
index 0000000000..d8984c0b83
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.client.sniro.beans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class CandidateType implements Serializable{
+
+ private static final long serialVersionUID = 2273215496314532173L;
+
+ @JsonProperty("name")
+ private String name;
+
+
+ public String getName(){
+ return name;
+ }
+
+ public void setName(String name){
+ this.name = name;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
new file mode 100644
index 0000000000..ed7875f286
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.client.sniro.beans;
+
+import java.io.Serializable;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Demand implements Serializable{
+
+ private static final long serialVersionUID = 5676094538091859816L;
+
+ @JsonProperty("serviceResourceId")
+ private String serviceResourceId;
+ @JsonProperty("resourceModuleName")
+ private String resourceModuleName;
+ @JsonProperty("resourceModelInfo")
+ private ModelInfo modelInfo;
+ @JsonProperty("requiredCandidates")
+ private List<Candidate> requiredCandidates;
+ @JsonProperty("excludedCandidates")
+ private List<Candidate> excludedCandidates;
+
+
+ public List<Candidate> getRequiredCandidates(){
+ return requiredCandidates;
+ }
+
+ public void setRequiredCandidates(List<Candidate> requiredCandidates){
+ this.requiredCandidates = requiredCandidates;
+ }
+
+ public List<Candidate> getExcludedCandidates(){
+ return excludedCandidates;
+ }
+
+ public void setExcludedCandidates(List<Candidate> excludedCandidates){
+ this.excludedCandidates = excludedCandidates;
+ }
+
+ public String getServiceResourceId(){
+ return serviceResourceId;
+ }
+
+ public void setServiceResourceId(String serviceResourceId){
+ this.serviceResourceId = serviceResourceId;
+ }
+
+ public String getResourceModuleName(){
+ return resourceModuleName;
+ }
+
+ public void setResourceModuleName(String resourceModuleName){
+ this.resourceModuleName = resourceModuleName;
+ }
+
+ public ModelInfo getModelInfo(){
+ return modelInfo;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo){
+ this.modelInfo = modelInfo;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java
new file mode 100644
index 0000000000..209792b4d7
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.client.sniro.beans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class LicenseInfo implements Serializable{
+
+ private static final long serialVersionUID = 6878164369491185856L;
+
+ @JsonProperty("licenseDemands")
+ private List<Demand> demands = new ArrayList<Demand>();
+
+
+ public List<Demand> getDemands(){
+ return demands;
+ }
+
+ public void setDemands(List<Demand> demands){
+ this.demands = demands;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java
new file mode 100644
index 0000000000..34d746b8d2
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.client.sniro.beans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonPropertyOrder({
+ "modelName",
+ "modelVersionId",
+ "modelVersion",
+ "modelInvariantId"
+})
+@JsonRootName("modelInfo")
+public class ModelInfo implements Serializable{
+
+ private static final long serialVersionUID = 1488642558601651075L;
+
+ @JsonProperty("modelInvariantId")
+ private String modelInvariantId;
+ @JsonProperty("modelVersionId")
+ private String modelVersionId;
+ @JsonProperty("modelName")
+ private String modelName;
+ @JsonProperty("modelVersion")
+ private String modelVersion;
+
+
+ public String getModelInvariantId(){
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId){
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public String getModelVersionId(){
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId){
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getModelName(){
+ return modelName;
+ }
+
+ public void setModelName(String modelName){
+ this.modelName = modelName;
+ }
+
+ public String getModelVersion(){
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion){
+ this.modelVersion = modelVersion;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java
new file mode 100644
index 0000000000..9ae2c72798
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java
@@ -0,0 +1,75 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.client.sniro.beans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRawValue;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonPropertyOrder({
+ "subscriberInfo",
+ "placementDemands",
+ "requestParameters"
+})
+@JsonRootName("placementInfo")
+public class PlacementInfo implements Serializable{
+
+ private static final long serialVersionUID = -964488472247386556L;
+
+ @JsonProperty("subscriberInfo")
+ private SubscriberInfo subscriberInfo;
+ @JsonProperty("placementDemands")
+ private List<Demand> demands = new ArrayList<Demand>();
+ @JsonRawValue
+ @JsonProperty("requestParameters")
+ private String requestParameters;
+
+
+ public SubscriberInfo getSubscriberInfo(){
+ return subscriberInfo;
+ }
+
+ public void setSubscriberInfo(SubscriberInfo subscriberInfo){
+ this.subscriberInfo = subscriberInfo;
+ }
+
+ public List<Demand> getDemands(){
+ return demands;
+ }
+
+ public void setDemands(List<Demand> demands){
+ this.demands = demands;
+ }
+
+ public String getRequestParameters(){
+ return requestParameters;
+ }
+
+ public void setRequestParameters(String requestParameters){
+ this.requestParameters = requestParameters;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java
index 0d7e44224e..e92b5d1ca3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,6 +36,14 @@ public class RequestInfo implements Serializable{
String transactionId;
@JsonProperty("requestId")
String requestId;
+ @JsonProperty("callbackUrl")
+ String callbackUrl;
+ @JsonProperty("sourceId")
+ String sourceId = "mso";
+ @JsonProperty("requestType")
+ String requestType;
+ @JsonProperty("timeout")
+ long timeout;
public String getTransactionId(){
return transactionId;
@@ -53,5 +61,37 @@ public class RequestInfo implements Serializable{
this.requestId = requestId;
}
+ public String getCallbackUrl(){
+ return callbackUrl;
+ }
+
+ public void setCallbackUrl(String callbackUrl){
+ this.callbackUrl = callbackUrl;
+ }
+
+ public String getSourceId(){
+ return sourceId;
+ }
+
+ public void setSourceId(String sourceId){
+ this.sourceId = sourceId;
+ }
+
+ public String getRequestType(){
+ return requestType;
+ }
+
+ public void setRequestType(String requestType){
+ this.requestType = requestType;
+ }
+
+ public long getTimeout(){
+ return timeout;
+ }
+
+ public void setTimeout(long timeout){
+ this.timeout = timeout;
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java
new file mode 100644
index 0000000000..f035013cd5
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.client.sniro.beans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonPropertyOrder({
+ "modelInfo",
+ "serviceRole",
+ "serviceInstanceId",
+ "serviceName"
+})
+@JsonRootName("serviceInfo")
+public class ServiceInfo implements Serializable{
+
+ private static final long serialVersionUID = -6866022419398548585L;
+
+ @JsonProperty("serviceInstanceId")
+ private String serviceInstanceId;
+ @JsonProperty("serviceName")
+ private String serviceName;
+ @JsonProperty("serviceRole")
+ private String serviceRole;
+ @JsonProperty("modelInfo")
+ private ModelInfo modelInfo;
+
+
+ public String getServiceInstanceId(){
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId){
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getServiceName(){
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName){
+ this.serviceName = serviceName;
+ }
+
+ public String getServiceRole(){
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole){
+ this.serviceRole = serviceRole;
+ }
+
+ public ModelInfo getModelInfo(){
+ return modelInfo;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo){
+ this.modelInfo = modelInfo;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java
index 19b752ffd1..3c39456318 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,42 +37,38 @@ public class SniroManagerRequest implements Serializable{
private static final long serialVersionUID = -1541132882892163132L;
private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroManagerRequest.class);
- @JsonRawValue
@JsonProperty("requestInfo")
- private String requestInformation;
- @JsonRawValue
+ private RequestInfo requestInformation;
@JsonProperty("serviceInfo")
- private String serviceInformation;
- @JsonRawValue
+ private ServiceInfo serviceInformation;
@JsonProperty("placementInfo")
- private String placementInformation;
- @JsonRawValue
+ private PlacementInfo placementInformation;
@JsonProperty("licenseInfo")
- private String licenseInformation;
+ private LicenseInfo licenseInformation;
- public String getRequestInformation() {
+ public RequestInfo getRequestInformation() {
return requestInformation;
}
- public void setRequestInformation(String requestInformation) {
+ public void setRequestInformation(RequestInfo requestInformation) {
this.requestInformation = requestInformation;
}
- public String getServiceInformation() {
+ public ServiceInfo getServiceInformation() {
return serviceInformation;
}
- public void setServiceInformation(String serviceInformation) {
+ public void setServiceInformation(ServiceInfo serviceInformation) {
this.serviceInformation = serviceInformation;
}
- public String getPlacementInformation() {
+ public PlacementInfo getPlacementInformation() {
return placementInformation;
}
- public void setPlacementInformation(String placementInformation) {
+ public void setPlacementInformation(PlacementInfo placementInformation) {
this.placementInformation = placementInformation;
}
- public String getLicenseInformation() {
+ public LicenseInfo getLicenseInformation() {
return licenseInformation;
}
- public void setLicenseInformation(String licenseInformation) {
+ public void setLicenseInformation(LicenseInfo licenseInformation) {
this.licenseInformation = licenseInformation;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java
new file mode 100644
index 0000000000..b6b09cbf80
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.client.sniro.beans;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRawValue;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName("subscriberInfo")
+public class SubscriberInfo implements Serializable{
+
+ private static final long serialVersionUID = -6350949051379748872L;
+
+ @JsonProperty("globalSubscriberId")
+ private String globalSubscriberId;
+ @JsonProperty("subscriberName")
+ private String subscriberName;
+ @JsonProperty("subscriberCommonSiteId")
+ private String subscriberCommonSiteId;
+
+
+ public String getGlobalSubscriberId(){
+ return globalSubscriberId;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId){
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public String getSubscriberName(){
+ return subscriberName;
+ }
+
+ public void setSubscriberName(String subscriberName){
+ this.subscriberName = subscriberName;
+ }
+
+ public String getSubscriberCommonSiteId(){
+ return subscriberCommonSiteId;
+ }
+
+ public void setSubscriberCommonSiteId(String subscriberCommonSiteId){
+ this.subscriberCommonSiteId = subscriberCommonSiteId;
+ }
+
+}