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
56 public boolean networkFoundByName(BuildingBlockExecution execution) throws Exception {
57 boolean found = false;
58 // TODO - populate logic after iTrack MSO-2143 implemented
63 * BPMN access method to extract Cloud Region data
68 public void getCloudRegion(BuildingBlockExecution execution) {
70 GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
71 CloudRegion cloudRegion = gBBInput.getCloudRegion();
72 String cloudRegionSdnc;
73 String cloudRegionPo = cloudRegion.getLcpCloudRegionId();
74 if (cloudRegion.getCloudRegionVersion().equalsIgnoreCase("2.5")) {
75 cloudRegionSdnc = "AAIAIC25";
77 cloudRegionSdnc = cloudRegionPo;
79 execution.setVariable("cloudRegionPo", cloudRegionPo);
80 execution.setVariable("cloudRegionSdnc", cloudRegionSdnc);
81 } catch (Exception ex) {
82 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
87 * BPMN access method. Process silent success scenario
91 public void processSilentSuccess(BuildingBlockExecution execution) {
92 String msg = "Silent success processing network assign";
97 * BPMN access method. Process silent success scenario
101 public void failOrchestrationStatus(BuildingBlockExecution execution) {
102 BpmnError error = new BpmnError("Failed orchestration status verificaiton");
103 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, error);