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.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java97
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java47
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java26
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java93
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java68
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java23
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java23
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java155
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfBondingServiceException.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeleteTasks.java)16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java163
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java323
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java49
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java51
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java70
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java27
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/exceptions/MissingValueTagException.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java113
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingServiceConstants.java41
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingServiceUtils.java87
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java29
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java23
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java27
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java27
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java13
-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/SniroValidator.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java20
84 files changed, 1766 insertions, 498 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 513ff74180..4e74e5d414 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
@@ -55,7 +55,7 @@ public class HomingV2 {
private boolean isOof(BuildingBlockExecution execution) {
for (Map<String, Object> params : execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters()
.getUserParams()) {
- if (params.containsKey(HOMINGSOLUTION) && params.get(HOMINGSOLUTION).equals("oof")) {
+ if (params.containsKey(HOMINGSOLUTION) && ("oof").equals(params.get(HOMINGSOLUTION))) {
return true;
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java
index 2696313daf..d5a085aba7 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java
@@ -81,6 +81,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
@Component("OofHoming")
public class OofHomingV2 {
+ public static final String ERROR_WHILE_PREPARING_OOF_REQUEST = " Error - while preparing oof request: ";
private static final Logger logger = LoggerFactory.getLogger(OofHomingV2.class);
private JsonUtils jsonUtils = new JsonUtils();
@Autowired
@@ -91,13 +92,9 @@ public class OofHomingV2 {
private OofValidator oofValidator;
@Autowired
private ExceptionBuilder exceptionUtil;
- private static final String MODEL_NAME = "modelName";
private static final String MODEL_INVARIANT_ID = "modelInvariantId";
private static final String MODEL_VERSION_ID = "modelVersionId";
- private static final String MODEL_VERSION = "modelVersion";
private static final String SERVICE_RESOURCE_ID = "serviceResourceId";
- private static final String RESOURCE_MODULE_NAME = "resourceModuleName";
- private static final String RESOURCE_MODEL_INFO = "resourceModelInfo";
private static final String IDENTIFIER_TYPE = "identifierType";
private static final String SOLUTIONS = "solutions";
private static final String RESOURCE_MISSING_DATA = "Resource does not contain: ";
@@ -128,7 +125,7 @@ public class OofHomingV2 {
OofRequest oofRequest = new OofRequest();
- RequestInfo requestInfo = (RequestInfo) buildRequestInfo(requestId, timeout);
+ RequestInfo requestInfo = buildRequestInfo(requestId, timeout);
oofRequest.setRequestInformation(requestInfo);
ServiceInfo serviceInfo = buildServiceInfo(serviceInstance);
@@ -157,13 +154,13 @@ public class OofHomingV2 {
logger.trace("Completed Oof Homing Call Oof");
} catch (BpmnError e) {
- logger.debug(" Error - while preparing oof request: " + e.getStackTrace());
+ logger.debug(ERROR_WHILE_PREPARING_OOF_REQUEST + e.getStackTrace());
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
} catch (BadResponseException e) {
- logger.debug(" Error - while preparing oof request: " + e.getStackTrace());
+ logger.debug(ERROR_WHILE_PREPARING_OOF_REQUEST + e.getStackTrace());
exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
} catch (Exception e) {
- logger.debug(" Error - while preparing oof request: " + e.getStackTrace());
+ logger.debug(ERROR_WHILE_PREPARING_OOF_REQUEST + e.getStackTrace());
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while "
+ "preparing oof request: " + e + " Stack:" + ExceptionUtils.getFullStackTrace(e));
}
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 2f898b6697..e5df3d3f35 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
@@ -90,19 +90,17 @@ public class SniroHomingV2 {
private SniroClient client;
@Autowired
private ExceptionBuilder exceptionUtil;
- private static final String MODEL_NAME = "modelName";
private static final String MODEL_INVARIANT_ID = "modelInvariantId";
private static final String MODEL_VERSION_ID = "modelVersionId";
- private static final String MODEL_VERSION = "modelVersion";
private static final String SERVICE_RESOURCE_ID = "serviceResourceId";
- private static final String RESOURCE_MODULE_NAME = "resourceModuleName";
- private static final String RESOURCE_MODEL_INFO = "resourceModelInfo";
private static final String IDENTIFIER_TYPE = "identifierType";
private static final String SOLUTIONS = "solutions";
private static final String RESOURCE_MISSING_DATA = "Resource does not contain: ";
private static final String SERVICE_MISSING_DATA = "Service Instance does not contain: ";
private static final String UNPROCESSABLE = "422";
private static final int INTERNAL = 500;
+ private static final String EXCEPTION_OCCURRED = "Exception occurred";
+ private static final String VNF_HOST_NAME = "vnfHostName";
/**
* Generates the request payload then sends to sniro manager to perform homing and licensing for the provided
@@ -147,7 +145,7 @@ public class SniroHomingV2 {
licenseInfo.setDemands(licenseDemands);
request.setLicenseInformation(licenseInfo);
- if (placementDemands.size() > 0 || licenseDemands.size() > 0) {
+ if (!placementDemands.isEmpty() || !licenseDemands.isEmpty()) {
client.postDemands(request);
} else {
logger.debug(SERVICE_MISSING_DATA + "resources eligible for homing or licensing");
@@ -161,13 +159,13 @@ public class SniroHomingV2 {
logger.trace("Completed Sniro Homing Call Sniro");
} catch (BpmnError e) {
- logger.error("Exception occurred", e);
+ logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
} catch (BadResponseException e) {
- logger.error("Exception occurred", e);
+ logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
} catch (Exception e) {
- logger.error("Exception occurred", e);
+ logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
"Internal Error - occurred while preparing sniro request: " + e.getMessage());
}
@@ -183,7 +181,6 @@ public class SniroHomingV2 {
logger.trace("Started Sniro Homing Process Solution");
try {
// TODO improve handling multiple solutions but is dependent on sniro enhancing api + work with sniro
- // conductor to improve "inventoryType" representation
validateSolution(asyncResponse);
ServiceInstance serviceInstance = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription()
.getServiceInstances().get(0);
@@ -213,13 +210,13 @@ public class SniroHomingV2 {
logger.trace("Completed Sniro Homing Process Solution");
} catch (BpmnError e) {
- logger.error("Exception occurred", e);
+ logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
} catch (BadResponseException e) {
- logger.error("Exception occurred", e);
+ logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
} catch (Exception e) {
- logger.error("Exception occurred", e);
+ logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
"Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage());
}
@@ -230,7 +227,7 @@ public class SniroHomingV2 {
*
* @throws Exception
*/
- private RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception {
+ private RequestInfo buildRequestInfo(String requestId, String timeout) {
logger.trace("Building request information");
RequestInfo requestInfo = new RequestInfo();
if (requestId != null) {
@@ -305,7 +302,7 @@ public class SniroHomingV2 {
*/
private List<Demand> buildPlacementDemands(ServiceInstance serviceInstance) {
logger.trace("Building placement information demands");
- List<Demand> placementDemands = new ArrayList<Demand>();
+ List<Demand> placementDemands = new ArrayList<>();
List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources();
if (!allottedResourceList.isEmpty()) {
@@ -334,6 +331,18 @@ public class SniroHomingV2 {
}
}
}
+ List<ServiceProxy> serviceProxies = serviceInstance.getServiceProxies();
+ if (!serviceProxies.isEmpty()) {
+ logger.debug("Adding service proxies to placement demands list");
+ for (ServiceProxy sp : serviceProxies) {
+ if (isBlank(sp.getId())) {
+ sp.setId(UUID.randomUUID().toString());
+ }
+ Demand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy());
+ addCandidates(sp, demand);
+ placementDemands.add(demand);
+ }
+ }
return placementDemands;
}
@@ -343,7 +352,7 @@ public class SniroHomingV2 {
*/
private List<Demand> buildLicenseDemands(ServiceInstance serviceInstance) {
logger.trace("Building license information");
- List<Demand> licenseDemands = new ArrayList<Demand>();
+ List<Demand> licenseDemands = new ArrayList<>();
List<GenericVnf> vnfList = serviceInstance.getVnfs();
if (!vnfList.isEmpty()) {
logger.debug("Adding vnfs to license demands list");
@@ -394,37 +403,46 @@ public class SniroHomingV2 {
}
/**
- * Adds required, excluded, and existing candidates to a demand
+ * Adds required, excluded, and existing candidates as well as filtering attributes to a demand
*
*/
private void addCandidates(SolutionCandidates candidates, Demand demand) {
List<Candidate> required = candidates.getRequiredCandidates();
List<Candidate> excluded = candidates.getExcludedCandidates();
- if (!required.isEmpty()) {
- 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();
- can.setIdentifierType(c.getIdentifierType());
- can.setIdentifiers(c.getIdentifiers());
- can.setCloudOwner(c.getCloudOwner());
- cans.add(can);
- }
- demand.setRequiredCandidates(cans);
+ List<Candidate> existing = candidates.getExistingCandidates();
+ List<Candidate> filtering = candidates.getFilteringAttributes();
+
+ List<org.onap.so.client.sniro.beans.Candidate> candidateList = getCandidates(required);
+ if (!candidateList.isEmpty()) {
+ demand.setRequiredCandidates(candidateList);
}
- if (!excluded.isEmpty()) {
- List<org.onap.so.client.sniro.beans.Candidate> cans =
- new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
- for (Candidate c : excluded) {
+ candidateList = getCandidates(excluded);
+ if (!candidateList.isEmpty()) {
+ demand.setExcludedCandidates(candidateList);
+ }
+ candidateList = getCandidates(existing);
+ if (!candidateList.isEmpty()) {
+ demand.setExistingCandidates(candidateList);
+ }
+
+ candidateList = getCandidates(filtering);
+ if (!candidateList.isEmpty()) {
+ demand.setFilteringAttributes(candidateList);
+ }
+ }
+
+ private List<org.onap.so.client.sniro.beans.Candidate> getCandidates(List<Candidate> candidates) {
+ List<org.onap.so.client.sniro.beans.Candidate> candidateList = new ArrayList<>();
+ if (!candidates.isEmpty()) {
+ for (Candidate c : candidates) {
org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
can.setIdentifierType(c.getIdentifierType());
can.setIdentifiers(c.getIdentifiers());
can.setCloudOwner(c.getCloudOwner());
- cans.add(can);
+ candidateList.add(can);
}
- demand.setExcludedCandidates(cans);
}
- // TODO support existing candidates
+ return candidateList;
}
/**
@@ -462,6 +480,7 @@ public class SniroHomingV2 {
List<VpnBondingLink> links = serviceInstance.getVpnBondingLinks();
List<AllottedResource> allottes = serviceInstance.getAllottedResources();
List<GenericVnf> vnfs = serviceInstance.getVnfs();
+ List<ServiceProxy> serviceProxies = serviceInstance.getServiceProxies();
logger.debug("Processing placement solution " + i + 1);
for (int p = 0; p < placements.length(); p++) {
@@ -502,6 +521,12 @@ public class SniroHomingV2 {
break search;
}
}
+ for (ServiceProxy proxy : serviceProxies) {
+ if (placement.getString(SERVICE_RESOURCE_ID).equals(proxy.getId())) {
+ proxy.setServiceInstance(setSolution(solutionInfo, placement));
+ break search;
+ }
+ }
}
}
}
@@ -531,7 +556,7 @@ public class SniroHomingV2 {
si.setServiceInstanceId(identifierValue);
si.setOrchestrationStatus(OrchestrationStatus.CREATED);
cloud.setLcpCloudRegionId(assignmentsMap.get("cloudRegionId"));
- if (assignmentsMap.containsKey("vnfHostName") && !assignmentsMap.get("vnfHostName").isEmpty()) {
+ if (assignmentsMap.containsKey(VNF_HOST_NAME) && !assignmentsMap.get(VNF_HOST_NAME).isEmpty()) {
logger.debug("Resources has been homed to a vnf");
GenericVnf vnf = setVnf(assignmentsMap);
vnf.setCloudRegion(cloud);
@@ -581,7 +606,7 @@ public class SniroHomingV2 {
private GenericVnf setVnf(Map<String, String> assignmentsMap) {
GenericVnf vnf = new GenericVnf();
vnf.setOrchestrationStatus(OrchestrationStatus.CREATED);
- vnf.setVnfName(assignmentsMap.get("vnfHostName"));
+ vnf.setVnfName(assignmentsMap.get(VNF_HOST_NAME));
vnf.setVnfId(assignmentsMap.get("vnfId"));
return vnf;
}
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 d23f9c52ea..e3540ecc58 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
@@ -29,6 +29,7 @@ import java.util.TreeSet;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
@@ -49,6 +50,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
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.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
@@ -75,6 +77,7 @@ public class AAICreateTasks {
private static final Logger logger = LoggerFactory.getLogger(AAICreateTasks.class);
private static final String networkTypeProvider = "PROVIDER";
+ private static final String A_LA_CARTE = "aLaCarte";
private static String NETWORK_COLLECTION_NAME = "networkCollectionName";
private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
private static String HEAT_STACK_ID = "heatStackId";
@@ -104,8 +107,12 @@ public class AAICreateTasks {
public void createServiceInstance(BuildingBlockExecution execution) {
try {
+ Boolean alaCarte = execution.getVariable(A_LA_CARTE);
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ if (Boolean.TRUE.equals(alaCarte) && aaiSIResources.checkInstanceServiceNameInUse(serviceInstance)) {
+ throw new DuplicateNameException("service-instance", serviceInstance.getServiceInstanceName());
+ }
Customer customer = execution.getGeneralBuildingBlock().getCustomer();
aaiSIResources.createServiceInstance(serviceInstance, customer);
} catch (Exception ex) {
@@ -122,8 +129,8 @@ public class AAICreateTasks {
String errorMessage =
"Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: "
+ serviceInstance.getServiceInstanceId();
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, "BPMN",
- ErrorCode.UnknownError.getValue(), errorMessage);
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage,
+ "BPMN", ErrorCode.UnknownError.getValue(), errorMessage);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage);
}
aaiSIResources.createServiceSubscription(customer);
@@ -169,14 +176,14 @@ public class AAICreateTasks {
if (owningEntityName == null || "".equals(owningEntityName)) {
String msg =
"Exception in AAICreateOwningEntity. Can't create an owningEntity with no owningEntityName.";
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue(), msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
} else {
if (aaiSIResources.existsOwningEntityName(owningEntityName)) {
String msg =
"Exception in AAICreateOwningEntity. Can't create OwningEntity as name already exists in AAI associated with a different owning-entity-id (name must be unique)";
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg,
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg,
"BPMN", ErrorCode.UnknownError.getValue(), msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
} else {
@@ -192,7 +199,11 @@ public class AAICreateTasks {
public void createVnf(BuildingBlockExecution execution) {
try {
+ Boolean alaCarte = execution.getVariable(A_LA_CARTE);
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ if (Boolean.TRUE.equals(alaCarte) && aaiVnfResources.checkNameInUse(vnf.getVnfName())) {
+ throw new DuplicateNameException("generic-vnf", vnf.getVnfName());
+ }
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
execution.setVariable("homing", Boolean.TRUE.equals(vnf.isCallHoming()));
@@ -251,6 +262,10 @@ public class AAICreateTasks {
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ Boolean alaCarte = execution.getVariable(A_LA_CARTE);
+ if (Boolean.TRUE.equals(alaCarte) && aaiVolumeGroupResources.checkNameInUse(volumeGroup)) {
+ throw new DuplicateNameException("volume-group", volumeGroup.getVolumeGroupName());
+ }
aaiVolumeGroupResources.createVolumeGroup(volumeGroup, cloudRegion);
aaiVolumeGroupResources.connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion);
aaiVolumeGroupResources.connectVolumeGroupToTenant(volumeGroup, cloudRegion);
@@ -263,6 +278,10 @@ public class AAICreateTasks {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ Boolean alaCarte = execution.getVariable(A_LA_CARTE);
+ if (Boolean.TRUE.equals(alaCarte) && aaiVfModuleResources.checkNameInUse(vfModule)) {
+ throw new DuplicateNameException("vf-module", vfModule.getVfModuleName());
+ }
int moduleIndex = 0;
if (vfModule.getModelInfoVfModule() != null
&& !Boolean.TRUE.equals(vfModule.getModelInfoVfModule().getIsBaseBoolean())) {
@@ -308,9 +327,14 @@ public class AAICreateTasks {
*/
public void createNetwork(BuildingBlockExecution execution) {
try {
+ Boolean alaCarte = execution.getVariable(A_LA_CARTE);
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ if (Boolean.TRUE.equals(alaCarte)
+ && aaiNetworkResources.checkNetworkNameInUse(l3network.getNetworkName())) {
+ throw new DuplicateNameException("l3Network", l3network.getNetworkName());
+ }
// set default to false. ToBe updated by SDNC
l3network.setIsBoundToVpn(false);
// define is bound to vpn flag as true if NEUTRON_NETWORK_TYPE is PROVIDER
@@ -361,11 +385,16 @@ public class AAICreateTasks {
*/
public void createNetworkCollectionInstanceGroup(BuildingBlockExecution execution) {
try {
+ Boolean alaCarte = execution.getVariable(A_LA_CARTE);
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
InstanceGroup instanceGroup = serviceInstance.getCollection().getInstanceGroup();
// set name generated for NetworkCollection/NetworkCollectionInstanceGroup in previous step of the BB flow
instanceGroup.setInstanceGroupName(execution.getVariable(NETWORK_COLLECTION_NAME));
+ if (Boolean.TRUE.equals(alaCarte)
+ && aaiInstanceGroupResources.checkInstanceGroupNameInUse(instanceGroup.getInstanceGroupName())) {
+ throw new DuplicateNameException("instance-group", instanceGroup.getInstanceGroupName());
+ }
// put shell in AAI
aaiNetworkResources.createNetworkInstanceGroup(instanceGroup);
} catch (Exception ex) {
@@ -482,7 +511,12 @@ public class AAICreateTasks {
public void createConfiguration(BuildingBlockExecution execution) {
try {
+ Boolean alaCarte = execution.getVariable(A_LA_CARTE);
Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
+ if (Boolean.TRUE.equals(alaCarte)
+ && aaiConfigurationResources.checkConfigurationNameInUse(configuration.getConfigurationName())) {
+ throw new DuplicateNameException("configuration", configuration.getConfigurationName());
+ }
aaiConfigurationResources.createConfiguration(configuration);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -491,9 +525,14 @@ public class AAICreateTasks {
public void createInstanceGroupVnf(BuildingBlockExecution execution) {
try {
+ Boolean alaCarte = execution.getVariable(A_LA_CARTE);
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
+ if (Boolean.TRUE.equals(alaCarte)
+ && aaiInstanceGroupResources.checkInstanceGroupNameInUse(instanceGroup.getInstanceGroupName())) {
+ throw new DuplicateNameException("instance-group", instanceGroup.getInstanceGroupName());
+ }
aaiInstanceGroupResources.createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
index 28186528e4..18ba91263b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
@@ -9,9 +9,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.
@@ -58,8 +58,8 @@ import org.springframework.stereotype.Component;
public class AAIDeleteTasks {
private static final Logger logger = LoggerFactory.getLogger(AAIDeleteTasks.class);
- private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
- private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn";
+ private static String contrailNetworkPolicyFqdnList = "contrailNetworkPolicyFqdnList";
+ private static String networkPolicyFqdnParam = "network-policy-fqdn";
@Autowired
private ExceptionBuilder exceptionUtil;
@@ -176,15 +176,15 @@ public class AAIDeleteTasks {
public void deleteNetworkPolicies(BuildingBlockExecution execution) {
try {
- String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST);
+ String fqdns = execution.getVariable(contrailNetworkPolicyFqdnList);
if (fqdns != null && !fqdns.isEmpty()) {
- String fqdnList[] = fqdns.split(",");
+ String[] fqdnList = fqdns.split(",");
int fqdnCount = fqdnList.length;
if (fqdnCount > 0) {
for (int i = 0; i < fqdnCount; i++) {
String fqdn = fqdnList[i];
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
- uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
+ uri.queryParam(networkPolicyFqdnParam, fqdn);
Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri);
if (oNetPolicies.isPresent()) {
NetworkPolicies networkPolicies = oNetPolicies.get();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index 426ef931b6..775e3213d4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -25,6 +25,7 @@ package org.onap.so.bpmn.infrastructure.activity;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
+import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
@@ -94,7 +95,7 @@ public class ExecuteActivity implements JavaDelegate {
Map<String, Object> variables = new HashMap<>();
variables.put("buildingBlock", executeBuildingBlock);
- variables.put("mso-request-id", requestId);
+ variables.put(G_REQUEST_ID, requestId);
variables.put("retryCount", 1);
variables.put("aLaCarte", true);
@@ -144,7 +145,7 @@ public class ExecuteActivity implements JavaDelegate {
}
protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue(), msg, ex);
execution.setVariable("ExecuteActivityErrorMessage", msg);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java
index 77898dd5cc..428f5e703d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java
@@ -32,7 +32,6 @@ 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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -40,7 +39,6 @@ import org.springframework.stereotype.Component;
@Component
public class NetworkAdapterUpdateTasks {
- private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterUpdateTasks.class);
@Autowired
private ExtractPojosForBB extractPojosForBB;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
index 849465e787..b257e91165 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
@@ -47,7 +47,7 @@ import static org.apache.commons.lang3.StringUtils.*;
@Component
public class VnfAdapterCreateTasks {
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateTasks.class);
+ public static final String SDNCQUERY_RESPONSE = "SDNCQueryResponse_";
private static final String VNFREST_REQUEST = "VNFREST_Request";
@Autowired
@@ -73,7 +73,7 @@ public class VnfAdapterCreateTasks {
try {
vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) {
- sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId());
+ sdncVfModuleQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId());
} else {
throw new Exception("Vf Module " + vfModule.getVfModuleId()
+ " exists in gBuildingBlock but does not have a selflink value");
@@ -109,8 +109,8 @@ public class VnfAdapterCreateTasks {
CloudRegion cloudRegion = gBBInput.getCloudRegion();
RequestContext requestContext = gBBInput.getRequestContext();
OrchestrationContext orchestrationContext = gBBInput.getOrchContext();
- String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId());
- String sdncVnfQueryResponse = execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId());
+ String sdncVfModuleQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId());
+ String sdncVnfQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId());
CreateVfModuleRequest createVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(
requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule,
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java
index 116dc30d63..5fe80b79f9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java
@@ -42,7 +42,7 @@ import org.springframework.stereotype.Component;
@Component
public class VnfAdapterDeleteTasks {
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterDeleteTasks.class);
+
private static final String VNFREST_REQUEST = "VNFREST_Request";
@Autowired
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 bfa76c5053..e5f28aa4c3 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.adapter.vnf.tasks;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.commons.lang3.StringUtils;
import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
@@ -63,6 +64,7 @@ public class VnfAdapterImpl {
private static final String OAM_MANAGEMENT_V4_ADDRESS = "oamManagementV4Address";
private static final String OAM_MANAGEMENT_V6_ADDRESS = "oamManagementV6Address";
private static final String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
+ public static final String HEAT_STACK_ID = "heatStackId";
@Autowired
private ExtractPojosForBB extractPojosForBB;
@@ -77,7 +79,7 @@ public class VnfAdapterImpl {
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
execution.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId());
execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId());
- execution.setVariable("heatStackId", null);
+ execution.setVariable(HEAT_STACK_ID, null);
execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, null);
execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, null);
execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, null);
@@ -97,7 +99,7 @@ public class VnfAdapterImpl {
String heatStackId = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleStackId();
if (!StringUtils.isEmpty(heatStackId)) {
vfModule.setHeatStackId(heatStackId);
- execution.setVariable("heatStackId", heatStackId);
+ execution.setVariable(HEAT_STACK_ID, heatStackId);
}
Map<String, String> vfModuleOutputs =
((CreateVfModuleResponse) vnfRestResponse).getVfModuleOutputs();
@@ -110,7 +112,7 @@ public class VnfAdapterImpl {
Boolean vfModuleDelete = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleDeleted();
if (null != vfModuleDelete && vfModuleDelete) {
vfModule.setHeatStackId(null);
- execution.setVariable("heatStackId", null);
+ execution.setVariable(HEAT_STACK_ID, null);
Map<String, String> vfModuleOutputs =
((DeleteVfModuleResponse) vnfRestResponse).getVfModuleOutputs();
if (vfModuleOutputs != null) {
@@ -134,7 +136,7 @@ public class VnfAdapterImpl {
String heatStackId = ((CreateVolumeGroupResponse) vnfRestResponse).getVolumeGroupStackId();
if (!StringUtils.isEmpty(heatStackId)) {
volumeGroup.setHeatStackId(heatStackId);
- execution.setVariable("heatStackId", heatStackId);
+ execution.setVariable(HEAT_STACK_ID, heatStackId);
} else {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
"HeatStackId is missing from create VolumeGroup Vnf Adapter response.");
@@ -144,7 +146,7 @@ public class VnfAdapterImpl {
Boolean volumeGroupDelete = ((DeleteVolumeGroupResponse) vnfRestResponse).getVolumeGroupDeleted();
if (null != volumeGroupDelete && volumeGroupDelete) {
volumeGroup.setHeatStackId(null);
- execution.setVariable("heatStackId", null);
+ execution.setVariable(HEAT_STACK_ID, null);
}
}
}
@@ -170,8 +172,8 @@ public class VnfAdapterImpl {
SAXSource source = new SAXSource(xmlReader, inputSource);
return jaxbUnmarshaller.unmarshal(source);
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(),
- e.getMessage(), e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.GENERAL_EXCEPTION.toString(),
+ ErrorCode.SchemaError.getValue(), e.getMessage(), e);
throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(),
ErrorCode.SchemaError.getValue(), e);
}
@@ -184,7 +186,7 @@ public class VnfAdapterImpl {
try {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- List<String> contrailNetworkPolicyFqdnList = new ArrayList<String>();
+ List<String> contrailNetworkPolicyFqdnList = new ArrayList<>();
Iterator<String> keys = vfModuleOutputs.keySet().iterator();
while (keys.hasNext()) {
String key = keys.next();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
index 01519fab6e..4cf5131747 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -20,8 +22,7 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
-import static com.google.common.collect.Sets.newHashSet;
-import java.util.Set;
+import com.google.common.collect.ImmutableSet;
import org.onap.vnfmadapter.v1.model.OperationStateEnum;
import org.onap.vnfmadapter.v1.model.OperationStatusRetrievalStatusEnum;
@@ -51,11 +52,11 @@ public class Constants {
public static final String PRELOAD_VNFS_URL = "/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/";
- public static final Set<OperationStateEnum> OPERATION_FINISHED_STATES =
- newHashSet(OperationStateEnum.COMPLETED, OperationStateEnum.FAILED, OperationStateEnum.ROLLED_BACK);
+ public static final ImmutableSet<OperationStateEnum> OPERATION_FINISHED_STATES =
+ ImmutableSet.of(OperationStateEnum.COMPLETED, OperationStateEnum.FAILED, OperationStateEnum.ROLLED_BACK);
- public static final Set<OperationStatusRetrievalStatusEnum> OPERATION_RETRIEVAL_STATES = newHashSet(
- OperationStatusRetrievalStatusEnum.STATUS_FOUND, OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS);
+ public static final ImmutableSet<OperationStatusRetrievalStatusEnum> OPERATION_RETRIEVAL_STATES = ImmutableSet
+ .of(OperationStatusRetrievalStatusEnum.STATUS_FOUND, OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS);
public static final String OPERATION_STATUS_PARAM_NAME = "operationStatus";
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
index 4c84bcaa1f..30f0d38754 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
@@ -1,8 +1,8 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Ericsson. All rights reserved.
+ * Copyright (C) 2019 Ericsson. All rights reserved.
* ================================================================================
- * Modifications Copyright (c) 2019 Samsung
+ * Copyright (C) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
* 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.
- *
- * SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
index 34e3efa8f5..8fecb81d75 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
@@ -1,8 +1,8 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Ericsson. All rights reserved.
+ * Copyright (C) 2019 Ericsson. All rights reserved.
* ================================================================================
- * Modifications Copyright (c) 2019 Samsung
+ * Copyright (C) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
* 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.
- *
- * SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
index 4a51891184..32516c1dcb 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
@@ -42,6 +42,7 @@ import com.google.common.base.Optional;
public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(VnfmAdapterServiceProviderImpl.class);
+ public static final String RECEIVED_RESPONSE_WITHOUT_BODY = "Received response without body: {}";
private final VnfmAdapterUrlProvider urlProvider;
private final HttpRestServiceProvider httpServiceProvider;
@@ -69,7 +70,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide
}
if (!response.hasBody()) {
- LOGGER.error("Received response without body: {}", response);
+ LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response);
return Optional.absent();
}
@@ -107,7 +108,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide
}
if (!response.hasBody()) {
- LOGGER.error("Received response without body: {}", response);
+ LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response);
return Optional.absent();
}
final DeleteVnfResponse deleteVnfResponse = response.getBody();
@@ -139,7 +140,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide
}
if (!response.hasBody()) {
- LOGGER.error("Received response without body: {}", response);
+ LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response);
return Optional.absent();
}
return Optional.of(response.getBody());
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
index ef882b4694..eddcc94e71 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
@@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure.appc.tasks;
import java.util.HashMap;
import java.util.Optional;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -47,6 +48,9 @@ import org.springframework.stereotype.Component;
@Component
public class AppcRunTasks {
private static final Logger logger = LoggerFactory.getLogger(AppcRunTasks.class);
+ public static final String ROLLBACK_VNF_STOP = "rollbackVnfStop";
+ public static final String ROLLBACK_VNF_LOCK = "rollbackVnfLock";
+ public static final String ROLLBACK_QUIESCE_TRAFFIC = "rollbackQuiesceTraffic";
@Autowired
private ExceptionBuilder exceptionUtil;
@Autowired
@@ -71,9 +75,9 @@ public class AppcRunTasks {
execution.setVariable("actionHealthCheck", Action.HealthCheck);
execution.setVariable("actionDistributeTraffic", Action.DistributeTraffic);
execution.setVariable("actionDistributeTrafficCheck", Action.DistributeTrafficCheck);
- execution.setVariable("rollbackVnfStop", false);
- execution.setVariable("rollbackVnfLock", false);
- execution.setVariable("rollbackQuiesceTraffic", false);
+ execution.setVariable(ROLLBACK_VNF_STOP, false);
+ execution.setVariable(ROLLBACK_VNF_LOCK, false);
+ execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, false);
}
public void runAppcCommand(BuildingBlockExecution execution, Action action) {
@@ -137,7 +141,7 @@ public class AppcRunTasks {
appcMessage = appCClient.getErrorMessage();
mapRollbackVariables(execution, action, appcCode);
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
"Caught exception in runAppcCommand", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e);
appcMessage = e.getMessage();
}
@@ -153,17 +157,17 @@ public class AppcRunTasks {
protected void mapRollbackVariables(BuildingBlockExecution execution, Action action, String appcCode) {
if (appcCode.equals("0") && action != null) {
if (action.equals(Action.Lock)) {
- execution.setVariable("rollbackVnfLock", true);
+ execution.setVariable(ROLLBACK_VNF_LOCK, true);
} else if (action.equals(Action.Unlock)) {
- execution.setVariable("rollbackVnfLock", false);
+ execution.setVariable(ROLLBACK_VNF_LOCK, false);
} else if (action.equals(Action.Start)) {
- execution.setVariable("rollbackVnfStop", false);
+ execution.setVariable(ROLLBACK_VNF_STOP, false);
} else if (action.equals(Action.Stop)) {
- execution.setVariable("rollbackVnfStop", true);
+ execution.setVariable(ROLLBACK_VNF_STOP, true);
} else if (action.equals(Action.QuiesceTraffic)) {
- execution.setVariable("rollbackQuiesceTraffic", true);
+ execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, true);
} else if (action.equals(Action.ResumeTraffic)) {
- execution.setVariable("rollbackQuiesceTraffic", false);
+ execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, false);
}
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java
index a223259d4d..62878fd4f7 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java
@@ -60,6 +60,16 @@ public class AuditTasks {
}
}
+ public void isDeleteAuditNeeded(BuildingBlockExecution execution) {
+ try {
+ logger.debug("deleteAuditInventoryNeeded Value: {}", env.getProperty("mso.infra.deleteAuditInventory"));
+ execution.setVariable("auditInventoryNeeded",
+ Boolean.parseBoolean(env.getProperty("mso.infra.deleteAuditInventory")));
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
public void setupAuditVariable(BuildingBlockExecution execution) {
try {
execution.setVariable("auditInventory", createAuditInventory(execution));
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java
index ab8818f682..4b88f741de 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java
@@ -54,9 +54,9 @@ public class AssignNetworkBBUtils {
* @return
*/
public boolean networkFoundByName(BuildingBlockExecution execution) throws Exception {
- boolean found = false;
+
// TODO - populate logic after iTrack MSO-2143 implemented
- return found;
+ return false;
}
/**
@@ -71,7 +71,7 @@ public class AssignNetworkBBUtils {
CloudRegion cloudRegion = gBBInput.getCloudRegion();
String cloudRegionSdnc;
String cloudRegionPo = cloudRegion.getLcpCloudRegionId();
- if (cloudRegion.getCloudRegionVersion().equalsIgnoreCase("2.5")) {
+ if ("2.5".equalsIgnoreCase(cloudRegion.getCloudRegionVersion())) {
cloudRegionSdnc = "AAIAIC25";
} else {
cloudRegionSdnc = cloudRegionPo;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
index 6e7ca5f4e5..cdbe0db57c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
@@ -1,15 +1,20 @@
-/*
- * ============LICENSE_START======================================================= ONAP : SO
- * ================================================================================ Copyright 2019 TechMahindra
- * ================================================================================= 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_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 TechMahindra
+ * ================================================================================
+ * 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=========================================================
*/
@@ -40,9 +45,9 @@ import org.springframework.stereotype.Component;
@Component
public class ConfigDeployVnf {
private static final Logger logger = LoggerFactory.getLogger(ConfigDeployVnf.class);
- private final static String ORIGINATOR_ID = "SO";
- private final static String ACTION_NAME = "config-deploy";
- private final static String MODE = "async";
+ private static final String ORIGINATOR_ID = "SO";
+ private static final String ACTION_NAME = "config-deploy";
+ private static final String MODE = "async";
@Autowired
private ExceptionBuilder exceptionUtil;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
index 1925d8b69f..ff9d7376de 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.bpmn.appc.payload.beans.ConfigScaleOutPayload;
import org.onap.so.bpmn.appc.payload.beans.RequestParametersConfigScaleOut;
@@ -152,7 +153,7 @@ public class ConfigurationScaleOut {
appcMessage = appCClient.getErrorMessage();
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
"Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN",
ErrorCode.UnknownError.getValue(), "APPC Error", e);
appcMessage = e.getMessage();
@@ -160,7 +161,7 @@ public class ConfigurationScaleOut {
logger.error("Error Message: " + appcMessage);
logger.error("ERROR CODE: " + appcCode);
logger.trace("End of runAppCommand ");
- if (appcCode != null && !appcCode.equals("0")) {
+ if (appcCode != null && !("0").equals(appcCode)) {
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java
index c2d9c6e7bb..b7ddc11f35 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java
@@ -39,7 +39,7 @@ import org.springframework.stereotype.Component;
@Component
public class CreateNetwork {
- private static final Logger logger = LoggerFactory.getLogger(CreateNetwork.class);
+
@Autowired
private ExceptionBuilder exceptionUtil;
@Autowired
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
index 4eaec381e9..36eab8f981 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
@@ -36,7 +36,7 @@ import org.springframework.stereotype.Component;
@Component
public class CreateNetworkCollection {
- private static final Logger logger = LoggerFactory.getLogger(CreateNetworkCollection.class);
+
@Autowired
private ExceptionBuilder exceptionUtil;
@Autowired
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
index 98b602eca1..1a7d22c0dd 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
@@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import java.util.HashMap;
import java.util.Optional;
+import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -45,6 +46,9 @@ import org.springframework.stereotype.Component;
public class GenericVnfHealthCheck {
private static final Logger logger = LoggerFactory.getLogger(GenericVnfHealthCheck.class);
+ public static final String VNF_NAME = "vnfName";
+ public static final String OAM_IP_ADDRESS = "oamIpAddress";
+ public static final String VNF_HOST_IP_ADDRESS = "vnfHostIpAddress";
@Autowired
private ExceptionBuilder exceptionUtil;
@Autowired
@@ -71,9 +75,9 @@ public class GenericVnfHealthCheck {
String controllerName = controllerSelectionReference.getControllerName();
execution.setVariable("vnfId", vnfId);
- execution.setVariable("vnfName", vnfName);
- execution.setVariable("oamIpAddress", oamIpAddress);
- execution.setVariable("vnfHostIpAddress", oamIpAddress);
+ execution.setVariable(VNF_NAME, vnfName);
+ execution.setVariable(OAM_IP_ADDRESS, oamIpAddress);
+ execution.setVariable(VNF_HOST_IP_ADDRESS, oamIpAddress);
execution.setVariable("msoRequestId", gBBInput.getRequestContext().getMsoRequestId());
execution.setVariable("action", actionCategory);
execution.setVariable("controllerType", controllerName);
@@ -98,11 +102,11 @@ public class GenericVnfHealthCheck {
payload = Optional.of(pay);
}
String controllerType = execution.getVariable("controllerType");
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", execution.getVariable("vnfName"));
+ HashMap<String, String> payloadInfo = new HashMap<>();
+ payloadInfo.put(VNF_NAME, execution.getVariable(VNF_NAME));
payloadInfo.put("vfModuleId", execution.getVariable("vfModuleId"));
- payloadInfo.put("oamIpAddress", execution.getVariable("oamIpAddress"));
- payloadInfo.put("vnfHostIpAddress", execution.getVariable("vnfHostIpAddress"));
+ payloadInfo.put(OAM_IP_ADDRESS, execution.getVariable(OAM_IP_ADDRESS));
+ payloadInfo.put(VNF_HOST_IP_ADDRESS, execution.getVariable(VNF_HOST_IP_ADDRESS));
logger.debug("Running APP-C action: {}", action.toString());
logger.debug("VNFID: {}", vnfId);
@@ -111,19 +115,19 @@ public class GenericVnfHealthCheck {
appcCode = appCClient.getErrorCode();
appcMessage = appCClient.getErrorMessage();
} catch (BpmnError ex) {
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Caught exception in GenericVnfHealthCheck", "BPMN", ErrorCode.UnknownError.getValue(), ex);
appcMessage = ex.getMessage();
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
} catch (Exception e) {
if (e instanceof java.util.concurrent.TimeoutException) {
appcMessage = "Request to APPC timed out. ";
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONNECTION_EXCEPTION.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONNECTION_EXCEPTION.toString(),
"Caught timedOut exception in runAppcCommand in GenericVnfHealthCheck", "BPMN",
ErrorCode.UnknownError.getValue(), "APPC Error", e);
throw e;
} else {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
"Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN",
ErrorCode.UnknownError.getValue(), "APPC Error", e);
appcMessage = e.getMessage();
@@ -133,7 +137,7 @@ public class GenericVnfHealthCheck {
logger.error("Error Message: " + appcMessage);
logger.error("ERROR CODE: " + appcCode);
logger.trace("End of runAppCommand ");
- if (appcCode != null && !appcCode.equals("0")) {
+ if (appcCode != null && !("0").equals(appcCode)) {
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
index 27415190cc..7466df53b2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
@@ -38,11 +38,10 @@ import org.springframework.stereotype.Component;
@Component
public class UnassignNetworkBB {
- private static final Logger logger = LoggerFactory.getLogger(UnassignNetworkBB.class);
- private static String MESSAGE_CANNOT_PERFORM_UNASSIGN =
+ private static String messageCannotPerformUnassign =
"Cannot perform Unassign Network. Network is still related to ";
- private static String MESSAGE_ERROR_ROLLBACK = " Rollback is not possible. Please restore data manually.";
+ private static String messageErrorRollback = " Rollback is not possible. Please restore data manually.";
@Autowired
private ExceptionBuilder exceptionUtil;
@@ -72,7 +71,7 @@ public class UnassignNetworkBB {
Optional<org.onap.aai.domain.yang.L3Network> network =
aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) {
- String msg = MESSAGE_CANNOT_PERFORM_UNASSIGN + relatedToValue;
+ String msg = messageCannotPerformUnassign + relatedToValue;
execution.setVariable("ErrorUnassignNetworkBB", msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
}
@@ -109,7 +108,7 @@ public class UnassignNetworkBB {
boolean isRollbackNeeded =
execution.getVariable("isRollbackNeeded") != null ? execution.getVariable("isRollbackNeeded") : false;
if (isRollbackNeeded == true) {
- msg = execution.getVariable("ErrorUnassignNetworkBB") + MESSAGE_ERROR_ROLLBACK;
+ msg = execution.getVariable("ErrorUnassignNetworkBB") + messageErrorRollback;
} else {
msg = execution.getVariable("ErrorUnassignNetworkBB");
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
index b906b8a662..17089be571 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
@@ -1,7 +1,28 @@
+/*-
+ * ============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.manualhandling.tasks;
import java.util.Map;
import java.util.HashMap;
+import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateTask;
@@ -23,6 +44,14 @@ public class ManualHandlingTasks {
private static final String TASK_TYPE_PAUSE = "pause";
private static final String TASK_TYPE_FALLOUT = "fallout";
+ public static final String VNF_TYPE = "vnfType";
+ public static final String SERVICE_TYPE = "serviceType";
+ public static final String MSO_REQUEST_ID = "msoRequestId";
+ public static final String REQUESTOR_ID = "requestorId";
+ public static final String ERROR_CODE = "errorCode";
+ public static final String VALID_RESPONSES = "validResponses";
+ public static final String DESCRIPTION = "description";
+ public static final String BPMN_EXCEPTION = "BPMN exception: ";
@Autowired
private ExceptionBuilder exceptionUtil;
@@ -37,39 +66,39 @@ public class ManualHandlingTasks {
String taskId = task.getId();
logger.debug("taskId is: " + taskId);
String type = TASK_TYPE_FALLOUT;
- String nfRole = (String) execution.getVariable("vnfType");
- String subscriptionServiceType = (String) execution.getVariable("serviceType");
- String originalRequestId = (String) execution.getVariable("msoRequestId");
- String originalRequestorId = (String) execution.getVariable("requestorId");
+ String nfRole = (String) execution.getVariable(VNF_TYPE);
+ String subscriptionServiceType = (String) execution.getVariable(SERVICE_TYPE);
+ String originalRequestId = (String) execution.getVariable(MSO_REQUEST_ID);
+ String originalRequestorId = (String) execution.getVariable(REQUESTOR_ID);
String description = "";
String timeout = "";
String errorSource = (String) execution.getVariable("failedActivity");
- String errorCode = (String) execution.getVariable("errorCode");
+ String errorCode = (String) execution.getVariable(ERROR_CODE);
String errorMessage = (String) execution.getVariable("errorText");
String buildingBlockName = (String) execution.getVariable("currentActivity");
String buildingBlockStep = (String) execution.getVariable("workStep");
- String validResponses = (String) execution.getVariable("validResponses");
+ String validResponses = (String) execution.getVariable(VALID_RESPONSES);
- Map<String, String> taskVariables = new HashMap<String, String>();
+ Map<String, String> taskVariables = new HashMap<>();
taskVariables.put("type", type);
taskVariables.put("nfRole", nfRole);
taskVariables.put("subscriptionServiceType", subscriptionServiceType);
taskVariables.put("originalRequestId", originalRequestId);
taskVariables.put("originalRequestorId", originalRequestorId);
taskVariables.put("errorSource", errorSource);
- taskVariables.put("errorCode", errorCode);
+ taskVariables.put(ERROR_CODE, errorCode);
taskVariables.put("errorMessage", errorMessage);
taskVariables.put("buildingBlockName", buildingBlockName);
taskVariables.put("buildingBlockStep", buildingBlockStep);
- taskVariables.put("validResponses", validResponses);
+ taskVariables.put(VALID_RESPONSES, validResponses);
taskVariables.put("tmeout", timeout);
- taskVariables.put("description", description);
+ taskVariables.put(DESCRIPTION, description);
TaskService taskService = execution.getProcessEngineServices().getTaskService();
taskService.setVariables(taskId, taskVariables);
logger.debug("successfully created fallout task: " + taskId);
} catch (BpmnError e) {
- logger.debug("BPMN exception: " + e.getMessage());
+ logger.debug(BPMN_EXCEPTION + e.getMessage());
throw e;
} catch (Exception ex) {
String msg = "Exception in setFalloutTaskVariables " + ex.getMessage();
@@ -86,39 +115,39 @@ public class ManualHandlingTasks {
String taskId = task.getId();
logger.debug("taskId is: " + taskId);
String type = TASK_TYPE_PAUSE;
- String nfRole = (String) execution.getVariable("vnfType");
- String subscriptionServiceType = (String) execution.getVariable("serviceType");
- String originalRequestId = (String) execution.getVariable("msoRequestId");
- String originalRequestorId = (String) execution.getVariable("requestorId");
- String description = (String) execution.getVariable("description");
+ String nfRole = (String) execution.getVariable(VNF_TYPE);
+ String subscriptionServiceType = (String) execution.getVariable(SERVICE_TYPE);
+ String originalRequestId = (String) execution.getVariable(MSO_REQUEST_ID);
+ String originalRequestorId = (String) execution.getVariable(REQUESTOR_ID);
+ String description = (String) execution.getVariable(DESCRIPTION);
String timeout = (String) execution.getVariable("taskTimeout");
String errorSource = "";
String errorCode = "";
String errorMessage = "";
String buildingBlockName = "";
String buildingBlockStep = "";
- String validResponses = (String) execution.getVariable("validResponses");
+ String validResponses = (String) execution.getVariable(VALID_RESPONSES);
- Map<String, String> taskVariables = new HashMap<String, String>();
+ Map<String, String> taskVariables = new HashMap<>();
taskVariables.put("type", type);
taskVariables.put("nfRole", nfRole);
- taskVariables.put("description", description);
+ taskVariables.put(DESCRIPTION, description);
taskVariables.put("timeout", timeout);
taskVariables.put("subscriptionServiceType", subscriptionServiceType);
taskVariables.put("originalRequestId", originalRequestId);
taskVariables.put("originalRequestorId", originalRequestorId);
taskVariables.put("errorSource", errorSource);
- taskVariables.put("errorCode", errorCode);
+ taskVariables.put(ERROR_CODE, errorCode);
taskVariables.put("errorMessage", errorMessage);
taskVariables.put("buildingBlockName", buildingBlockName);
taskVariables.put("buildingBlockStep", buildingBlockStep);
- taskVariables.put("validResponses", validResponses);
+ taskVariables.put(VALID_RESPONSES, validResponses);
TaskService taskService = execution.getProcessEngineServices().getTaskService();
taskService.setVariables(taskId, taskVariables);
logger.debug("successfully created pause task: " + taskId);
} catch (BpmnError e) {
- logger.debug("BPMN exception: " + e.getMessage());
+ logger.debug(BPMN_EXCEPTION + e.getMessage());
throw e;
} catch (Exception ex) {
String msg = "Exception in setPauseTaskVariables " + ex.getMessage();
@@ -149,7 +178,7 @@ public class ManualHandlingTasks {
execution.setVariable("responseValueTask", responseValueUppercaseStart);
} catch (BpmnError e) {
- logger.debug("BPMN exception: " + e.getMessage());
+ logger.debug(BPMN_EXCEPTION + e.getMessage());
throw e;
} catch (Exception ex) {
String msg = "Exception in completeManualTask " + ex.getMessage();
@@ -164,26 +193,26 @@ public class ManualHandlingTasks {
try {
ExternalTicket ticket = new ExternalTicket();
- ticket.setRequestId((String) execution.getVariable("msoRequestId"));
+ ticket.setRequestId((String) execution.getVariable(MSO_REQUEST_ID));
ticket.setCurrentActivity((String) execution.getVariable("currentActivity"));
- ticket.setNfRole((String) execution.getVariable("vnfType"));
- ticket.setDescription((String) execution.getVariable("description"));
- ticket.setSubscriptionServiceType((String) execution.getVariable("serviceType"));
- ticket.setRequestorId((String) execution.getVariable("requestorId"));
+ ticket.setNfRole((String) execution.getVariable(VNF_TYPE));
+ ticket.setDescription((String) execution.getVariable(DESCRIPTION));
+ ticket.setSubscriptionServiceType((String) execution.getVariable(SERVICE_TYPE));
+ ticket.setRequestorId((String) execution.getVariable(REQUESTOR_ID));
ticket.setTimeout((String) execution.getVariable("taskTimeout"));
ticket.setErrorSource((String) execution.getVariable("failedActivity"));
- ticket.setErrorCode((String) execution.getVariable("errorCode"));
+ ticket.setErrorCode((String) execution.getVariable(ERROR_CODE));
ticket.setErrorMessage((String) execution.getVariable("errorText"));
ticket.setWorkStep((String) execution.getVariable("workStep"));
ticket.createTicket();
} catch (BpmnError e) {
String msg = "BPMN error in createAOTSTicket " + e.getMessage();
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN",
ErrorCode.UnknownError.getValue());
} catch (Exception ex) {
String msg = "Exception in createExternalTicket " + ex.getMessage();
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN",
ErrorCode.UnknownError.getValue());
}
@@ -191,7 +220,7 @@ public class ManualHandlingTasks {
public void updateRequestDbStatus(DelegateExecution execution, String status) {
try {
- String requestId = (String) execution.getVariable("msoRequestId");
+ String requestId = (String) execution.getVariable(MSO_REQUEST_ID);
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
request.setRequestStatus(status);
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
index d248ad5443..155455e654 100644
--- 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
@@ -20,12 +20,28 @@
package org.onap.so.bpmn.infrastructure.namingservice.tasks;
-
+import java.util.List;
+import java.util.Optional;
+import org.onap.aai.domain.yang.Zone;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+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.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.namingservice.NamingRequestObject;
+import org.onap.so.client.namingservice.NamingServiceConstants;
import org.onap.so.client.orchestration.NamingServiceResources;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -40,6 +56,14 @@ public class NamingServiceCreateTasks {
@Autowired
private NamingServiceResources namingServiceResources;
+ @Autowired
+ protected InjectionHelper injectionHelper;
+ @Autowired
+ protected BBInputSetupUtils bbInputSetupUtils;
+
+ public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) {
+ this.bbInputSetupUtils = bbInputSetupUtils;
+ }
public void createInstanceGroupName(BuildingBlockExecution execution) throws Exception {
InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
@@ -54,4 +78,46 @@ public class NamingServiceCreateTasks {
}
instanceGroup.setInstanceGroupName(generatedInstanceGroupName);
}
+
+ public void createWanTransportServiceName(BuildingBlockExecution execution) throws Exception {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ NamingRequestObject namingRequestObject = new NamingRequestObject();
+ namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId());
+ namingRequestObject.setNamingTypeValue(NamingServiceConstants.NAMING_TYPE_SERVICE);
+ namingRequestObject.setResourceNameValue(NamingServiceConstants.RESOURCE_NAME_SERVICE_INSTANCE_NAME);
+ namingRequestObject.setPolicyInstanceNameValue(serviceInstance.getModelInfoServiceInstance().getNamingPolicy());
+ namingRequestObject.setServiceModelNameValue(serviceInstance.getModelInfoServiceInstance().getModelName());
+ namingRequestObject.setModelVersionValue(serviceInstance.getModelInfoServiceInstance().getModelVersion());
+
+ String generatedWanTransportServiceName = "";
+ try {
+ generatedWanTransportServiceName = namingServiceResources.generateServiceInstanceName(namingRequestObject);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ serviceInstance.setServiceInstanceName(generatedWanTransportServiceName);
+ }
+
+ public void createVpnBondingServiceName(BuildingBlockExecution execution) throws Exception {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ VpnBinding vpnBinding = extractPojosForBB.extractByKey(execution, ResourceKey.VPN_ID);
+ NamingRequestObject namingRequestObject = new NamingRequestObject();
+ namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId());
+ namingRequestObject.setPolicyInstanceNameValue(serviceInstance.getModelInfoServiceInstance().getNamingPolicy());
+ namingRequestObject.setNamingTypeValue(NamingServiceConstants.NAMING_TYPE_SERVICE);
+ namingRequestObject.setServiceModelNameValue(serviceInstance.getModelInfoServiceInstance().getModelName());
+ namingRequestObject.setModelVersionValue(serviceInstance.getModelInfoServiceInstance().getModelVersion());
+ namingRequestObject.setNetworkNameValue(execution.getVariable(network.getNetworkName()));
+ namingRequestObject.setVpnNameValue(vpnBinding.getVpnName());
+ namingRequestObject.setResourceNameValue(NamingServiceConstants.RESOURCE_NAME_SERVICE_INSTANCE_NAME);
+
+ String generatedVpnBondingServiceName = "";
+ try {
+ generatedVpnBondingServiceName = namingServiceResources.generateServiceInstanceName(namingRequestObject);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ serviceInstance.setServiceInstanceName(generatedVpnBondingServiceName);
+ }
}
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
index 9a8c9df8b5..507e14e42a 100644
--- 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
@@ -23,9 +23,11 @@ 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.bbobjects.ServiceInstance;
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.namingservice.NamingRequestObject;
import org.onap.so.client.orchestration.NamingServiceResources;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -50,4 +52,16 @@ public class NamingServiceDeleteTasks {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+
+ public void deleteServiceInstanceName(BuildingBlockExecution execution) throws Exception {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ NamingRequestObject namingRequestObject = new NamingRequestObject();
+ namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId());
+ try {
+ namingServiceResources.deleteServiceInstanceName(namingRequestObject);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java
index d76d860b3b..b8f025aaa6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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.sdnc.exceptions;
public class SDNCErrorResponseException extends Exception {
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 7a0008d5a2..e4dd35503e 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
@@ -22,6 +22,8 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
+import java.net.URI;
+import javax.ws.rs.core.UriBuilder;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
@@ -46,11 +48,13 @@ import org.onap.so.client.sdnc.endpoint.SDNCTopology;
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 SDNCActivateTasks {
- private static final Logger logger = LoggerFactory.getLogger(SDNCActivateTasks.class);
+
+ public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCVnfResources sdncVnfResources;
@Autowired
@@ -61,7 +65,8 @@ public class SDNCActivateTasks {
private SDNCNetworkResources sdncNetworkResources;
@Autowired
private SDNCVfModuleResources sdncVfModuleResources;
-
+ @Autowired
+ private Environment env;
public void activateVnf(BuildingBlockExecution execution) {
try {
@@ -77,7 +82,7 @@ public class SDNCActivateTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -103,7 +108,7 @@ public class SDNCActivateTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -121,12 +126,15 @@ public class SDNCActivateTasks {
vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.activateVfModule(vfModule, vnf,
- serviceInstance, customer, cloudRegion, requestContext);
SDNCRequest sdncRequest = new SDNCRequest();
+ UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint"))
+ .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue());
+ URI uri = builder.build();
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.activateVfModule(vfModule, vnf,
+ serviceInstance, customer, cloudRegion, requestContext, uri);
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, 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 d3878f06b7..c100cd6cee 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
@@ -22,6 +22,8 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
+import java.net.URI;
+import javax.ws.rs.core.UriBuilder;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
@@ -49,11 +51,13 @@ import org.onap.so.client.sdnc.endpoint.SDNCTopology;
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 SDNCAssignTasks {
private static final Logger logger = LoggerFactory.getLogger(SDNCAssignTasks.class);
+ public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCServiceInstanceResources sdncSIResources;
@Autowired
@@ -66,6 +70,8 @@ public class SDNCAssignTasks {
private ExtractPojosForBB extractPojosForBB;
@Autowired
private SDNCNetworkResources sdncNetworkResources;
+ @Autowired
+ private Environment env;
public void assignServiceInstance(BuildingBlockExecution execution) {
try {
@@ -79,7 +85,7 @@ public class SDNCAssignTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.SERVICE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -99,7 +105,7 @@ public class SDNCAssignTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -121,12 +127,15 @@ public class SDNCAssignTasks {
}
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.assignVfModule(vfModule,
- volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext);
SDNCRequest sdncRequest = new SDNCRequest();
+ UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint"))
+ .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue());
+ URI uri = builder.build();
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.assignVfModule(vfModule,
+ volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, uri);
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -152,7 +161,7 @@ public class SDNCAssignTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, 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 50cf0fb074..acf48acdda 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,8 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
+import java.net.URI;
+import javax.ws.rs.core.UriBuilder;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
@@ -43,10 +45,12 @@ 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.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
public class SDNCChangeAssignTasks {
+ public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCNetworkResources sdncNetworkResources;
@Autowired
@@ -59,6 +63,8 @@ public class SDNCChangeAssignTasks {
private ExceptionBuilder exceptionUtil;
@Autowired
private SDNCVfModuleResources sdncVfModuleResources;
+ @Autowired
+ private Environment env;
public void changeModelServiceInstance(BuildingBlockExecution execution) {
try {
@@ -70,7 +76,7 @@ public class SDNCChangeAssignTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.SERVICE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -87,7 +93,7 @@ public class SDNCChangeAssignTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -104,7 +110,7 @@ public class SDNCChangeAssignTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -120,12 +126,15 @@ public class SDNCChangeAssignTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
Customer customer = gBBInput.getCustomer();
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.changeAssignVfModule(vfModule,
- vnf, serviceInstance, customer, cloudRegion, requestContext);
SDNCRequest sdncRequest = new SDNCRequest();
+ UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint"))
+ .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue());
+ URI uri = builder.build();
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.changeAssignVfModule(vfModule,
+ vnf, serviceInstance, customer, cloudRegion, requestContext, uri);
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, 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 3a1528946d..3fc25196e1 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
@@ -22,6 +22,8 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
+import java.net.URI;
+import javax.ws.rs.core.UriBuilder;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
@@ -47,11 +49,13 @@ import org.onap.so.client.sdnc.endpoint.SDNCTopology;
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 SDNCDeactivateTasks {
- private static final Logger logger = LoggerFactory.getLogger(SDNCDeactivateTasks.class);
+
+ public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCNetworkResources sdncNetworkResources;
@Autowired
@@ -64,6 +68,8 @@ public class SDNCDeactivateTasks {
private ExceptionBuilder exceptionUtil;
@Autowired
private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private Environment env;
public void deactivateVfModule(BuildingBlockExecution execution) {
try {
@@ -75,12 +81,15 @@ public class SDNCDeactivateTasks {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.deactivateVfModule(vfModule, vnf,
- serviceInstance, customer, cloudRegion, requestContext);
SDNCRequest sdncRequest = new SDNCRequest();
+ UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint"))
+ .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue());
+ URI uri = builder.build();
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.deactivateVfModule(vfModule, vnf,
+ serviceInstance, customer, cloudRegion, requestContext, uri);
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -107,7 +116,7 @@ public class SDNCDeactivateTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -132,7 +141,7 @@ public class SDNCDeactivateTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.SERVICE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -157,7 +166,7 @@ public class SDNCDeactivateTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, 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 7ae6117c61..fcc67d0ef7 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
@@ -39,7 +39,8 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCQueryTasks {
- private static final Logger logger = LoggerFactory.getLogger(SDNCQueryTasks.class);
+
+ public static final String SDNCQUERY_RESPONSE = "SDNCQueryResponse_";
@Autowired
private SDNCVnfResources sdncVnfResources;
@Autowired
@@ -61,7 +62,7 @@ public class SDNCQueryTasks {
genericVnf.setSelflink(selfLink);
}
String response = sdncVnfResources.queryVnf(genericVnf);
- execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), response);
+ execution.setVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId(), response);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -82,7 +83,7 @@ public class SDNCQueryTasks {
}
if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) {
String response = sdncVfModuleResources.queryVfModule(vfModule);
- execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response);
+ execution.setVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId(), response);
} else {
throw new Exception("Vf Module " + vfModule.getVfModuleId()
+ " exists in gBuildingBlock but does not have a selflink value");
@@ -97,7 +98,7 @@ public class SDNCQueryTasks {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) {
String response = sdncVfModuleResources.queryVfModule(vfModule);
- execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response);
+ execution.setVariable(SDNCQUERY_RESPONSE + 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
index f32ffd72c3..cb761f4110 100644
--- 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
@@ -21,8 +21,13 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
import java.io.StringReader;
+import java.io.StringWriter;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -98,12 +103,18 @@ public class SDNCRequestTasks {
Document doc = db.parse(new InputSource(new StringReader(asyncRequest)));
String finalMessageIndicator = getXmlElement(doc, "/input/ack-final-indicator");
+
boolean isCallbackCompleted = convertIndicatorToBoolean(finalMessageIndicator);
execution.setVariable(IS_CALLBACK_COMPLETED, isCallbackCompleted);
if (isCallbackCompleted) {
String responseCode = getXmlElement(doc, "/input/response-code");
- String responseMessage = getXmlElement(doc, "/input/response-message");
if (!SDNC_SUCCESS.equalsIgnoreCase(responseCode)) {
+ String responseMessage;
+ try {
+ responseMessage = getXmlElement(doc, "/input/response-message");
+ } catch (Exception e) {
+ responseMessage = "Unknown Error in SDNC";
+ }
throw new SDNCErrorResponseException(responseMessage);
}
}
@@ -126,8 +137,17 @@ public class SDNCRequestTasks {
}
protected String getXmlElement(Document doc, String exp) throws Exception {
+ TransformerFactory tf = TransformerFactory.newInstance();
+ Transformer transformer = tf.newTransformer();
+ StringWriter writer = new StringWriter();
+ transformer.transform(new DOMSource(doc), new StreamResult(writer));
+ logger.debug(writer.getBuffer().toString());
XPath xPath = XPathFactory.newInstance().newXPath();
- return xPath.evaluate(exp, doc);
+ String result = xPath.evaluate(exp, doc);
+ if (result == null || result.isEmpty()) {
+ throw new Exception("XPath Failed to find element expression: " + exp);
+ }
+ return result;
}
}
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 e9848d1646..7d5591af0f 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
@@ -22,6 +22,8 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
+import java.net.URI;
+import javax.ws.rs.core.UriBuilder;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
@@ -47,11 +49,13 @@ import org.onap.so.client.sdnc.endpoint.SDNCTopology;
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 SDNCUnassignTasks {
- private static final Logger logger = LoggerFactory.getLogger(SDNCUnassignTasks.class);
+
+ public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCServiceInstanceResources sdncSIResources;
@Autowired
@@ -64,6 +68,8 @@ public class SDNCUnassignTasks {
private ExtractPojosForBB extractPojosForBB;
@Autowired
private SDNCNetworkResources sdncNetworkResources;
+ @Autowired
+ private Environment env;
public void unassignServiceInstance(BuildingBlockExecution execution) {
try {
@@ -77,7 +83,7 @@ public class SDNCUnassignTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.SERVICE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -89,12 +95,15 @@ public class SDNCUnassignTasks {
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericResourceApiVfModuleOperationInformation req =
- sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance);
SDNCRequest sdncRequest = new SDNCRequest();
+ UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint"))
+ .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue());
+ URI uri = builder.build();
+ GenericResourceApiVfModuleOperationInformation req =
+ sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance, uri);
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -114,7 +123,7 @@ public class SDNCUnassignTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -136,7 +145,7 @@ public class SDNCUnassignTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
index 47855eaa6e..fc3f2aec7a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
@@ -23,8 +23,8 @@ package org.onap.so.bpmn.infrastructure.validations;
import java.util.Optional;
import java.util.regex.Pattern;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.common.validation.PreBuildingBlockValidator;
-import org.onap.so.bpmn.common.validation.Skip;
+import org.onap.so.bpmn.common.listener.Skip;
+import org.onap.so.bpmn.common.listener.validation.PreBuildingBlockValidator;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.client.exception.ExceptionBuilder;
import org.slf4j.Logger;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
new file mode 100644
index 0000000000..1852485083
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
@@ -0,0 +1,155 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Samsung Electronics Co., Ltd. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.workflow.tasks;
+
+import java.util.List;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
+import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+
+public class ConfigBuildingBlocksDataObject {
+
+ private ServiceInstancesRequest sIRequest;
+ private List<OrchestrationFlow> orchFlows;
+ private String requestId;
+ private Resource resourceKey;
+ private String apiVersion;
+ private String resourceId;
+ private String requestAction;
+ private boolean aLaCarte;
+ private String vnfType;
+ private WorkflowResourceIds workflowResourceIds;
+ private RequestDetails requestDetails;
+ private DelegateExecution execution;
+
+ public ServiceInstancesRequest getsIRequest() {
+ return sIRequest;
+ }
+
+ public ConfigBuildingBlocksDataObject setsIRequest(ServiceInstancesRequest sIRequest) {
+ this.sIRequest = sIRequest;
+ return this;
+ }
+
+ public List<OrchestrationFlow> getOrchFlows() {
+ return orchFlows;
+ }
+
+ public ConfigBuildingBlocksDataObject setOrchFlows(List<OrchestrationFlow> orchFlows) {
+ this.orchFlows = orchFlows;
+ return this;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public ConfigBuildingBlocksDataObject setRequestId(String requestId) {
+ this.requestId = requestId;
+ return this;
+ }
+
+ public Resource getResourceKey() {
+ return resourceKey;
+ }
+
+ public ConfigBuildingBlocksDataObject setResourceKey(Resource resourceKey) {
+ this.resourceKey = resourceKey;
+ return this;
+ }
+
+ public String getApiVersion() {
+ return apiVersion;
+ }
+
+ public ConfigBuildingBlocksDataObject setApiVersion(String apiVersion) {
+ this.apiVersion = apiVersion;
+ return this;
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public ConfigBuildingBlocksDataObject setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ return this;
+ }
+
+ public String getRequestAction() {
+ return requestAction;
+ }
+
+ public ConfigBuildingBlocksDataObject setRequestAction(String requestAction) {
+ this.requestAction = requestAction;
+ return this;
+ }
+
+ public boolean isaLaCarte() {
+ return aLaCarte;
+ }
+
+ public ConfigBuildingBlocksDataObject setaLaCarte(boolean aLaCarte) {
+ this.aLaCarte = aLaCarte;
+ return this;
+ }
+
+ public String getVnfType() {
+ return vnfType;
+ }
+
+ public ConfigBuildingBlocksDataObject setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ return this;
+ }
+
+ public WorkflowResourceIds getWorkflowResourceIds() {
+ return workflowResourceIds;
+ }
+
+ public ConfigBuildingBlocksDataObject setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) {
+ this.workflowResourceIds = workflowResourceIds;
+ return this;
+ }
+
+ public RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+
+ public ConfigBuildingBlocksDataObject setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ return this;
+ }
+
+ public DelegateExecution getExecution() {
+ return execution;
+ }
+
+ public ConfigBuildingBlocksDataObject setExecution(DelegateExecution execution) {
+ this.execution = execution;
+ return this;
+ }
+
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfBondingServiceException.java
index 6d81cba41d..0584472e14 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfBondingServiceException.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -18,11 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.sdnc.tasks;
+package org.onap.so.bpmn.infrastructure.workflow.tasks;
-import org.springframework.stereotype.Component;
-
-@Component
-public class SDNCDeleteTasks {
+public class VrfBondingServiceException extends Exception {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -4277883464681291740L;
+ public VrfBondingServiceException(String errorMessage) {
+ super(errorMessage);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java
new file mode 100644
index 0000000000..1e0208b6ec
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java
@@ -0,0 +1,163 @@
+/*-
+ * ============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.aai.domain.yang.L3Network;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class VrfValidation {
+
+ @Autowired
+ protected BBInputSetupUtils bbInputSetupUtils;
+
+ public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) {
+ this.bbInputSetupUtils = bbInputSetupUtils;
+ }
+
+ protected void vrfServiceValidation(org.onap.so.db.catalog.beans.Service service)
+ throws VrfBondingServiceException {
+ if (!"BONDING".equalsIgnoreCase(service.getServiceType())
+ || !"INFRASTRUCTURE-VPN".equalsIgnoreCase(service.getServiceRole())) {
+ throw new VrfBondingServiceException("Service: " + service.getModelName()
+ + " does not have service type of BONDING and does not have service role of INFRASTRUCTURE-VPN");
+ }
+ }
+
+ protected void vrfCatalogDbChecks(org.onap.so.db.catalog.beans.Service service) throws VrfBondingServiceException {
+ ConfigurationResourceCustomization configuration = getVrfConfiguration(service);
+ if (configuration == null || configuration.getServiceProxyResourceCustomization() == null
+ || configuration.getServiceProxyResourceCustomization().getSourceService() == null
+ || !configuration.getServiceProxyResourceCustomization().getSourceService().getServiceType()
+ .equalsIgnoreCase("TRANSPORT")) {
+ throw new VrfBondingServiceException("Service: " + service.getModelName()
+ + " does not have a configuration of type VRF-ENTRY and role INFRASTRUCTURE-CLOUD-VPN"
+ + ", and serviceProxy that does not have source service that has a serviceType of TRANSPORT)");
+ }
+ }
+
+ protected ConfigurationResourceCustomization getVrfConfiguration(org.onap.so.db.catalog.beans.Service service) {
+ for (ConfigurationResourceCustomization configuration : service.getConfigurationCustomizations()) {
+ if (configuration.getType() != null && configuration.getType().equalsIgnoreCase("VRF-ENTRY")
+ && configuration.getRole() != null
+ && configuration.getRole().equalsIgnoreCase("INFRASTRUCTURE-CLOUD-VPN")) {
+ return configuration;
+ }
+ }
+ return null;
+ }
+
+ protected void aaiVpnBindingValidation(String relatedVpnId, org.onap.aai.domain.yang.VpnBinding aaiVpnBinding)
+ throws VrfBondingServiceException {
+ if (aaiVpnBinding == null) {
+ throw new VrfBondingServiceException("The infrastructure vpn " + relatedVpnId + " does not exist in A&AI.");
+ } else if (aaiVpnBinding.getVpnType() != null
+ && !aaiVpnBinding.getVpnType().equalsIgnoreCase("SERVICE-INFRASTRUCTURE")) {
+ throw new VrfBondingServiceException(
+ "VpnBinding: " + relatedVpnId + " does not have a vpn type of SERVICE-INFRASTRUCTURE.");
+ }
+ }
+
+ protected void aaiAggregateRouteValidation(org.onap.aai.domain.yang.L3Network aaiLocalNetwork)
+ throws VrfBondingServiceException {
+ if (aaiLocalNetwork.getAggregateRoutes() == null
+ || aaiLocalNetwork.getAggregateRoutes().getAggregateRoute() == null) {
+ return;
+ }
+ if (aaiLocalNetwork.getAggregateRoutes().getAggregateRoute().size() == 1 && !aaiLocalNetwork
+ .getAggregateRoutes().getAggregateRoute().get(0).getIpVersion().equalsIgnoreCase("4")) {
+ throw new VrfBondingServiceException("LocalNetwork: " + aaiLocalNetwork.getNetworkId()
+ + " has 1 aggregate route but the Ip version of aggregate route is : "
+ + aaiLocalNetwork.getAggregateRoutes().getAggregateRoute().get(0).getIpVersion() + " and is not 4");
+ } else if (aaiLocalNetwork.getAggregateRoutes().getAggregateRoute().size() == 2
+ && !ipVersionValidation(aaiLocalNetwork.getAggregateRoutes().getAggregateRoute().get(0).getIpVersion(),
+ aaiLocalNetwork.getAggregateRoutes().getAggregateRoute().get(1).getIpVersion())) {
+ throw new VrfBondingServiceException("LocalNetwork: " + aaiLocalNetwork.getNetworkId()
+ + " has 2 aggregate routes but the combination of the Ip versions for the aggregate routes did not match the ip version of one of them to be 4 and one to be 6");
+ } else if (aaiLocalNetwork.getAggregateRoutes().getAggregateRoute().size() > 2) {
+ throw new VrfBondingServiceException(
+ "LocalNetwork: " + aaiLocalNetwork.getNetworkId() + " either has more than 2 aggregate routes");
+ }
+ }
+
+ protected void aaiNetworkValidation(String relatedNetworkid, org.onap.aai.domain.yang.L3Network aaiLocalNetwork)
+ throws VrfBondingServiceException {
+ if (aaiLocalNetwork == null) {
+ throw new VrfBondingServiceException("The local network " + relatedNetworkid + " does not exist in A&AI.");
+ }
+ }
+
+ protected void aaiSubnetValidation(org.onap.aai.domain.yang.L3Network aaiLocalNetwork)
+ throws VrfBondingServiceException {
+ if (aaiLocalNetwork.getSubnets() == null || aaiLocalNetwork.getSubnets().getSubnet() == null) {
+ throw new VrfBondingServiceException("LocalNetwork: " + aaiLocalNetwork.getNetworkId() + " has no subnets");
+ } else if (aaiLocalNetwork.getSubnets().getSubnet().size() == 1
+ && !aaiLocalNetwork.getSubnets().getSubnet().get(0).getIpVersion().equalsIgnoreCase("4")) {
+ throw new VrfBondingServiceException("LocalNetwork: " + aaiLocalNetwork.getNetworkId()
+ + " has 1 subnet but the Ip version of subnet is : "
+ + aaiLocalNetwork.getSubnets().getSubnet().get(0).getIpVersion() + " and is not 4");
+ } else if (aaiLocalNetwork.getSubnets().getSubnet().size() == 2
+ && !ipVersionValidation(aaiLocalNetwork.getSubnets().getSubnet().get(0).getIpVersion(),
+ aaiLocalNetwork.getSubnets().getSubnet().get(1).getIpVersion())) {
+ throw new VrfBondingServiceException("LocalNetwork: " + aaiLocalNetwork.getNetworkId()
+ + " has 2 subnets but the combination of the Ip versions for the subnets did not match the ip version of one of them to be 4 and one to be 6");
+ } else if (aaiLocalNetwork.getSubnets().getSubnet().isEmpty()
+ || aaiLocalNetwork.getSubnets().getSubnet().size() > 2) {
+ throw new VrfBondingServiceException("LocalNetwork: " + aaiLocalNetwork.getNetworkId()
+ + " either has no subnets or more than 2 subnets");
+ }
+ }
+
+ protected boolean ipVersionValidation(String ipVersion1, String ipVersion2) {
+ return (ipVersion1.equalsIgnoreCase("4") && ipVersion2.equalsIgnoreCase("6"))
+ || (ipVersion1.equalsIgnoreCase("6") && ipVersion2.equalsIgnoreCase("4"));
+ }
+
+ protected void aaiRouteTargetValidation(L3Network aaiLocalNetwork) throws VrfBondingServiceException {
+ AAIResultWrapper networkWrapper = new AAIResultWrapper(aaiLocalNetwork);
+ if (networkWrapper.getRelationships().isPresent()) {
+ List<AAIResourceUri> vpnBindingUris =
+ networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING);
+ if (!vpnBindingUris.isEmpty()) {
+ Optional<org.onap.aai.domain.yang.VpnBinding> vpnBindingOp =
+ bbInputSetupUtils.getAAIResourceDepthOne(vpnBindingUris.get(0))
+ .asBean(org.onap.aai.domain.yang.VpnBinding.class);
+ if (vpnBindingOp.isPresent()) {
+ org.onap.aai.domain.yang.VpnBinding vpnBinding = vpnBindingOp.get();
+ if (vpnBinding.getRouteTargets() != null
+ && !vpnBinding.getRouteTargets().getRouteTarget().isEmpty()) {
+ return;
+ }
+ }
+ }
+ }
+ throw new VrfBondingServiceException("The Local Network: " + aaiLocalNetwork.getNetworkId()
+ + " does not have vpn binding and/or RT information");
+ }
+}
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 94209908be..fffaee0f7c 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
@@ -35,13 +35,14 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.javatuples.Pair;
-import org.slf4j.LoggerFactory;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.L3Network;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.Vnfc;
import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.aai.domain.yang.VpnBinding;
+import org.onap.so.bpmn.common.BBConstants;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
@@ -61,9 +62,11 @@ import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
+import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
+import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
-import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
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;
@@ -78,9 +81,11 @@ import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.onap.so.serviceinstancebeans.VfModules;
import org.onap.so.serviceinstancebeans.Vnfs;
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;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@Component
@@ -91,15 +96,6 @@ public class WorkflowAction {
private static final String VF_MODULES = "vfModules";
private static final String WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI =
"WorkflowAction was unable to verify if the instance name already exist in AAI.";
- private static final String G_ORCHESTRATION_FLOW = "gOrchestrationFlow";
- private static final String G_ACTION = "requestAction";
- private static final String G_CURRENT_SEQUENCE = "gCurrentSequence";
- private static final String G_REQUEST_ID = "mso-request-id";
- private static final String G_BPMN_REQUEST = "bpmnRequest";
- private static final String G_ALACARTE = "aLaCarte";
- private static final String G_APIVERSION = "apiVersion";
- private static final String G_URI = "requestUri";
- private static final String G_ISTOPLEVELFLOW = "isTopLevelFlow";
private static final String VNF_TYPE = "vnfType";
private static final String SERVICE = "Service";
private static final String VNF = "Vnf";
@@ -115,8 +111,8 @@ public class WorkflowAction {
"vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances|instanceGroups";
private static final String HOMINGSOLUTION = "Homing_Solution";
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 String SERVICE_TYPE_BONDING = "BONDING";
private static final String CLOUD_OWNER = "DEFAULT";
private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class);
@@ -132,6 +128,8 @@ public class WorkflowAction {
private AAIConfigurationResources aaiConfigurationResources;
@Autowired
private WorkflowActionExtractResourcesAAI workflowActionUtils;
+ @Autowired
+ private VrfValidation vrfValidation;
@Autowired
private Environment environment;
@@ -146,17 +144,19 @@ public class WorkflowAction {
}
public void selectExecutionList(DelegateExecution execution) throws Exception {
- final String requestAction = (String) execution.getVariable(G_ACTION);
- final String requestId = (String) execution.getVariable(G_REQUEST_ID);
- final String bpmnRequest = (String) execution.getVariable(G_BPMN_REQUEST);
- final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
- final String apiVersion = (String) execution.getVariable(G_APIVERSION);
- final String uri = (String) execution.getVariable(G_URI);
+ final String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
+ final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
+ final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST);
+ final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
+ final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION);
+ final String uri = (String) execution.getVariable(BBConstants.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("");
+ final String serviceType =
+ Optional.ofNullable((String) execution.getVariable(BBConstants.G_SERVICE_TYPE)).orElse("");
- List<OrchestrationFlow> orchFlows = (List<OrchestrationFlow>) execution.getVariable(G_ORCHESTRATION_FLOW);
+ List<OrchestrationFlow> orchFlows =
+ (List<OrchestrationFlow>) execution.getVariable(BBConstants.G_ORCHESTRATION_FLOW);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
@@ -167,7 +167,7 @@ public class WorkflowAction {
try {
ObjectMapper mapper = new ObjectMapper();
- execution.setVariable(G_ISTOPLEVELFLOW, true);
+ execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true);
ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
RequestDetails requestDetails = sIRequest.getRequestDetails();
String cloudOwner = "";
@@ -217,9 +217,13 @@ public class WorkflowAction {
boolean isConfiguration = isConfiguration(orchFlows);
Resource resourceKey = new Resource(resourceType, key, aLaCarte);
if (isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
- List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(sIRequest, orchFlows,
- requestId, resourceKey, apiVersion, resourceId, requestAction, aLaCarte, vnfType,
- workflowResourceIds, requestDetails, execution);
+ List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(
+ new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows)
+ .setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
+ .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(aLaCarte)
+ .setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds)
+ .setRequestDetails(requestDetails).setExecution(execution));
+
flowsToExecute.addAll(configBuildingBlocks);
}
orchFlows = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION))
@@ -271,7 +275,7 @@ public class WorkflowAction {
foundRelated = traverseUserParamsService(execution, resourceCounter, sIRequest, requestAction);
}
if (!foundRelated) {
- traverseCatalogDbService(execution, sIRequest, resourceCounter);
+ traverseCatalogDbService(execution, sIRequest, resourceCounter, aaiResourceIds);
}
} else if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase("activateInstance")
|| requestAction.equalsIgnoreCase("unassignInstance")
@@ -328,7 +332,8 @@ public class WorkflowAction {
}
}
- // If the user set "Homing_Solution" to "none", disable homing, else if "Homing_Solution" is specified,
+ // 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) {
@@ -355,14 +360,14 @@ public class WorkflowAction {
flowNames.add(ebb.getBuildingBlock().getBpmnFlowName());
}
execution.setVariable("flowNames", flowNames);
- execution.setVariable(G_CURRENT_SEQUENCE, 0);
+ execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, 0);
execution.setVariable("retryCount", 0);
execution.setVariable("isRollback", false);
execution.setVariable("flowsToExecute", flowsToExecute);
execution.setVariable("isRollbackComplete", false);
} catch (Exception ex) {
- buildAndThrowException(execution, "Exception in create execution list " + ex.getMessage(), ex);
+ buildAndThrowException(execution, "Exception in create execution list. " + ex.getMessage(), ex);
}
}
@@ -423,17 +428,14 @@ public class WorkflowAction {
return false;
}
- protected List<ExecuteBuildingBlock> getConfigBuildingBlocks(ServiceInstancesRequest sIRequest,
- List<OrchestrationFlow> orchFlows, String requestId, Resource resourceKey, String apiVersion,
- String resourceId, String requestAction, boolean aLaCarte, String vnfType,
- WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, DelegateExecution execution) {
+ protected List<ExecuteBuildingBlock> getConfigBuildingBlocks(ConfigBuildingBlocksDataObject dataObj) {
List<ExecuteBuildingBlock> flowsToExecuteConfigs = new ArrayList<>();
- List<OrchestrationFlow> result = new ArrayList<>(orchFlows);
- result = orchFlows.stream().filter(item -> item.getFlowName().contains(FABRIC_CONFIGURATION))
+ List<OrchestrationFlow> result = new ArrayList<>(dataObj.getOrchFlows());
+ result = dataObj.getOrchFlows().stream().filter(item -> item.getFlowName().contains(FABRIC_CONFIGURATION))
.collect(Collectors.toList());
- String vnfId = workflowResourceIds.getVnfId();
- String vfModuleId = workflowResourceIds.getVfModuleId();
+ String vnfId = dataObj.getWorkflowResourceIds().getVnfId();
+ String vfModuleId = dataObj.getWorkflowResourceIds().getVfModuleId();
String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
String vfModuleCustomizationUUID =
@@ -447,21 +449,22 @@ public class WorkflowAction {
if (configurations.size() > 1) {
String multipleRelationshipsError =
"Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations";
- buildAndThrowException(execution, multipleRelationshipsError,
+ buildAndThrowException(dataObj.getExecution(), multipleRelationshipsError,
new Exception(multipleRelationshipsError));
}
for (org.onap.aai.domain.yang.Configuration configuration : configurations) {
- workflowResourceIds.setConfigurationId(configuration.getConfigurationId());
+ dataObj.getWorkflowResourceIds().setConfigurationId(configuration.getConfigurationId());
for (OrchestrationFlow orchFlow : result) {
- resourceKey.setVfModuleCustomizationId(vfModuleCustomizationUUID);
- resourceKey.setCvnfModuleCustomizationId(vnfc.getModelCustomizationId());
- resourceKey.setVnfCustomizationId(vnfCustomizationUUID);
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion,
- resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false,
- null, true);
+ dataObj.getResourceKey().setVfModuleCustomizationId(vfModuleCustomizationUUID);
+ dataObj.getResourceKey().setCvnfModuleCustomizationId(vnfc.getModelCustomizationId());
+ dataObj.getResourceKey().setVnfCustomizationId(vnfCustomizationUUID);
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, dataObj.getRequestId(),
+ dataObj.getResourceKey(), dataObj.getApiVersion(), dataObj.getResourceId(),
+ dataObj.getRequestAction(), dataObj.isaLaCarte(), dataObj.getVnfType(),
+ dataObj.getWorkflowResourceIds(), dataObj.getRequestDetails(), false, null, true);
String vnfcName = getVnfcNameForConfiguration(configuration);
if (vnfcName == null || vnfcName.isEmpty()) {
- buildAndThrowException(execution, "Exception in create execution list "
+ buildAndThrowException(dataObj.getExecution(), "Exception in create execution list "
+ ": VnfcName does not exist or is null while there is a configuration for the vfModule",
new Exception("Vnfc and Configuration do not match"));
}
@@ -617,97 +620,179 @@ public class WorkflowAction {
}
protected void traverseCatalogDbService(DelegateExecution execution, ServiceInstancesRequest sIRequest,
- List<Resource> resourceCounter) {
+ List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds)
+ throws JsonProcessingException, VrfBondingServiceException {
String modelUUID = sIRequest.getRequestDetails().getModelInfo().getModelVersionId();
org.onap.so.db.catalog.beans.Service service = catalogDbClient.getServiceByID(modelUUID);
if (service == null) {
buildAndThrowException(execution, "Could not find the service model in catalog db.");
} else {
resourceCounter.add(new Resource(WorkflowType.SERVICE, service.getModelUUID(), false));
- if (service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty()) {
- List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
- if (customizations.isEmpty()) {
- logger.debug("No Collections found. CollectionResourceCustomization list is empty.");
- } else {
- CollectionResourceCustomization collectionResourceCustomization =
- findCatalogNetworkCollection(execution, service);
- if (collectionResourceCustomization != null) {
- resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,
- collectionResourceCustomization.getModelCustomizationUUID(), false));
- logger.debug("Found a network collection");
- if (collectionResourceCustomization.getCollectionResource() != null) {
- if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() != null) {
- String toscaNodeType = collectionResourceCustomization.getCollectionResource()
- .getInstanceGroup().getToscaNodeType();
- if (toscaNodeType != null && toscaNodeType.contains("NetworkCollection")) {
- int minNetworks = 0;
- org.onap.so.db.catalog.beans.InstanceGroup instanceGroup =
- collectionResourceCustomization.getCollectionResource().getInstanceGroup();
- CollectionResourceInstanceGroupCustomization collectionInstCust = null;
- if (!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
- for (CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup
- .getCollectionInstanceGroupCustomizations()) {
- if (collectionInstanceGroupTemp.getModelCustomizationUUID()
- .equalsIgnoreCase(collectionResourceCustomization
- .getModelCustomizationUUID())) {
- collectionInstCust = collectionInstanceGroupTemp;
- break;
- }
- }
- if (collectionInstCust != null
- && collectionInstCust.getSubInterfaceNetworkQuantity() != null) {
- minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
- }
- }
- logger.debug("minNetworks: {}", minNetworks);
- CollectionNetworkResourceCustomization collectionNetworkResourceCust = null;
- for (CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup
- .getCollectionNetworkResourceCustomizations()) {
- if (collectionNetworkTemp.getNetworkResourceCustomization()
- .getModelCustomizationUUID().equalsIgnoreCase(
- collectionResourceCustomization.getModelCustomizationUUID())) {
- collectionNetworkResourceCust = collectionNetworkTemp;
+ RelatedInstance relatedVpnBinding =
+ bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.vpnBinding);
+ RelatedInstance relatedLocalNetwork =
+ bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.network);
+ if (relatedVpnBinding != null && relatedLocalNetwork != null) {
+ traverseVrfConfiguration(execution, aaiResourceIds, resourceCounter, service, relatedVpnBinding,
+ relatedLocalNetwork);
+ } else {
+ traverseNetworkCollection(execution, resourceCounter, service);
+ }
+ }
+ }
+
+ protected void traverseVrfConfiguration(DelegateExecution execution,
+ List<Pair<WorkflowType, String>> aaiResourceIds, List<Resource> resourceCounter,
+ org.onap.so.db.catalog.beans.Service service, RelatedInstance relatedVpnBinding,
+ RelatedInstance relatedLocalNetwork) throws VrfBondingServiceException, JsonProcessingException {
+ org.onap.aai.domain.yang.L3Network aaiLocalNetwork =
+ bbInputSetupUtils.getAAIL3Network(relatedLocalNetwork.getInstanceId());
+ vrfValidation.vrfServiceValidation(service);
+ vrfValidation.vrfCatalogDbChecks(service);
+ vrfValidation.aaiVpnBindingValidation(relatedVpnBinding.getInstanceId(),
+ bbInputSetupUtils.getAAIVpnBinding(relatedVpnBinding.getInstanceId()));
+ vrfValidation.aaiNetworkValidation(relatedLocalNetwork.getInstanceId(), aaiLocalNetwork);
+ vrfValidation.aaiSubnetValidation(aaiLocalNetwork);
+ vrfValidation.aaiAggregateRouteValidation(aaiLocalNetwork);
+ vrfValidation.aaiRouteTargetValidation(aaiLocalNetwork);
+ String existingAAIVrfConfiguration = getExistingAAIVrfConfiguration(relatedVpnBinding, aaiLocalNetwork);
+ if (existingAAIVrfConfiguration != null) {
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION, existingAAIVrfConfiguration));
+ }
+ resourceCounter.add(new Resource(WorkflowType.CONFIGURATION,
+ service.getConfigurationCustomizations().get(0).getModelCustomizationUUID(), false));
+
+ }
+
+ protected String getExistingAAIVrfConfiguration(RelatedInstance relatedVpnBinding,
+ org.onap.aai.domain.yang.L3Network aaiLocalNetwork)
+ throws JsonProcessingException, VrfBondingServiceException {
+ Optional<Relationships> relationshipsOp = new AAIResultWrapper(
+ new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiLocalNetwork)).getRelationships();
+ if (relationshipsOp.isPresent()) {
+ List<AAIResultWrapper> configurationsRelatedToLocalNetwork =
+ relationshipsOp.get().getByType(AAIObjectType.CONFIGURATION);
+ if (configurationsRelatedToLocalNetwork.size() > 1) {
+ throw new VrfBondingServiceException(
+ "Network: " + aaiLocalNetwork.getNetworkId() + " has more than 1 configuration related to it");
+ }
+ if (configurationsRelatedToLocalNetwork.size() == 1) {
+ AAIResultWrapper configWrapper = configurationsRelatedToLocalNetwork.get(0);
+ Optional<Configuration> relatedConfiguration = configWrapper.asBean(Configuration.class);
+ if (relatedConfiguration.isPresent() && vrfConfigurationAlreadyExists(relatedVpnBinding,
+ relatedConfiguration.get(), configWrapper)) {
+ return relatedConfiguration.get().getConfigurationId();
+ }
+ }
+ }
+ return null;
+ }
+
+ protected boolean vrfConfigurationAlreadyExists(RelatedInstance relatedVpnBinding, Configuration vrfConfiguration,
+ AAIResultWrapper configWrapper) throws VrfBondingServiceException {
+ if (vrfConfiguration.getConfigurationType().equalsIgnoreCase("VRF-ENTRY")) {
+ Optional<Relationships> relationshipsConfigOp = configWrapper.getRelationships();
+ if (relationshipsConfigOp.isPresent()) {
+ Optional<VpnBinding> relatedInfraVpnBindingOp =
+ workflowActionUtils.extractRelationshipsVpnBinding(relationshipsConfigOp.get());
+ if (relatedInfraVpnBindingOp.isPresent()) {
+ VpnBinding relatedInfraVpnBinding = relatedInfraVpnBindingOp.get();
+ if (!relatedInfraVpnBinding.getVpnId().equalsIgnoreCase(relatedVpnBinding.getInstanceId())) {
+ throw new VrfBondingServiceException("Configuration: " + vrfConfiguration.getConfigurationId()
+ + " is not connected to the same vpn binding id provided in request: "
+ + relatedVpnBinding.getInstanceId());
+ } else {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ protected void traverseNetworkCollection(DelegateExecution execution, List<Resource> resourceCounter,
+ org.onap.so.db.catalog.beans.Service service) {
+ if (service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty()) {
+ List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
+ if (customizations.isEmpty()) {
+ logger.debug("No Collections found. CollectionResourceCustomization list is empty.");
+ } else {
+ CollectionResourceCustomization collectionResourceCustomization =
+ findCatalogNetworkCollection(execution, service);
+ if (collectionResourceCustomization != null) {
+ resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,
+ collectionResourceCustomization.getModelCustomizationUUID(), false));
+ logger.debug("Found a network collection");
+ if (collectionResourceCustomization.getCollectionResource() != null) {
+ if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() != null) {
+ String toscaNodeType = collectionResourceCustomization.getCollectionResource()
+ .getInstanceGroup().getToscaNodeType();
+ if (toscaNodeType != null && toscaNodeType.contains("NetworkCollection")) {
+ int minNetworks = 0;
+ org.onap.so.db.catalog.beans.InstanceGroup instanceGroup =
+ collectionResourceCustomization.getCollectionResource().getInstanceGroup();
+ CollectionResourceInstanceGroupCustomization collectionInstCust = null;
+ if (!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
+ for (CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup
+ .getCollectionInstanceGroupCustomizations()) {
+ if (collectionInstanceGroupTemp.getModelCustomizationUUID().equalsIgnoreCase(
+ collectionResourceCustomization.getModelCustomizationUUID())) {
+ collectionInstCust = collectionInstanceGroupTemp;
break;
}
}
- for (int i = 0; i < minNetworks; i++) {
- if (collectionNetworkResourceCust != null && collectionInstCust != null) {
- Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,
- collectionNetworkResourceCust.getModelCustomizationUUID(), false);
- resource.setVirtualLinkKey(Integer.toString(i));
- resourceCounter.add(resource);
- }
+ if (collectionInstCust != null
+ && collectionInstCust.getSubInterfaceNetworkQuantity() != null) {
+ minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
+ }
+ }
+ logger.debug("minNetworks: {}", minNetworks);
+ CollectionNetworkResourceCustomization collectionNetworkResourceCust = null;
+ for (CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup
+ .getCollectionNetworkResourceCustomizations()) {
+ if (collectionNetworkTemp.getNetworkResourceCustomization()
+ .getModelCustomizationUUID().equalsIgnoreCase(
+ collectionResourceCustomization.getModelCustomizationUUID())) {
+ collectionNetworkResourceCust = collectionNetworkTemp;
+ break;
+ }
+ }
+ for (int i = 0; i < minNetworks; i++) {
+ if (collectionNetworkResourceCust != null && collectionInstCust != null) {
+ Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,
+ collectionNetworkResourceCust.getModelCustomizationUUID(), false);
+ resource.setVirtualLinkKey(Integer.toString(i));
+ resourceCounter.add(resource);
}
- } else {
- logger.debug(
- "Instance Group tosca node type does not contain NetworkCollection: {}",
- toscaNodeType);
}
} else {
- logger.debug("No Instance Group found for network collection.");
+ logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}",
+ toscaNodeType);
}
} else {
- logger.debug("No Network Collection found. collectionResource is null");
+ logger.debug("No Instance Group found for network collection.");
}
} else {
- logger.debug("No Network Collection Customization found");
+ logger.debug("No Network Collection found. collectionResource is null");
}
+ } else {
+ logger.debug("No Network Collection Customization found");
}
- if (resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
- .collect(Collectors.toList()).isEmpty()) {
- if (service.getNetworkCustomizations() == null) {
- logger.debug("No networks were found on this service model");
- } else {
- for (int i = 0; i < service.getNetworkCustomizations().size(); i++) {
- resourceCounter.add(new Resource(WorkflowType.NETWORK,
- service.getNetworkCustomizations().get(i).getModelCustomizationUUID(), false));
- }
+ }
+ if (resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
+ .collect(Collectors.toList()).isEmpty()) {
+ if (service.getNetworkCustomizations() == null) {
+ logger.debug("No networks were found on this service model");
+ } else {
+ for (int i = 0; i < service.getNetworkCustomizations().size(); i++) {
+ resourceCounter.add(new Resource(WorkflowType.NETWORK,
+ service.getNetworkCustomizations().get(i).getModelCustomizationUUID(), false));
}
}
- } else {
- buildAndThrowException(execution,
- "Cannot orchestrate Service-Macro-Create without user params with a vnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows");
}
+ } else {
+ buildAndThrowException(execution,
+ "Cannot orchestrate Service-Macro-Create without user params with a vnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows");
}
}
@@ -760,7 +845,8 @@ public class WorkflowAction {
aaiConfigurationResources.getConfiguration(config.getConfigurationId());
if (aaiConfig.isPresent() && aaiConfig.get().getRelationshipList() != null) {
for (Relationship relationship : aaiConfig.get().getRelationshipList().getRelationship()) {
- if (relationship.getRelatedTo().contains("vnfc")) {
+ if (relationship.getRelatedTo().contains("vnfc")
+ || relationship.getRelatedTo().contains("vpn-binding")) {
aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION,
config.getConfigurationId()));
resourceCounter.add(
@@ -1316,7 +1402,8 @@ public class WorkflowAction {
WorkflowType resourceName, boolean aLaCarte, String cloudOwner, String serviceType) {
List<OrchestrationFlow> listToExecute = new ArrayList<>();
NorthBoundRequest northBoundRequest = null;
- if (serviceType.equalsIgnoreCase(SERVICE_TYPE_TRANSPORT)) {
+ if (serviceType.equalsIgnoreCase(SERVICE_TYPE_TRANSPORT)
+ || serviceType.equalsIgnoreCase(SERVICE_TYPE_BONDING)) {
northBoundRequest =
catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwnerAndServiceType(
requestAction, resourceName.toString(), aLaCarte, cloudOwner, serviceType);
@@ -1338,7 +1425,7 @@ public class WorkflowAction {
}
} else {
if (northBoundRequest.getIsToplevelflow() != null) {
- execution.setVariable(G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow());
+ execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow());
}
List<OrchestrationFlow> flows = northBoundRequest.getOrchestrationFlowList();
if (flows == null)
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
index 4fc4d85b97..35ceef0473 100644
--- 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
@@ -20,6 +20,7 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
+import java.sql.Timestamp;
import java.util.Optional;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -53,6 +54,9 @@ public class WorkflowActionBBFailure {
errorMsg = "Failed to determine error message";
}
request.setStatusMessage(errorMsg);
+ request.setProgress(Long.valueOf(100));
+ request.setLastModifiedBy("CamundaBPMN");
+ request.setEndTime(new Timestamp(System.currentTimeMillis()));
requestDbclient.updateInfraActiveRequests(request);
} catch (Exception e) {
logger.error(
@@ -113,6 +117,7 @@ public class WorkflowActionBBFailure {
request.setProgress(Long.valueOf(100));
request.setRequestStatus("FAILED");
request.setLastModifiedBy("CamundaBPMN");
+ request.setEndTime(new Timestamp(System.currentTimeMillis()));
requestDbclient.updateInfraActiveRequests(request);
} catch (Exception e) {
workflowAction.buildAndThrowException(execution, "Error Updating Request Database", e);
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 8ec283032f..44152fcaf4 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
@@ -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.
@@ -27,6 +27,8 @@ import java.util.UUID;
import javax.persistence.EntityNotFoundException;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.aai.domain.yang.Vnfc;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
@@ -77,41 +79,19 @@ public class WorkflowActionBBTasks {
private BBInputSetupUtils bbInputSetupUtils;
@Autowired
private CatalogDbClient catalogDbClient;
+ @Autowired
+ private FlowManipulatorListenerRunner flowManipulatorListenerRunner;
public void selectBB(DelegateExecution execution) {
List<ExecuteBuildingBlock> flowsToExecute =
(List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
execution.setVariable("MacroRollback", false);
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
- ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence);
- if (ebb.getBuildingBlock().getBpmnFlowName().equals("ConfigAssignVnfBB")
- || ebb.getBuildingBlock().getBpmnFlowName().equals("ConfigDeployVnfBB")) {
- String vnfCustomizationUUID = ebb.getBuildingBlock().getKey();
+ flowManipulatorListenerRunner.modifyFlows(flowsToExecute, new DelegateExecutionImpl(execution));
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
- List<VnfResourceCustomization> vnfResourceCustomizations = catalogDbClient
- .getVnfResourceCustomizationByModelUuid(ebb.getRequestDetails().getModelInfo().getModelUuid());
- if (vnfResourceCustomizations != null && vnfResourceCustomizations.size() >= 1) {
- VnfResourceCustomization vrc = catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID,
- vnfResourceCustomizations);
- boolean skipConfigVNF = vrc.isSkipPostInstConf();
- if (skipConfigVNF) {
- currentSequence++;
- ebb = flowsToExecute.get(currentSequence);
- }
- }
- }
+ ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence);
- boolean homing = (boolean) execution.getVariable("homing");
- boolean calledHoming = (boolean) execution.getVariable("calledHoming");
- if (homing && !calledHoming) {
- if (ebb.getBuildingBlock().getBpmnFlowName().equals("AssignVnfBB")) {
- ebb.setHoming(true);
- execution.setVariable("calledHoming", true);
- }
- } else {
- ebb.setHoming(false);
- }
execution.setVariable("buildingBlock", ebb);
currentSequence++;
if (currentSequence >= flowsToExecute.size()) {
@@ -226,11 +206,16 @@ public class WorkflowActionBBTasks {
final String action = (String) execution.getVariable(G_ACTION);
final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
final String resourceName = (String) execution.getVariable("resourceName");
+ String statusMessage = (String) execution.getVariable("StatusMessage");
String macroAction = "";
- if (aLaCarte) {
- macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly.";
+ if (statusMessage == null) {
+ if (aLaCarte) {
+ macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly.";
+ } else {
+ macroAction = "Macro-" + resourceName + "-" + action + " request was executed correctly.";
+ }
} else {
- macroAction = "Macro-" + resourceName + "-" + action + " request was executed correctly.";
+ macroAction = statusMessage;
}
execution.setVariable("finalStatusMessage", macroAction);
Timestamp endTime = new Timestamp(System.currentTimeMillis());
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
index 99ae2e7495..f672aa4b59 100644
--- 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
@@ -22,18 +22,25 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
import java.util.List;
import java.util.Optional;
+import org.onap.aai.domain.yang.VpnBinding;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
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.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class WorkflowActionExtractResourcesAAI {
private static final Logger logger = LoggerFactory.getLogger(WorkflowActionExtractResourcesAAI.class);
+ @Autowired
+ protected BBInputSetupUtils bbInputSetupUtils;
+
public Optional<Configuration> extractRelationshipsConfiguration(Relationships relationships) {
List<AAIResultWrapper> configurations = relationships.getByType(AAIObjectType.CONFIGURATION);
for (AAIResultWrapper configWrapper : configurations) {
@@ -45,6 +52,18 @@ public class WorkflowActionExtractResourcesAAI {
return Optional.empty();
}
+ public Optional<VpnBinding> extractRelationshipsVpnBinding(Relationships relationships) {
+ List<AAIResourceUri> configurations = relationships.getRelatedUris(AAIObjectType.VPN_BINDING);
+ for (AAIResourceUri vpnBindingUri : configurations) {
+ AAIResultWrapper vpnBindingWrapper = bbInputSetupUtils.getAAIResourceDepthOne(vpnBindingUri);
+ Optional<VpnBinding> vpnBinding = vpnBindingWrapper.asBean(VpnBinding.class);
+ if (vpnBinding.isPresent()) {
+ return vpnBinding;
+ }
+ }
+ return Optional.empty();
+ }
+
public Optional<Relationships> extractRelationshipsVnfc(Relationships relationships) {
List<AAIResultWrapper> vnfcs = relationships.getByType(AAIObjectType.VNFC);
for (AAIResultWrapper vnfcWrapper : vnfcs) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java
index af8f93b92b..05a51797dd 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java
@@ -22,9 +22,15 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
public enum WorkflowType {
- SERVICE("Service"), VNF("Vnf"), VFMODULE("VfModule"), VOLUMEGROUP("VolumeGroup"), NETWORK("Network"), VIRTUAL_LINK(
- "VirtualLink"), NETWORKCOLLECTION(
- "NetworkCollection"), CONFIGURATION("Configuration"), INSTANCE_GROUP("InstanceGroup");
+ SERVICE("Service"),
+ VNF("Vnf"),
+ VFMODULE("VfModule"),
+ VOLUMEGROUP("VolumeGroup"),
+ NETWORK("Network"),
+ VIRTUAL_LINK("VirtualLink"),
+ NETWORKCOLLECTION("NetworkCollection"),
+ CONFIGURATION("Configuration"),
+ INSTANCE_GROUP("InstanceGroup");
private final String type;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java
new file mode 100644
index 0000000000..6254aae029
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java
@@ -0,0 +1,51 @@
+/*-
+ * ============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.listeners;
+
+import java.util.List;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.springframework.stereotype.Component;
+
+@Component
+public class HomingListener implements FlowManipulator {
+
+
+ @Override
+ public boolean shouldRunFor(String currentBBName, boolean isFirst, BuildingBlockExecution execution) {
+ return "AssignVnfBB".equals(currentBBName);
+ }
+
+ @Override
+ public void run(List<ExecuteBuildingBlock> flowsToExecute, ExecuteBuildingBlock currentBB,
+ BuildingBlockExecution execution) {
+
+ boolean homing = (boolean) execution.getVariable("homing");
+ boolean calledHoming = (boolean) execution.getVariable("calledHoming");
+ if (homing && !calledHoming) {
+ currentBB.setHoming(true);
+ execution.setVariable("calledHoming", true);
+ }
+ }
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java
new file mode 100644
index 0000000000..fd0de086ad
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java
@@ -0,0 +1,70 @@
+/*-
+ * ============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.listeners;
+
+import java.util.Collections;
+import java.util.List;
+import org.onap.so.bpmn.common.BBConstants;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class MultiStageSkipListener implements FlowManipulator {
+
+ @Autowired
+ protected BBInputSetupUtils bbInputSetupUtils;
+
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ @Override
+ public boolean shouldRunFor(String currentBBName, boolean isFirst, BuildingBlockExecution execution) {
+ return ((boolean) execution.getVariable(BBConstants.G_ALACARTE)) && "AssignVfModuleBB".equals(currentBBName)
+ && isFirst;
+ }
+
+ @Override
+ public void run(List<ExecuteBuildingBlock> flowsToExecute, ExecuteBuildingBlock currentBB,
+ BuildingBlockExecution execution) {
+ String vfModuleId = currentBB.getResourceId();
+ String vnfId = currentBB.getWorkflowResourceIds().getVnfId();
+ org.onap.aai.domain.yang.VfModule vfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId);
+ if (vfModule == null) {
+ org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(vnfId);
+ if (vnf != null) {
+ VnfResourceCustomization vnfCust = catalogDbClient
+ .getVnfResourceCustomizationByModelCustomizationUUID(vnf.getModelCustomizationId());
+ if (vnfCust != null && vnfCust.getMultiStageDesign() != null
+ && vnfCust.getMultiStageDesign().equalsIgnoreCase("true")) {
+ flowsToExecute.retainAll(Collections.singletonList(currentBB));
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java
new file mode 100644
index 0000000000..772fca0841
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java
@@ -0,0 +1,44 @@
+package org.onap.so.bpmn.infrastructure.workflow.tasks.listeners;
+
+import java.util.List;
+import org.onap.so.bpmn.common.BBConstants;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SkipConfigVnfListener implements FlowManipulator {
+
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ @Override
+ public boolean shouldRunFor(String currentBBName, boolean isFirst, BuildingBlockExecution execution) {
+ return "ConfigAssignVnfBB".equals(currentBBName) || "ConfigDeployVnfBB".equals(currentBBName);
+ }
+
+ @Override
+ public void run(List<ExecuteBuildingBlock> flowsToExecute, ExecuteBuildingBlock currentBB,
+ BuildingBlockExecution execution) {
+ String vnfCustomizationUUID = currentBB.getBuildingBlock().getKey();
+
+ List<VnfResourceCustomization> vnfResourceCustomizations = catalogDbClient
+ .getVnfResourceCustomizationByModelUuid(currentBB.getRequestDetails().getModelInfo().getModelUuid());
+ if (vnfResourceCustomizations != null && !vnfResourceCustomizations.isEmpty()) {
+ VnfResourceCustomization vrc =
+ catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID, vnfResourceCustomizations);
+ boolean skipConfigVNF = vrc.isSkipPostInstConf();
+ if (skipConfigVNF) {
+ execution.setVariable(BBConstants.G_CURRENT_SEQUENCE,
+ ((int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE)) + 1);
+ }
+ }
+ }
+
+
+
+}
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 4fee1f909b..173e776af9 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
@@ -34,7 +34,6 @@ import org.onap.so.adapters.nwrest.ContrailNetwork;
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
-import org.onap.so.adapters.nwrest.NetworkTechnology;
import org.onap.so.adapters.nwrest.ProviderVlanNetwork;
import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
@@ -261,7 +260,7 @@ public class NetworkAdapterObjectMapper {
* @param L3Network
* @return List<org.onap.so.openstack.beans.Subnet>
*/
- private List<Subnet> buildOpenstackSubnetList(L3Network l3Network) {
+ protected List<Subnet> buildOpenstackSubnetList(L3Network l3Network) {
List<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet> subnets = l3Network.getSubnets();
List<org.onap.so.openstack.beans.Subnet> subnetList = new ArrayList<org.onap.so.openstack.beans.Subnet>();
@@ -292,9 +291,10 @@ public class NetworkAdapterObjectMapper {
.setCidr(subnet.getNetworkStartAddress().concat(FORWARD_SLASH).concat(subnet.getCidrMask()));
List<org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute> hostRouteList = subnet.getHostRoutes();
List<org.onap.so.openstack.beans.HostRoute> openstackHostRouteList = new ArrayList<>();
- org.onap.so.openstack.beans.HostRoute openstackHostRoute = new org.onap.so.openstack.beans.HostRoute();
+ org.onap.so.openstack.beans.HostRoute openstackHostRoute = null;
// TODO only 2 fields available on openstack object. Confirm it is sufficient or add as needed
for (org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute hostRoute : hostRouteList) {
+ openstackHostRoute = new org.onap.so.openstack.beans.HostRoute();
openstackHostRoute.setNextHop(hostRoute.getNextHop());
openstackHostRoute.setPrefix(hostRoute.getRoutePrefix());
// add host route to the list
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 b0ba0595d5..f23e5cdb5a 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -33,7 +35,6 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.PostConstruct;
-import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang3.StringUtils;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
@@ -77,6 +78,9 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.entity.MsoRequest;
import org.onap.so.jsonpath.JsonPathUtil;
import org.onap.so.openstack.utils.MsoMulticloudUtils;
+import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonParseException;
@@ -91,6 +95,7 @@ import com.google.common.base.Joiner;
public class VnfAdapterVfModuleObjectMapper {
@Autowired
protected VnfAdapterObjectMapperUtils vnfAdapterObjectMapperUtils;
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVfModuleObjectMapper.class);
private static List<String> sdncResponseParamsToSkip =
asList("vnf_id", "vf_module_id", "vnf_name", "vf_module_name");
@@ -118,7 +123,7 @@ public class VnfAdapterVfModuleObjectMapper {
public CreateVfModuleRequest createVfModuleRequestMapper(RequestContext requestContext, CloudRegion cloudRegion,
OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse)
- throws JsonParseException, JsonMappingException, IOException {
+ throws IOException, MissingValueTagException {
CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest();
createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
@@ -167,7 +172,7 @@ public class VnfAdapterVfModuleObjectMapper {
private Map<String, Object> buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance,
GenericVnf genericVnf, VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse)
- throws JsonParseException, JsonMappingException, IOException {
+ throws IOException, MissingValueTagException {
GenericResourceApiVnfTopology vnfTop =
@@ -202,11 +207,11 @@ public class VnfAdapterVfModuleObjectMapper {
return paramsMap;
}
- private void buildDirectivesParamFromMap(Map<String, Object> paramsMap, String directive,
- Map<String, Object> srcMap) {
+ protected void buildDirectivesParamFromMap(Map<String, Object> paramsMap, String directive,
+ Map<String, Object> srcMap) throws MissingValueTagException {
StringBuilder directives = new StringBuilder();
int no_directives_size = 0;
- if (directives.equals(MsoMulticloudUtils.USER_DIRECTIVES)
+ if (directive.equals(MsoMulticloudUtils.USER_DIRECTIVES)
&& srcMap.containsKey(MsoMulticloudUtils.OOF_DIRECTIVES)) {
no_directives_size = 1;
}
@@ -214,8 +219,12 @@ public class VnfAdapterVfModuleObjectMapper {
directives.append("{ \"attributes\": [ ");
int i = 0;
for (String attributeName : srcMap.keySet()) {
- if (!(MsoMulticloudUtils.USER_DIRECTIVES.equals(directives)
+ if (!(MsoMulticloudUtils.USER_DIRECTIVES.equals(directive)
&& attributeName.equals(MsoMulticloudUtils.OOF_DIRECTIVES))) {
+ if (srcMap.get(attributeName) == null) {
+ logger.error("No value tag found for attribute: {}", attributeName);
+ throw new MissingValueTagException("No value tag found for " + attributeName);
+ }
directives.append(new AttributeNameValue(attributeName, srcMap.get(attributeName).toString()));
if (i < (srcMap.size() - 1 + no_directives_size))
directives.append(", ");
@@ -247,7 +256,7 @@ public class VnfAdapterVfModuleObjectMapper {
private void buildParamsMapFromVnfSdncResponse(Map<String, Object> paramsMap,
GenericResourceApiVnftopologyVnfTopology vnfTopology, Map<String, String> networkRoleMap,
- boolean skipVnfResourceAssignments) throws JsonParseException, JsonMappingException, IOException {
+ boolean skipVnfResourceAssignments) throws IOException {
// Get VNF parameters from SDNC response
GenericResourceApiParam vnfParametersData = vnfTopology.getVnfParametersData();
buildParamsMapFromSdncParams(paramsMap, vnfParametersData);
@@ -324,7 +333,7 @@ public class VnfAdapterVfModuleObjectMapper {
private void buildParamsMapFromVfModuleSdncResponse(Map<String, Object> paramsMap,
GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology, boolean skipVfModuleAssignments)
- throws JsonParseException, JsonMappingException, IOException {
+ throws IOException {
// Get VF Module parameters from SDNC response
GenericResourceApiParam vfModuleParametersData = vfModuleTopology.getVfModuleParameters();
buildParamsMapFromSdncParams(paramsMap, vfModuleParametersData);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/exceptions/MissingValueTagException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/exceptions/MissingValueTagException.java
new file mode 100644
index 0000000000..7271971e46
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/exceptions/MissingValueTagException.java
@@ -0,0 +1,15 @@
+package org.onap.so.client.adapter.vnf.mapper.exceptions;
+
+public class MissingValueTagException extends Exception {
+
+ private static final long serialVersionUID = -1598147488593823724L;
+
+ public MissingValueTagException() {
+ super();
+ }
+
+ public MissingValueTagException(String message) {
+ super(message);
+ }
+
+}
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
index 717bb04099..088ce1ac38 100644
--- 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
@@ -24,6 +24,7 @@ package org.onap.so.client.namingservice;
import java.io.IOException;
import java.util.List;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
import org.onap.namingservice.model.NameGenDeleteResponse;
import org.onap.namingservice.model.NameGenResponse;
@@ -43,6 +44,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class NamingClientResponseValidator {
private static final Logger logger = LoggerFactory.getLogger(NamingClientResponseValidator.class);
private static final String INSTANCE_GROUP_NAME = "instance-group-name";
+ private static final String SERVICE_INSTANCE_NAME = "Service-Instance-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 =
@@ -51,8 +53,9 @@ public class NamingClientResponseValidator {
public String validateNameGenResponse(ResponseEntity<NameGenResponse> response) throws BadResponseException {
if (response == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_NAMING_SERVICE);
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ NO_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(),
+ NO_RESPONSE_FROM_NAMING_SERVICE);
throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
}
@@ -60,7 +63,7 @@ public class NamingClientResponseValidator {
String generatedName = "";
NameGenResponse responseBody = response.getBody();
if (responseBody == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_GENERAL_EXCEPTION.toString(),
NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(),
NULL_RESPONSE_FROM_NAMING_SERVICE);
throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
@@ -78,6 +81,9 @@ public class NamingClientResponseValidator {
if (INSTANCE_GROUP_NAME.equals(resourceName)) {
generatedName = respElement.getResourceValue();
break;
+ } else if (SERVICE_INSTANCE_NAME.equals(resourceName)) {
+ generatedName = respElement.getResourceValue();
+ break;
}
}
}
@@ -90,7 +96,7 @@ public class NamingClientResponseValidator {
errorMessageString = error.getMessage();
}
String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
ErrorCode.DataError.getValue(), errorMessage);
throw new BadResponseException(errorMessage);
}
@@ -99,8 +105,9 @@ public class NamingClientResponseValidator {
public String validateNameGenDeleteResponse(ResponseEntity<NameGenDeleteResponse> response)
throws BadResponseException {
if (response == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_NAMING_SERVICE);
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ NO_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(),
+ NO_RESPONSE_FROM_NAMING_SERVICE);
throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
}
@@ -108,7 +115,7 @@ public class NamingClientResponseValidator {
String responseMessage = "";
NameGenDeleteResponse responseBody = response.getBody();
if (responseBody == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_GENERAL_EXCEPTION.toString(),
NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(),
NULL_RESPONSE_FROM_NAMING_SERVICE);
throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
@@ -121,7 +128,7 @@ public class NamingClientResponseValidator {
String errorMessageString = NAMING_SERVICE_ERROR;
String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
ErrorCode.DataError.getValue(), errorMessage);
throw new BadResponseException(errorMessage);
}
@@ -141,7 +148,7 @@ public class NamingClientResponseValidator {
errorMessageString = error.getMessage();
}
String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
ErrorCode.DataError.getValue(), errorMessage);
return errorMessage;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java
new file mode 100644
index 0000000000..3d3058da0b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java
@@ -0,0 +1,113 @@
+/*-
+ * ============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.HashMap;
+
+public class NamingRequestObject {
+
+ private HashMap<String, String> namingRequestMap = new HashMap<String, String>();
+
+ public HashMap<String, String> getNamingRequestObjectMap() {
+ return this.namingRequestMap;
+ }
+
+ public String getExternalKeyValue() {
+ return namingRequestMap.get(NamingServiceConstants.NS_EXTERNAL_KEY);
+ }
+
+ public void setExternalKeyValue(String externalKey) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_EXTERNAL_KEY, externalKey);
+ }
+
+ public String getPolicyInstanceNameValue() {
+ return this.namingRequestMap.get(NamingServiceConstants.NS_POLICY_INSTANCE_NAME);
+ }
+
+ public void setPolicyInstanceNameValue(String policyInstanceName) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_POLICY_INSTANCE_NAME, policyInstanceName);
+ }
+
+ public String getNamingTypeValue() {
+ return namingRequestMap.get(NamingServiceConstants.NS_NAMING_TYPE);
+ }
+
+ public void setNamingTypeValue(String namingType) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_NAMING_TYPE, namingType);
+ }
+
+ public String getResourceNameValue() {
+ return this.namingRequestMap.get(NamingServiceConstants.NS_RESOURCE_NAME);
+ }
+
+ public void setResourceNameValue(String resourceName) {
+ namingRequestMap.put(NamingServiceConstants.NS_RESOURCE_NAME, resourceName);
+ }
+
+ public String getNfNamingCodeValue() {
+ return this.namingRequestMap.get(NamingServiceConstants.NS_NF_NAMING_CODE);
+ }
+
+ public void setNfNamingCodeValue(String nfNamingCode) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_NF_NAMING_CODE, nfNamingCode);
+ }
+
+ public String getServiceModelNameValue() {
+ return this.namingRequestMap.get(NamingServiceConstants.NS_SERVICE_MODEL_NAME);
+ }
+
+ public void setServiceModelNameValue(String serviceModelName) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_SERVICE_MODEL_NAME, serviceModelName);
+ }
+
+ public String getModelVersionValue() {
+ return this.namingRequestMap.get(NamingServiceConstants.NS_MODEL_VERSION);
+ }
+
+ public void setModelVersionValue(String modelVersion) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_MODEL_VERSION, modelVersion);
+ }
+
+ public String getNetworkNameValue() {
+ return this.namingRequestMap.get(NamingServiceConstants.NS_NETWORK_NAME);
+ }
+
+ public void setNetworkNameValue(String networkName) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_NETWORK_NAME, networkName);
+ }
+
+ public String getVpnNameValue() {
+ return this.namingRequestMap.get(NamingServiceConstants.NS_VPN_NAME);
+ }
+
+ public void setVpnNameValue(String vpnName) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_VPN_NAME, vpnName);
+ }
+
+ public String getZoneIdValue() {
+ return this.namingRequestMap.get(NamingServiceConstants.NS_ZONE_ID);
+ }
+
+ public void setZoneIdValue(String zoneId) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_ZONE_ID, zoneId);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingServiceConstants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingServiceConstants.java
new file mode 100644
index 0000000000..5637410af0
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingServiceConstants.java
@@ -0,0 +1,41 @@
+/*-
+ * ============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;
+
+public class NamingServiceConstants {
+ public static final String NS_EXTERNAL_KEY = "external-key";
+ public static final String NS_POLICY_INSTANCE_NAME = "policy-instance-name";
+ public static final String NS_NAMING_TYPE = "naming-type";
+ public static final String NS_RESOURCE_NAME = "resource-name";
+ public static final String NS_NF_NAMING_CODE = "nf-naming-code";
+ public static final String NS_SERVICE_MODEL_NAME = "service-model-name";
+ public static final String NS_MODEL_VERSION = "model-version";
+ public static final String NS_NETWORK_NAME = "network-name";
+ public static final String NS_VPN_NAME = "vpn-name";
+ public static final String NS_ZONE_ID = "zone-id";
+ public static final String NS_RESOURCE_VALUE = "resource-value";
+
+ public static final String NAMING_TYPE_SERVICE = "SERVICE";
+ public static final String RESOURCE_NAME_SERVICE_INSTANCE_NAME = "Service-Instance-Name";
+ public static final String RESOURCE_NAME_SERVICEINSTANCE = "ServiceInstance";
+
+ private NamingServiceConstants() {}
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingServiceUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingServiceUtils.java
new file mode 100644
index 0000000000..16c8e5549c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingServiceUtils.java
@@ -0,0 +1,87 @@
+/*-
+ * ============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 org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+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.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class NamingServiceUtils {
+
+ private static String errorMessages = "Policy name is not present, or Onap name was not generated! ";
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ public void checkVpnBondingService(BuildingBlockExecution execution) {
+ execution.setVariable("isVpnBondingService", false);
+ boolean isNamingPolicyAndOnapGeneratedNaming = false;
+ checkBondingAndInfrastureVpn(execution);
+ boolean isBondingAndInsfrastructureVpn = execution.getVariable("isBondingAndInsfrastructureVpn");
+ if (isBondingAndInsfrastructureVpn) {
+ checkNamingPolicyAndOnapGeneratedNaming(execution);
+ isNamingPolicyAndOnapGeneratedNaming = execution.getVariable("isNamingPolicyAndOnapGeneratedNaming");
+ }
+ if (isBondingAndInsfrastructureVpn && isNamingPolicyAndOnapGeneratedNaming) {
+ execution.setVariable("isVpnBondingService", true);
+ }
+ }
+
+ public void checkBondingAndInfrastureVpn(BuildingBlockExecution execution) {
+ execution.setVariable("isBondingAndInsfrastructureVpn", false);
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ if ("bonding".equalsIgnoreCase(serviceInstance.getModelInfoServiceInstance().getServiceType())
+ && "infrastructure-vpn"
+ .equalsIgnoreCase(serviceInstance.getModelInfoServiceInstance().getServiceRole())) {
+ execution.setVariable("isBondingAndInsfrastructureVpn", true);
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void checkNamingPolicyAndOnapGeneratedNaming(BuildingBlockExecution execution) {
+ execution.setVariable("isNamingPolicyAndOnapGeneratedNaming", false);
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ if (serviceInstance.getModelInfoServiceInstance().getNamingPolicy() != null
+ && !serviceInstance.getModelInfoServiceInstance().getNamingPolicy().isEmpty()
+ && serviceInstance.getModelInfoServiceInstance().getOnapGeneratedNaming() != null
+ && serviceInstance.getModelInfoServiceInstance().getOnapGeneratedNaming() == true) {
+ execution.setVariable("isNamingPolicyAndOnapGeneratedNaming", true);
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessages);
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
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 1453e40653..867d80a4ea 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
@@ -24,6 +24,7 @@ import java.util.Optional;
import javax.ws.rs.core.UriBuilder;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
@@ -79,7 +80,7 @@ public class AAIConfigurationResources {
/**
* A&AI call to disconnect configuration relation with service instance
- *
+ *
* @param configurationId
* @param serviceInstanceId
*/
@@ -211,7 +212,7 @@ public class AAIConfigurationResources {
/**
* Get Configuration from AAI using related Link
- *
+ *
* @param relatedLink related link - URI
* @return AAI Configuration object
*/
@@ -228,4 +229,20 @@ public class AAIConfigurationResources {
org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration);
}
+
+ public void updateConfigurationOrchestrationStatus(Configuration configuration,
+ OrchestrationStatus orchestrationStatus) {
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ org.onap.aai.domain.yang.Configuration aaiConfiguration = new org.onap.aai.domain.yang.Configuration();
+ aaiConfiguration.setOrchestrationStatus(orchestrationStatus.name());
+ injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration);
+ }
+
+ public boolean checkConfigurationNameInUse(String configurationName) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
+ .queryParam("configuration-name", configurationName);
+ return injectionHelper.getAaiClient().exists(uri);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
index c48593037a..296d052315 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
@@ -25,6 +25,7 @@ import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
@@ -84,4 +85,11 @@ public class AAIInstanceGroupResources {
injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup))
.connect(instanceGroupUri, serviceInstanceURI);
}
+
+ public boolean checkInstanceGroupNameInUse(String instanceGroupName) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ .queryParam("instance-group-name", instanceGroupName);
+ return injectionHelper.getAaiClient().exists(uri);
+ }
+
}
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 b936551549..bc702c9fb4 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
@@ -32,6 +32,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIResultWrapper;
@@ -206,4 +207,11 @@ public class AAINetworkResources {
AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId);
injectionHelper.getAaiClient().delete(networkPolicyURI);
}
+
+ public boolean checkNetworkNameInUse(String networkName) {
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName);
+ return injectionHelper.getAaiClient().exists(uri);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
index e391349d2c..c41f3fa56c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
@@ -61,9 +61,9 @@ public class AAIServiceInstanceResources {
AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, customer.getGlobalCustomerId(),
customer.getServiceSubscription().getServiceType(), serviceInstance.getServiceInstanceId());
serviceInstance.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
- org.onap.aai.domain.yang.ServiceInstance AAIServiceInstance =
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance =
aaiObjectMapper.mapServiceInstance(serviceInstance);
- injectionHelper.getAaiClient().createIfNotExists(serviceInstanceURI, Optional.of(AAIServiceInstance));
+ injectionHelper.getAaiClient().createIfNotExists(serviceInstanceURI, Optional.of(aaiServiceInstance));
}
/**
@@ -87,24 +87,24 @@ public class AAIServiceInstanceResources {
public void createProject(Project project) {
AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName());
- org.onap.aai.domain.yang.Project AAIProject = aaiObjectMapper.mapProject(project);
- injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(AAIProject));
+ org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project);
+ injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject));
}
public void createProjectandConnectServiceInstance(Project project, ServiceInstance serviceInstance) {
AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName());
AAIResourceUri serviceInstanceURI =
AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
- org.onap.aai.domain.yang.Project AAIProject = aaiObjectMapper.mapProject(project);
- injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(AAIProject)).connect(projectURI,
+ org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project);
+ injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject)).connect(projectURI,
serviceInstanceURI);
}
public void createOwningEntity(OwningEntity owningEntity) {
AAIResourceUri owningEntityURI =
AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId());
- org.onap.aai.domain.yang.OwningEntity AAIOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity);
- injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(AAIOwningEntity));
+ org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity);
+ injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity));
}
public boolean existsOwningEntity(OwningEntity owningEntity) {
@@ -134,8 +134,8 @@ public class AAIServiceInstanceResources {
AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId());
AAIResourceUri serviceInstanceURI =
AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
- org.onap.aai.domain.yang.OwningEntity AAIOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity);
- injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(AAIOwningEntity))
+ org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity);
+ injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity))
.connect(owningEntityURI, serviceInstanceURI);
}
@@ -152,10 +152,15 @@ public class AAIServiceInstanceResources {
public void updateServiceInstance(ServiceInstance serviceInstance) {
AAIResourceUri serviceInstanceURI =
AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
- org.onap.aai.domain.yang.ServiceInstance AAIServiceInstance =
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance =
aaiObjectMapper.mapServiceInstance(serviceInstance);
- injectionHelper.getAaiClient().update(serviceInstanceURI, AAIServiceInstance);
+ injectionHelper.getAaiClient().update(serviceInstanceURI, aaiServiceInstance);
}
+ public boolean checkInstanceServiceNameInUse(ServiceInstance serviceInstance) {
+ AAIResourceUri uriSI = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ .queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
+ return injectionHelper.getAaiClient().exists(uriSI);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
index 83fe31a116..4d1a6dce38 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
@@ -23,12 +23,15 @@
package org.onap.so.client.orchestration;
import java.util.Optional;
+import org.onap.aai.domain.yang.VfModules;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -40,7 +43,6 @@ import org.springframework.stereotype.Component;
@Component
public class AAIVfModuleResources {
- private static final Logger logger = LoggerFactory.getLogger(AAIVfModuleResources.class);
@Autowired
private InjectionHelper injectionHelper;
@@ -97,8 +99,8 @@ public class AAIVfModuleResources {
public void changeAssignVfModule(VfModule vfModule, GenericVnf vnf) {
AAIResourceUri vfModuleURI =
AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
- org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule);
- injectionHelper.getAaiClient().update(vfModuleURI, AAIVfModule);
+ org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(vfModule);
+ injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
}
public void connectVfModuleToVolumeGroup(GenericVnf vnf, VfModule vfModule, VolumeGroup volumeGroup,
@@ -109,4 +111,19 @@ public class AAIVfModuleResources {
cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
injectionHelper.getAaiClient().connect(vfModuleURI, volumeGroupURI);
}
+
+ public boolean checkNameInUse(VfModule vfModule) {
+ boolean nameInUse = false;
+ AAIResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ .queryParam("vf-module-name", vfModule.getVfModuleName());
+ AAIResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
+ vfModule.getModelInfoVfModule().getModelCustomizationUUID());
+ if (injectionHelper.getAaiClient().exists(vfModuleUriWithCustomization)) {
+ // assume it's a resume case and return false
+ nameInUse = false;
+ } else {
+ nameInUse = injectionHelper.getAaiClient().exists(vfModuleUri);
+ }
+ return nameInUse;
+ }
}
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 fc61d862aa..a9635d1e34 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
@@ -30,8 +30,10 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIValidatorImpl;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -43,7 +45,6 @@ import org.springframework.stereotype.Component;
@Component
public class AAIVnfResources {
- private static final Logger logger = LoggerFactory.getLogger(AAIVnfResources.class);
@Autowired
private InjectionHelper injectionHelper;
@@ -153,4 +154,10 @@ public class AAIVnfResources {
return aaiValidatorImpl.isPhysicalServerLocked(vnf.getVnfId());
}
+
+ public boolean checkNameInUse(String vnfName) {
+ AAIResourceUri vnfUri =
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName);
+ return injectionHelper.getAaiClient().exists(vnfUri);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
index c24d1483e2..b9e4aeb888 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
@@ -26,6 +26,7 @@ import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
@@ -38,7 +39,6 @@ import org.springframework.stereotype.Component;
@Component
public class AAIVolumeGroupResources {
- private static final Logger logger = LoggerFactory.getLogger(AAIVolumeGroupResources.class);
@Autowired
private InjectionHelper injectionHelper;
@@ -94,4 +94,10 @@ public class AAIVolumeGroupResources {
copiedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId());
injectionHelper.getAaiClient().update(uri, aaiObjectMapper.mapVolumeGroup(copiedVolumeGroup));
}
+
+ public boolean checkNameInUse(VolumeGroup volumeGroup) {
+ AAIResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ .queryParam("volume-group-name", volumeGroup.getVolumeGroupName());
+ return injectionHelper.getAaiClient().exists(volumeGroupUri);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java
index 3ac61dff60..168d370521 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java
@@ -21,7 +21,6 @@
package org.onap.so.client.orchestration;
import java.util.Optional;
-import javax.ws.rs.NotFoundException;
import org.onap.aai.domain.yang.VpnBindings;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
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
index 06535bb765..5513122560 100644
--- 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
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
@@ -24,12 +24,14 @@ package org.onap.so.client.orchestration;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashMap;
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.NamingRequestObject;
import org.onap.so.client.namingservice.NamingRequestObjectBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -63,4 +65,25 @@ public class NamingServiceResources {
return (namingClient
.deleteNameGenRequest(namingRequestObjectBuilder.nameGenDeleteRequestMapper(deleteElements)));
}
+
+ public String generateServiceInstanceName(NamingRequestObject namingRequestObject)
+ throws BadResponseException, IOException {
+ HashMap<String, String> nsRequestObject = namingRequestObject.getNamingRequestObjectMap();
+ Element element = new Element();
+ nsRequestObject.forEach((k, v) -> element.put(k, v));
+ List<Element> elements = new ArrayList<Element>();
+ elements.add(element);
+ return (namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements)));
+ }
+
+ public String deleteServiceInstanceName(NamingRequestObject namingRequestObject)
+ throws BadResponseException, IOException {
+ HashMap<String, String> nsRequestObject = namingRequestObject.getNamingRequestObjectMap();
+ Deleteelement delElement = new Deleteelement();
+ nsRequestObject.forEach((k, v) -> delElement.setExternalKey(v));
+ List<Deleteelement> delElements = new ArrayList<Deleteelement>();
+ delElements.add(delElement);
+ return (namingClient.deleteNameGenRequest(namingRequestObjectBuilder.nameGenDeleteRequestMapper(delElements)));
+ }
+
}
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 ca32130c23..4aa6a1026a 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
@@ -28,9 +28,7 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
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.endpoint.SDNCTopology;
import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
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 54a9cabb57..d4a4cfbd8a 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
@@ -39,7 +39,6 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCNetworkResources {
- private static final Logger logger = LoggerFactory.getLogger(SDNCNetworkResources.class);
@Autowired
private NetworkTopologyOperationRequestMapper sdncRM;
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 60cad78f5d..b83a4d5628 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
@@ -22,6 +22,7 @@
package org.onap.so.client.orchestration;
+import java.net.URI;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
@@ -53,22 +54,22 @@ public class SDNCVfModuleResources {
public GenericResourceApiVfModuleOperationInformation assignVfModule(VfModule vfModule, VolumeGroup volumeGroup,
GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion,
- RequestContext requestContext) throws MapperException {
+ RequestContext requestContext, URI callbackURI) throws MapperException {
return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule,
- volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null, callbackURI);
}
public GenericResourceApiVfModuleOperationInformation unassignVfModule(VfModule vfModule, GenericVnf vnf,
- ServiceInstance serviceInstance) throws MapperException {
+ ServiceInstance serviceInstance, URI callbackURI) throws MapperException {
return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null,
- vnf, serviceInstance, null, null, null, null);
+ vnf, serviceInstance, null, null, null, null, callbackURI);
}
public GenericResourceApiVfModuleOperationInformation deactivateVfModule(VfModule vfModule, GenericVnf vnf,
- ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException {
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext,
+ URI callbackURI) throws MapperException {
return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null,
- vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ vnf, serviceInstance, customer, cloudRegion, requestContext, null, callbackURI);
}
public String queryVfModule(VfModule vfModule) throws MapperException, BadResponseException {
@@ -77,16 +78,16 @@ public class SDNCVfModuleResources {
}
public GenericResourceApiVfModuleOperationInformation activateVfModule(VfModule vfModule, GenericVnf vnf,
- ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException {
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext,
+ URI callbackURI) throws MapperException {
return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, vfModule, null,
- vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ vnf, serviceInstance, customer, cloudRegion, requestContext, null, callbackURI);
}
public GenericResourceApiVfModuleOperationInformation changeAssignVfModule(VfModule vfModule, GenericVnf vnf,
- ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException {
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext,
+ URI callbackURI) throws MapperException {
return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule,
- null, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ null, vnf, serviceInstance, customer, cloudRegion, requestContext, null, callbackURI);
}
}
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 954cbc1b1d..0e32955eed 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
@@ -42,7 +42,6 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCVnfResources {
- private static final Logger logger = LoggerFactory.getLogger(SDNCVnfResources.class);
@Autowired
private VnfTopologyOperationRequestMapper sdncRM;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
index 939f53727d..0a825b8424 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
@@ -33,6 +33,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper;
+import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -40,7 +41,6 @@ import org.springframework.stereotype.Component;
@Component
public class VnfAdapterVfModuleResources {
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVfModuleResources.class);
@Autowired
private VnfAdapterVfModuleObjectMapper vnfAdapterVfModuleObjectMapper;
@@ -48,7 +48,7 @@ public class VnfAdapterVfModuleResources {
public CreateVfModuleRequest createVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion,
OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse)
- throws IOException {
+ throws IOException, MissingValueTagException {
return vnfAdapterVfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion,
orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse,
sdncVfModuleQueryResponse);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
index c97ca8e0ea..2ec63182a0 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
@@ -39,7 +39,6 @@ import org.springframework.stereotype.Component;
@Component
public class VnfAdapterVolumeGroupResources {
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVolumeGroupResources.class);
@Autowired
private VnfAdapterObjectMapper vnfAdapterObjectMapper;
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 f02d5e48ee..2e7877fe3b 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
@@ -39,8 +39,6 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCClient {
- private static final Logger logger = LoggerFactory.getLogger(SDNCClient.class);
-
@Autowired
private SDNCProperties properties;
@Autowired
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 e21f64accd..1144648517 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
@@ -25,6 +25,7 @@ package org.onap.so.client.sdnc;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpStatus;
import org.onap.so.client.exception.BadResponseException;
@@ -52,6 +53,7 @@ public class SdnCommonTasks {
private static final String SDNC_CODE_NOT_0_OR_IN_200_299 = "Error from SDNC: %s";
private static final String COULD_NOT_CONVERT_SDNC_POJO_TO_JSON =
"ERROR: Could not convert SDNC pojo to json string.";
+ private static final String BRACKETS = LoggingAnchor.FIVE;
/***
*
@@ -66,8 +68,8 @@ public class SdnCommonTasks {
try {
jsonRequest = objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(request);
} catch (JsonProcessingException e) {
- logger.error("{} {} {} {} {}", MessageEnum.JAXB_EXCEPTION.toString(), COULD_NOT_CONVERT_SDNC_POJO_TO_JSON,
- "BPMN", ErrorCode.DataError.getValue(), e.getMessage());
+ logger.error(BRACKETS, MessageEnum.JAXB_EXCEPTION.toString(), COULD_NOT_CONVERT_SDNC_POJO_TO_JSON, "BPMN",
+ ErrorCode.DataError.getValue(), e.getMessage());
throw new MapperException(COULD_NOT_CONVERT_SDNC_POJO_TO_JSON);
}
jsonRequest = "{\"input\":" + jsonRequest + "}";
@@ -84,7 +86,7 @@ public class SdnCommonTasks {
HttpHeaders httpHeader = new HttpHeaders();
httpHeader.set("Authorization", auth);
httpHeader.setContentType(MediaType.APPLICATION_JSON);
- List<MediaType> acceptMediaTypes = new ArrayList<MediaType>();
+ List<MediaType> acceptMediaTypes = new ArrayList<>();
acceptMediaTypes.add(MediaType.APPLICATION_JSON);
httpHeader.setAccept(acceptMediaTypes);
return httpHeader;
@@ -98,7 +100,7 @@ public class SdnCommonTasks {
*/
public String validateSDNResponse(LinkedHashMap<String, Object> output) throws BadResponseException {
if (CollectionUtils.isEmpty(output)) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
+ logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
}
@@ -125,7 +127,7 @@ public class SdnCommonTasks {
return jsonResponse;
} else {
String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage);
- logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN",
+ logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN",
ErrorCode.DataError.getValue(), errorMessage);
throw new BadResponseException(errorMessage);
}
@@ -139,7 +141,7 @@ public class SdnCommonTasks {
*/
public String validateSDNGetResponse(LinkedHashMap<String, Object> output) throws BadResponseException {
if (CollectionUtils.isEmpty(output)) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
+ logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
}
@@ -149,7 +151,7 @@ public class SdnCommonTasks {
try {
stringOutput = objMapper.writeValueAsString(output);
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC, "BPMN",
+ logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC, "BPMN",
ErrorCode.UnknownError.getValue(), BAD_RESPONSE_FROM_SDNC);
throw new BadResponseException(BAD_RESPONSE_FROM_SDNC);
}
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
index 5910975051..12d1b0be95 100644
--- 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
@@ -21,7 +21,6 @@
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;
@@ -35,8 +34,8 @@ 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 String correlationValue = UUID.randomUUID().toString();
+ private String correlationName = "SDNCCallback";
private Object SDNCPayload;
@@ -57,19 +56,19 @@ public class SDNCRequest implements Serializable {
}
public String getCorrelationValue() {
- return CorrelationValue;
+ return correlationValue;
}
public void setCorrelationValue(String correlationValue) {
- CorrelationValue = correlationValue;
+ this.correlationValue = correlationValue;
}
public String getCorrelationName() {
- return CorrelationName;
+ return correlationName;
}
public void setCorrelationName(String correlationName) {
- CorrelationName = correlationName;
+ this.correlationName = correlationName;
}
public Object getSDNCPayload() {
@@ -86,13 +85,13 @@ public class SDNCRequest implements Serializable {
return false;
}
SDNCRequest castOther = (SDNCRequest) other;
- return new EqualsBuilder().append(CorrelationValue, castOther.CorrelationValue)
- .append(CorrelationName, castOther.CorrelationName).isEquals();
+ return new EqualsBuilder().append(correlationValue, castOther.correlationValue)
+ .append(correlationName, castOther.correlationName).isEquals();
}
@Override
public int hashCode() {
- return new HashCodeBuilder().append(CorrelationValue).append(CorrelationName).toHashCode();
+ return new HashCodeBuilder().append(correlationValue).append(correlationName).toHashCode();
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java
index 1718de9fe0..d6216c509d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java
@@ -23,22 +23,17 @@ package org.onap.so.client.sdnc.beans;
import org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumeration;
public enum SDNCSvcAction {
- ACTIVATE("activate", GenericResourceApiSvcActionEnumeration.ACTIVATE), DELETE("delete",
- GenericResourceApiSvcActionEnumeration.DELETE), ASSIGN("assign",
- GenericResourceApiSvcActionEnumeration.ASSIGN), ROLLBACK("rollback",
- GenericResourceApiSvcActionEnumeration.ROLLBACK), UNASSIGN("unassign",
- GenericResourceApiSvcActionEnumeration.UNASSIGN), DEACTIVATE("deactivate",
- GenericResourceApiSvcActionEnumeration.DEACTIVATE), CHANGE_DELETE(
- "changedelete",
- GenericResourceApiSvcActionEnumeration.CHANGEDELETE), CHANGE_ASSIGN(
- "changeassign",
- GenericResourceApiSvcActionEnumeration.CHANGEASSIGN), CREATE(
- "create",
- GenericResourceApiSvcActionEnumeration.CREATE), ENABLE(
- "enable",
- GenericResourceApiSvcActionEnumeration.ENABLE), DISABLE(
- "disable",
- GenericResourceApiSvcActionEnumeration.DISABLE);
+ ACTIVATE("activate", GenericResourceApiSvcActionEnumeration.ACTIVATE),
+ DELETE("delete", GenericResourceApiSvcActionEnumeration.DELETE),
+ ASSIGN("assign", GenericResourceApiSvcActionEnumeration.ASSIGN),
+ ROLLBACK("rollback", GenericResourceApiSvcActionEnumeration.ROLLBACK),
+ UNASSIGN("unassign", GenericResourceApiSvcActionEnumeration.UNASSIGN),
+ DEACTIVATE("deactivate", GenericResourceApiSvcActionEnumeration.DEACTIVATE),
+ CHANGE_DELETE("changedelete", GenericResourceApiSvcActionEnumeration.CHANGEDELETE),
+ CHANGE_ASSIGN("changeassign", GenericResourceApiSvcActionEnumeration.CHANGEASSIGN),
+ CREATE("create", GenericResourceApiSvcActionEnumeration.CREATE),
+ ENABLE("enable", GenericResourceApiSvcActionEnumeration.ENABLE),
+ DISABLE("disable", GenericResourceApiSvcActionEnumeration.DISABLE);
private final String name;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java
index b9b04bc7b7..4edbf37bad 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java
@@ -22,14 +22,14 @@ package org.onap.so.client.sdnc.beans;
public enum SDNCSvcOperation {
- VF_MODULE_TOPOLOGY_OPERATION("vf-module-topology-operation"), NETWORK_TOPOLOGY_OPERATION(
- "network-topology-operation"), VNF_TOPOLOGY_OPERATION(
- "vnf-topology-operation"), CONTRAIL_ROUTE_TOPOLOGY_OPERATION(
- "contrail-route-topology-operation"), SECURITY_ZONE_TOPOLOGY_OPERATION(
- "security-zone-topology-operation"), PORT_MIRROR_TOPOLOGY_OPERATION(
- "port-mirror-topology-operation"), SERVICE_TOPOLOGY_OPERATION(
- "service-topology-operation"), GENERIC_CONFIGURATION_TOPOLOGY_OPERATION(
- "generic-configuration-topology-operation");
+ VF_MODULE_TOPOLOGY_OPERATION("vf-module-topology-operation"),
+ NETWORK_TOPOLOGY_OPERATION("network-topology-operation"),
+ VNF_TOPOLOGY_OPERATION("vnf-topology-operation"),
+ CONTRAIL_ROUTE_TOPOLOGY_OPERATION("contrail-route-topology-operation"),
+ SECURITY_ZONE_TOPOLOGY_OPERATION("security-zone-topology-operation"),
+ PORT_MIRROR_TOPOLOGY_OPERATION("port-mirror-topology-operation"),
+ SERVICE_TOPOLOGY_OPERATION("service-topology-operation"),
+ GENERIC_CONFIGURATION_TOPOLOGY_OPERATION("generic-configuration-topology-operation");
private final String name;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java
index fb5f24694b..ae9fe6ad70 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java
@@ -22,11 +22,14 @@ package org.onap.so.client.sdnc.endpoint;
public enum SDNCTopology {
- SERVICE("service-topology-operation"), VNF("vnf-topology-operation"), VFMODULE(
- "vf-module-topology-operation"), CONTRAILROUTE("contrail-route-topology-operation"), PORTMIRROR(
- "port-mirror-topology-operation"), NETWORK("network-topology-operation"), SECURITYZONE(
- "security-zone-topology-operation"), CONFIGURATION(
- "generic-configuration-topology-operation");
+ SERVICE("service-topology-operation"),
+ VNF("vnf-topology-operation"),
+ VFMODULE("vf-module-topology-operation"),
+ CONTRAILROUTE("contrail-route-topology-operation"),
+ PORTMIRROR("port-mirror-topology-operation"),
+ NETWORK("network-topology-operation"),
+ SECURITYZONE("security-zone-topology-operation"),
+ CONFIGURATION("generic-configuration-topology-operation");
private final String topology;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
index 6627625d62..6ddb292a6c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
@@ -22,8 +22,10 @@
package org.onap.so.client.sdnc.mapper;
+import java.net.URI;
import java.util.Map;
import java.util.UUID;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
@@ -64,7 +66,7 @@ public class VfModuleTopologyOperationRequestMapper {
public GenericResourceApiVfModuleOperationInformation reqMapper(SDNCSvcOperation svcOperation,
SDNCSvcAction svcAction, VfModule vfModule, VolumeGroup volumeGroup, GenericVnf vnf,
ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext,
- String sdncAssignResponse) throws MapperException {
+ String sdncAssignResponse, URI callbackURL) throws MapperException {
GenericResourceApiVfModuleOperationInformation req = new GenericResourceApiVfModuleOperationInformation();
boolean includeModelInformation = false;
@@ -113,7 +115,7 @@ public class VfModuleTopologyOperationRequestMapper {
GenericResourceApiVfmodulerequestinputVfModuleRequestInput vfModuleRequestInput =
buildVfModuleRequestInput(vfModule, volumeGroup, cloudRegion, requestContext);
GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
- buildVfModuleSdncRequestHeader(sdncReqId, genericResourceApiSvcAction);
+ buildVfModuleSdncRequestHeader(sdncReqId, genericResourceApiSvcAction, callbackURL);
req.setRequestInformation(requestInformation);
req.setSdncRequestHeader(sdncRequestHeader);
@@ -169,13 +171,12 @@ public class VfModuleTopologyOperationRequestMapper {
}
private GenericResourceApiSdncrequestheaderSdncRequestHeader buildVfModuleSdncRequestHeader(String sdncReqId,
- GenericResourceApiSvcActionEnumeration svcAction) {
+ GenericResourceApiSvcActionEnumeration svcAction, URI callbackUrl) {
GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
new GenericResourceApiSdncrequestheaderSdncRequestHeader();
-
sdncRequestHeader.setSvcRequestId(sdncReqId);
sdncRequestHeader.setSvcAction(svcAction);
-
+ sdncRequestHeader.setSvcNotificationUrl(callbackUrl.toString());
return sdncRequestHeader;
}
@@ -188,7 +189,7 @@ public class VfModuleTopologyOperationRequestMapper {
mapper.readValue(sdncAssignResponse, GenericResourceApiVfModuleResponseInformation.class);
objectPath = assignResponseInfo.getVfModuleResponseInformation().getObjectPath();
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN",
ErrorCode.UnknownError.getValue(), e.getMessage());
}
}
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 f31bff988a..e39e202aa3 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
@@ -126,7 +126,7 @@ public class VnfTopologyOperationRequestMapper {
}
List<InstanceGroup> instanceGroups = vnf.getInstanceGroups();
List<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds> networkInstanceGroupIdList =
- new ArrayList<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds>();
+ new ArrayList<>();
for (InstanceGroup instanceGroup : instanceGroups) {
if (ModelInfoInstanceGroup.TYPE_L3_NETWORK
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 a448082cfe..eb73001f42 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
@@ -49,7 +49,7 @@ public class SniroValidator {
JSONObject jsonResponse = new JSONObject(response);
if (jsonResponse.has("requestStatus")) {
String status = jsonResponse.getString("requestStatus");
- if (status.equals("accepted")) {
+ if ("accepted".equals(status)) {
logger.debug("Sniro Managers synchronous response indicates accepted");
} else {
String message = jsonResponse.getString("statusMessage");
@@ -111,7 +111,7 @@ public class SniroValidator {
if (!response.isEmpty()) {
String status = (String) response.get("status");
if (isNotBlank(status)) {
- if (status.equals("success")) {
+ if ("success".equals(status)) {
logger.debug("Sniro Conductors synchronous response indicates success");
} else {
String message = (String) response.get("message");
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
index cded23aad2..3127275b24 100644
--- 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
@@ -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,13 @@ public class Candidate implements Serializable {
@JsonProperty("cloudOwner")
private String cloudOwner;
+ public Candidate() {}
+
+ public Candidate(CandidateType identifierType, List<String> identifiers, String cloudOwner) {
+ this.identifierType = identifierType;
+ this.identifiers = identifiers;
+ this.cloudOwner = cloudOwner;
+ }
public CandidateType getIdentifierType() {
return identifierType;
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
index 19378cdbfa..0cc993560d 100644
--- 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
@@ -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,6 +38,10 @@ public class Demand implements Serializable {
private List<Candidate> requiredCandidates;
@JsonProperty("excludedCandidates")
private List<Candidate> excludedCandidates;
+ @JsonProperty("existingCandidates")
+ private List<Candidate> existingCandidates;
+ @JsonProperty("filteringAttributes")
+ private List<Candidate> filteringAttributes;
public List<Candidate> getRequiredCandidates() {
@@ -80,4 +84,20 @@ public class Demand implements Serializable {
this.modelInfo = modelInfo;
}
+ public List<Candidate> getExistingCandidates() {
+ return existingCandidates;
+ }
+
+ public void setExistingCandidates(List<Candidate> existingCandidates) {
+ this.existingCandidates = existingCandidates;
+ }
+
+ public List<Candidate> getFilteringAttributes() {
+ return filteringAttributes;
+ }
+
+ public void setFilteringAttributes(List<Candidate> filteringAttributes) {
+ this.filteringAttributes = filteringAttributes;
+ }
+
}
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
index d71b4ec5fc..9ab3ae673a 100644
--- 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
@@ -30,7 +30,7 @@ public class LicenseInfo implements Serializable {
private static final long serialVersionUID = 6878164369491185856L;
@JsonProperty("licenseDemands")
- private List<Demand> demands = new ArrayList<Demand>();
+ private List<Demand> demands = new ArrayList<>();
public List<Demand> getDemands() {
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
index ae13903a22..bbbbf9cfd6 100644
--- 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
@@ -37,7 +37,7 @@ public class PlacementInfo implements Serializable {
@JsonProperty("subscriberInfo")
private SubscriberInfo subscriberInfo;
@JsonProperty("placementDemands")
- private List<Demand> demands = new ArrayList<Demand>();
+ private List<Demand> demands = new ArrayList<>();
@JsonRawValue
@JsonProperty("requestParameters")
private String requestParameters;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java
index f632424c26..b8896a2bab 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java
@@ -40,7 +40,7 @@ public class SniroConductorRequest implements Serializable {
private static final Logger logger = LoggerFactory.getLogger(SniroConductorRequest.class);
@JsonProperty("release-locks")
- private List<Resource> resources = new ArrayList<Resource>();
+ private List<Resource> resources = new ArrayList<>();
public List<Resource> getResources() {
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
index eaf8b6e379..35a4cac459 100644
--- 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
@@ -22,7 +22,6 @@ 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")
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java
index a78dffb4e0..12adec9e24 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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.ticket;
public class ExternalTicket {