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