2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2018 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=========================================================
21 package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
23 import java.util.List;
24 import java.util.Optional;
26 import org.onap.so.bpmn.common.BuildingBlockExecution;
27 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
28 import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
29 import org.onap.so.logger.MsoLogger;
30 import org.springframework.stereotype.Component;
33 public class NetworkBBUtils {
35 private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, NetworkBBUtils.class);
37 private static final String CLOUD_REGION_VER25 = "2.5";
38 private static final String CLOUD_REGION_AAIAIC25 = "AAIAIC25";
41 * BPMN access method to check if Relationship's Related-To value exists.
43 * @param l3Network - L3Network object
44 * @param relatedToValue - String, ex: 'vf-module'
47 public boolean isRelationshipRelatedToExists(Optional<org.onap.aai.domain.yang.L3Network> l3network, String relatedToValue) {
48 boolean isRelatedToExists = false;
49 if (l3network.isPresent()) {
50 List<org.onap.aai.domain.yang.Relationship> relationshipList = l3network.get().getRelationshipList().getRelationship();
51 for (org.onap.aai.domain.yang.Relationship relationship : relationshipList) {
52 if (relationship.getRelatedTo().equals(relatedToValue)) {
53 isRelatedToExists = true;
58 return isRelatedToExists;
62 * BPMN access method to extract Cloud Region data
64 * @param motsValue (ex: SourceSystem.SDNC or SourceSystem.PO)
66 public String getCloudRegion(BuildingBlockExecution execution, SourceSystem sourceValue) {
67 GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
68 CloudRegion cloudRegion = gBBInput.getCloudRegion();
69 String cloudRegionId = cloudRegion.getLcpCloudRegionId();
70 if (sourceValue.equals(SourceSystem.SDNC) && CLOUD_REGION_VER25.equalsIgnoreCase(cloudRegion.getCloudRegionVersion())) {
71 cloudRegionId = CLOUD_REGION_AAIAIC25;