2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
22 import org.camunda.bpm.engine.delegate.BpmnError;
23 import org.onap.so.bpmn.common.BuildingBlockExecution;
24 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
25 import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
26 import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
27 import org.onap.so.client.exception.ExceptionBuilder;
28 import org.onap.so.client.orchestration.AAINetworkResources;
29 import org.onap.so.client.orchestration.SDNCNetworkResources;
30 import org.onap.so.logger.MsoLogger;
31 import org.springframework.beans.factory.annotation.Autowired;
32 import org.springframework.stereotype.Component;
35 public class AssignNetworkBBUtils {
37 private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
38 AssignNetworkBBUtils.class);
40 private ExceptionBuilder exceptionUtil;
42 private AAINetworkResources aaiNetworkResources;
44 private SDNCNetworkResources sdncNetworkResources;
46 private ExtractPojosForBB extractPojosForBB;
49 * BPMN access method. Verify if network name was provided as input to BB
53 public boolean networkFoundByName(BuildingBlockExecution execution) throws Exception {
54 boolean found = false;
55 //TODO - populate logic after iTrack MSO-2143 implemented
60 * BPMN access method to extract Cloud Region data
64 public void getCloudRegion(BuildingBlockExecution execution) {
66 GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
67 CloudRegion cloudRegion = gBBInput.getCloudRegion();
68 String cloudRegionSdnc;
69 String cloudRegionPo = cloudRegion.getLcpCloudRegionId();
70 if (cloudRegion.getCloudRegionVersion().equalsIgnoreCase("2.5")){
71 cloudRegionSdnc = "AAIAIC25";
73 cloudRegionSdnc = cloudRegionPo;
75 execution.setVariable("cloudRegionPo", cloudRegionPo);
76 execution.setVariable("cloudRegionSdnc", cloudRegionSdnc);
77 }catch (Exception ex) {
78 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
83 * BPMN access method. Process silent success scenario
86 public void processSilentSuccess(BuildingBlockExecution execution) {
87 String msg = "Silent success processing network assign";
92 * BPMN access method. Process silent success scenario
95 public void failOrchestrationStatus(BuildingBlockExecution execution) {
96 BpmnError error = new BpmnError("Failed orchestration status verificaiton");
97 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, error);