diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN')
17 files changed, 294 insertions, 208 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index c395b01221..0c61cc3012 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -182,7 +182,7 @@ <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> - <version>1.9.3</version> + <version>1.9.4</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java index 9e320700bd..5be06f9be2 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java @@ -1,8 +1,11 @@ package org.onap.so.bpmn.servicedecomposition.entities; +import java.io.Serializable; import org.onap.so.serviceinstancebeans.RequestDetails; -public class BuildingBlockBase { +public abstract class BuildingBlockBase<T extends BuildingBlockBase<T>> implements Serializable { + + private static final long serialVersionUID = 4671883098039479717L; private Boolean aLaCarte; private String apiVersion; @@ -14,40 +17,49 @@ public class BuildingBlockBase { private WorkflowResourceIds workflowResourceIds; private String vnfType; - public void setaLaCarte(Boolean aLaCarte) { + public T setaLaCarte(Boolean aLaCarte) { this.aLaCarte = aLaCarte; + return (T) this; } - public void setApiVersion(String apiVersion) { + public T setApiVersion(String apiVersion) { this.apiVersion = apiVersion; + return (T) this; } - public void setResume(Boolean resume) { + public T setResume(Boolean resume) { isResume = resume; + return (T) this; } - public void setResourceId(String resourceId) { + public T setResourceId(String resourceId) { this.resourceId = resourceId; + return (T) this; } - public void setRequestId(String requestId) { + public T setRequestId(String requestId) { this.requestId = requestId; + return (T) this; } - public void setRequestAction(String requestAction) { + public T setRequestAction(String requestAction) { this.requestAction = requestAction; + return (T) this; } - public void setRequestDetails(RequestDetails requestDetails) { + public T setRequestDetails(RequestDetails requestDetails) { this.requestDetails = requestDetails; + return (T) this; } - public void setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) { + public T setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) { this.workflowResourceIds = workflowResourceIds; + return (T) this; } - public void setVnfType(String vnfType) { + public T setVnfType(String vnfType) { this.vnfType = vnfType; + return (T) this; } public Boolean isResume() { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java index 9274e0659e..e45811117c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java @@ -21,36 +21,49 @@ package org.onap.so.bpmn.servicedecomposition.entities; import java.io.Serializable; +import org.onap.so.serviceinstancebeans.RequestDetails; -public class ExecuteBuildingBlock extends BuildingBlockBase implements Serializable { +public class ExecuteBuildingBlock extends BuildingBlockBase<ExecuteBuildingBlock> implements Serializable { private BuildingBlock buildingBlock; private ConfigurationResourceKeys configurationResourceKeys; private Boolean homing = false; + private String oldVolumeGroupName; private static final long serialVersionUID = 3L; public BuildingBlock getBuildingBlock() { return buildingBlock; } - public void setBuildingBlock(BuildingBlock buildingBlock) { + public ExecuteBuildingBlock setBuildingBlock(BuildingBlock buildingBlock) { this.buildingBlock = buildingBlock; + return this; } public Boolean isHoming() { return homing; } - public void setHoming(Boolean homing) { + public ExecuteBuildingBlock setHoming(Boolean homing) { this.homing = homing; + return this; } public ConfigurationResourceKeys getConfigurationResourceKeys() { return configurationResourceKeys; } - public void setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) { + public ExecuteBuildingBlock setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) { this.configurationResourceKeys = configurationResourceKeys; + return this; } + public String getOldVolumeGroupName() { + return oldVolumeGroupName; + } + + public ExecuteBuildingBlock setOldVolumeGroupName(String oldVolumeGroupName) { + this.oldVolumeGroupName = oldVolumeGroupName; + return this; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java index e8be2734cc..508709e12c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java @@ -41,14 +41,33 @@ public class WorkflowResourceIds implements Serializable { private String configurationId; private String instanceGroupId; + + public WorkflowResourceIds() { + super(); + } + + public WorkflowResourceIds(WorkflowResourceIds workflowResourceIds) { + this.serviceInstanceId = workflowResourceIds.serviceInstanceId; + this.pnfId = workflowResourceIds.pnfId; + this.vnfId = workflowResourceIds.vnfId; + this.networkId = workflowResourceIds.networkId; + this.volumeGroupId = workflowResourceIds.volumeGroupId; + this.vfModuleId = workflowResourceIds.vfModuleId; + this.networkCollectionId = workflowResourceIds.networkCollectionId; + this.configurationId = workflowResourceIds.configurationId; + this.instanceGroupId = workflowResourceIds.instanceGroupId; + } + + @Override public String toString() { return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId).append("pnfId", pnfId) .append("vnfId", vnfId).append("networkId", networkId).append("volumeGroupId", volumeGroupId) .append("vfModuleId", vfModuleId).append("networkCollectionId", networkCollectionId) - .append("configurationId", configurationId).toString(); + .append("configurationId", configurationId).append("instanceGroupId", instanceGroupId).toString(); } + public String getServiceInstanceId() { return serviceInstanceId; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index bfa77212c4..e65e1a8471 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -62,6 +62,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys; @@ -750,6 +751,10 @@ public class BBInputSetup implements JavaDelegate { parameter.getInstanceName(), generatedVnfType, parameter.getInstanceParams()); vnf.getVolumeGroups().add(volumeGroup); if (parameter.getIsReplace()) { + if (parameter.getExecuteBB().getOldVolumeGroupName() != null + && !parameter.getExecuteBB().getOldVolumeGroupName().isEmpty()) { + volumeGroup.setVolumeGroupName(parameter.getExecuteBB().getOldVolumeGroupName()); + } mapCatalogVolumeGroup(volumeGroup, parameter.getModelInfo(), parameter.getServiceModel().getNewService(), replaceVnfModelCustomizationUUID); } else { @@ -1699,20 +1704,8 @@ public class BBInputSetup implements JavaDelegate { && bbName.equalsIgnoreCase(AssignFlows.SERVICE_INSTANCE.toString())) { throw new Exception("Request invalid missing: RequestInfo:InstanceName"); } else { - org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = null; - if (aLaCarte && bbName.equalsIgnoreCase(AssignFlows.SERVICE_INSTANCE.toString())) { - serviceInstanceAAI = bbInputSetupUtils - .getAAIServiceInstanceByName(requestDetails.getRequestInfo().getInstanceName(), customer); - } - if (serviceInstanceId != null && serviceInstanceAAI == null) { - if (customer != null && customer.getServiceSubscription() != null) { - serviceInstanceAAI = - bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(), - customer.getServiceSubscription().getServiceType(), serviceInstanceId); - } else { - serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); - } - } + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI; + serviceInstanceAAI = getServiceInstanceAAI(requestDetails, customer, serviceInstanceId, aLaCarte, bbName); if (serviceInstanceAAI != null) { lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId); return this.getExistingServiceInstance(serviceInstanceAAI); @@ -1722,6 +1715,25 @@ public class BBInputSetup implements JavaDelegate { } } + private org.onap.aai.domain.yang.ServiceInstance getServiceInstanceAAI(RequestDetails requestDetails, + Customer customer, String serviceInstanceId, boolean aLaCarte, String bbName) throws Exception { + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = null; + if (aLaCarte && bbName.equalsIgnoreCase(AssignFlows.SERVICE_INSTANCE.toString())) { + serviceInstanceAAI = bbInputSetupUtils + .getAAIServiceInstanceByName(requestDetails.getRequestInfo().getInstanceName(), customer); + } + if (serviceInstanceId != null && serviceInstanceAAI == null) { + if (customer != null && customer.getServiceSubscription() != null) { + serviceInstanceAAI = + bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(), + customer.getServiceSubscription().getServiceType(), serviceInstanceId); + } else { + serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + } + } + return serviceInstanceAAI; + } + protected ServiceInstance createServiceInstance(RequestDetails requestDetails, Project project, OwningEntity owningEntity, Map<ResourceKey, String> lookupKeyMap, String serviceInstanceId) { ServiceInstance serviceInstance = new ServiceInstance(); @@ -1833,17 +1845,17 @@ public class BBInputSetup implements JavaDelegate { AAIResultWrapper serviceInstanceWrapper = new AAIResultWrapper( new AAICommonObjectMapperProvider().getMapper().writeValueAsString(serviceInstanceAAI)); Optional<Relationships> relationshipsOp = serviceInstanceWrapper.getRelationships(); - Relationships relationships = null; if (relationshipsOp.isPresent()) { - relationships = relationshipsOp.get(); - } else { - return; + mapRelationship(serviceInstance, relationshipsOp.get()); } + } + private void mapRelationship(ServiceInstance serviceInstance, Relationships relationships) { this.mapProject(relationships.getByType(AAIObjectType.PROJECT), serviceInstance); this.mapOwningEntity(relationships.getByType(AAIObjectType.OWNING_ENTITY), serviceInstance); this.mapL3Networks(relationships.getRelatedAAIUris(AAIObjectType.L3_NETWORK), serviceInstance.getNetworks()); this.mapGenericVnfs(relationships.getRelatedAAIUris(AAIObjectType.GENERIC_VNF), serviceInstance.getVnfs()); + this.mapPnfs(relationships.getRelatedAAIUris(AAIObjectType.PNF), serviceInstance.getPnfs()); this.mapCollection(relationships.getByType(AAIObjectType.COLLECTION), serviceInstance); this.mapConfigurations(relationships.getRelatedAAIUris(AAIObjectType.CONFIGURATION), serviceInstance.getConfigurations()); @@ -1895,6 +1907,19 @@ public class BBInputSetup implements JavaDelegate { return genericVnf; } + protected void mapPnfs(List<AAIResourceUri> list, List<Pnf> pnfs) { + for (AAIResourceUri aaiResourceUri : list) { + pnfs.add(this.mapPnf(aaiResourceUri)); + } + } + + protected Pnf mapPnf(AAIResourceUri aaiResourceUri) { + AAIResultWrapper aaiPnfWrapper = this.bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri); + Optional<org.onap.aai.domain.yang.Pnf> aaiPnfWrapperOp = + aaiPnfWrapper.asBean(org.onap.aai.domain.yang.Pnf.class); + return aaiPnfWrapperOp.map(pnf -> this.mapperLayer.mapAAIPnfIntoPnf(pnf)).orElse(null); + } + protected List<InstanceGroup> mapInstanceGroups(List<AAIResultWrapper> instanceGroups) { List<InstanceGroup> instanceGroupsList = new ArrayList<>(); for (AAIResultWrapper volumeGroupWrapper : instanceGroups) { @@ -1945,14 +1970,10 @@ public class BBInputSetup implements JavaDelegate { AAIResultWrapper lineOfBusinessWrapper = lineOfBusinesses.get(0); Optional<org.onap.aai.domain.yang.LineOfBusiness> aaiLineOfBusinessOp = lineOfBusinessWrapper.asBean(org.onap.aai.domain.yang.LineOfBusiness.class); - org.onap.aai.domain.yang.LineOfBusiness aaiLineOfBusiness = null; - if (!aaiLineOfBusinessOp.isPresent()) { - return; + if (aaiLineOfBusinessOp.isPresent()) { + LineOfBusiness lineOfBusiness = this.mapperLayer.mapAAILineOfBusiness(aaiLineOfBusinessOp.get()); + genericVnf.setLineOfBusiness(lineOfBusiness); } - aaiLineOfBusiness = aaiLineOfBusinessOp.get(); - - LineOfBusiness lineOfBusiness = this.mapperLayer.mapAAILineOfBusiness(aaiLineOfBusiness); - genericVnf.setLineOfBusiness(lineOfBusiness); } } @@ -1961,14 +1982,10 @@ public class BBInputSetup implements JavaDelegate { AAIResultWrapper platformWrapper = platforms.get(0); Optional<org.onap.aai.domain.yang.Platform> aaiPlatformOp = platformWrapper.asBean(org.onap.aai.domain.yang.Platform.class); - org.onap.aai.domain.yang.Platform aaiPlatform = null; - if (!aaiPlatformOp.isPresent()) { - return; + if (aaiPlatformOp.isPresent()) { + Platform platform = this.mapperLayer.mapAAIPlatform(aaiPlatformOp.get()); + genericVnf.setPlatform(platform); } - aaiPlatform = aaiPlatformOp.get(); - - Platform platform = this.mapperLayer.mapAAIPlatform(aaiPlatform); - genericVnf.setPlatform(platform); } } @@ -1977,34 +1994,36 @@ public class BBInputSetup implements JavaDelegate { AAIResultWrapper collectionWrapper = collections.get(0); Optional<org.onap.aai.domain.yang.Collection> aaiCollectionOp = collectionWrapper.asBean(org.onap.aai.domain.yang.Collection.class); - org.onap.aai.domain.yang.Collection aaiCollection = null; - if (!aaiCollectionOp.isPresent()) { - return; - } - aaiCollection = aaiCollectionOp.get(); - - Collection collection = this.mapperLayer.mapAAICollectionIntoCollection(aaiCollection); - NetworkCollectionResourceCustomization collectionResourceCust = bbInputSetupUtils - .getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId()); - collection.setModelInfoCollection(mapperLayer.mapCatalogCollectionToCollection(collectionResourceCust, - collectionResourceCust.getCollectionResource())); - Optional<Relationships> relationshipsOp = collectionWrapper.getRelationships(); - Relationships relationships = null; - if (relationshipsOp.isPresent()) { - relationships = relationshipsOp.get(); - } else { - serviceInstance.setCollection(collection); - return; - } - List<InstanceGroup> instanceGroupsList = - mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP)); - if (!instanceGroupsList.isEmpty()) { - collection.setInstanceGroup(instanceGroupsList.get(0)); - } - serviceInstance.setCollection(collection); + aaiCollectionOp.ifPresent( + collection -> serviceInstanceSetCollection(serviceInstance, collectionWrapper, collection)); } } + private void serviceInstanceSetCollection(ServiceInstance serviceInstance, AAIResultWrapper collectionWrapper, + org.onap.aai.domain.yang.Collection aaiCollection) { + Collection collection = getCollection(aaiCollection); + Optional<Relationships> relationshipsOp = collectionWrapper.getRelationships(); + relationshipsOp.ifPresent(relationships -> setInstanceGroupForCollection(collection, relationships)); + serviceInstance.setCollection(collection); + } + + private void setInstanceGroupForCollection(Collection collection, Relationships relationships) { + List<InstanceGroup> instanceGroupsList = + mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP)); + if (!instanceGroupsList.isEmpty()) { + collection.setInstanceGroup(instanceGroupsList.get(0)); + } + } + + private Collection getCollection(org.onap.aai.domain.yang.Collection aaiCollection) { + Collection collection = this.mapperLayer.mapAAICollectionIntoCollection(aaiCollection); + NetworkCollectionResourceCustomization collectionResourceCust = bbInputSetupUtils + .getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId()); + collection.setModelInfoCollection(mapperLayer.mapCatalogCollectionToCollection(collectionResourceCust, + collectionResourceCust.getCollectionResource())); + return collection; + } + protected void mapL3Networks(List<AAIResourceUri> list, List<L3Network> l3Networks) { for (AAIResourceUri aaiResourceUri : list) { l3Networks.add(this.mapL3Network(aaiResourceUri)); @@ -2080,14 +2099,10 @@ public class BBInputSetup implements JavaDelegate { AAIResultWrapper owningEntityWrapper = owningEntities.get(0); Optional<org.onap.aai.domain.yang.OwningEntity> aaiOwningEntityOp = owningEntityWrapper.asBean(org.onap.aai.domain.yang.OwningEntity.class); - org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = null; - if (!aaiOwningEntityOp.isPresent()) { - return; + if (aaiOwningEntityOp.isPresent()) { + OwningEntity owningEntity = this.mapperLayer.mapAAIOwningEntity(aaiOwningEntityOp.get()); + serviceInstance.setOwningEntity(owningEntity); } - aaiOwningEntity = aaiOwningEntityOp.get(); - - OwningEntity owningEntity = this.mapperLayer.mapAAIOwningEntity(aaiOwningEntity); - serviceInstance.setOwningEntity(owningEntity); } } @@ -2096,14 +2111,10 @@ public class BBInputSetup implements JavaDelegate { AAIResultWrapper projectWrapper = projects.get(0); Optional<org.onap.aai.domain.yang.Project> aaiProjectOp = projectWrapper.asBean(org.onap.aai.domain.yang.Project.class); - org.onap.aai.domain.yang.Project aaiProject = null; - if (!aaiProjectOp.isPresent()) { - return; + if (aaiProjectOp.isPresent()) { + Project project = this.mapperLayer.mapAAIProject(aaiProjectOp.get()); + serviceInstance.setProject(project); } - aaiProject = aaiProjectOp.get(); - - Project project = this.mapperLayer.mapAAIProject(aaiProject); - serviceInstance.setProject(project); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 67d073d7b6..2bb383e4ec 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -52,6 +52,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; @@ -323,6 +324,10 @@ public class BBInputSetupMapperLayer { return genericVnf; } + protected Pnf mapAAIPnfIntoPnf(org.onap.aai.domain.yang.Pnf aaiPnf) { + return modelMapper.map(aaiPnf, Pnf.class); + } + protected void mapAllLicensesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, GenericVnf genericVnf) { if (aaiGenericVnf.getLicenses() != null) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java index 4379864bfe..68161a8dd5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.serviceinstancebeans.Pnfs; @@ -36,6 +37,10 @@ final class BBInputSetupPnf { Pnf pnf = new Pnf(); pnf.setPnfId(pnfId); pnf.setPnfName(pnfs.getInstanceName()); + pnf.setModelInfoPnf(new ModelInfoPnf()); + pnf.getModelInfoPnf().setModelCustomizationUuid(pnfs.getModelInfo().getModelCustomizationId()); + pnf.getModelInfoPnf().setModelInvariantUuid(pnfs.getModelInfo().getModelInvariantId()); + pnf.getModelInfoPnf().setModelUuid(pnfs.getModelInfo().getModelVersionId()); pnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED); serviceInstance.getPnfs().add(pnf); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java index 5a52e3a49d..4206596c94 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -104,7 +104,7 @@ public class ExecuteBuildingBlockRainyDay { handlingCode = "Abort"; } else { try { - if (gBBInput.getCustomer().getServiceSubscription() != null) { + if (gBBInput.getCustomer() != null && gBBInput.getCustomer().getServiceSubscription() != null) { serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0) .getModelInfoServiceInstance().getServiceType(); } @@ -119,7 +119,7 @@ public class ExecuteBuildingBlockRainyDay { String vnfType = ASTERISK; String vnfName = ASTERISK; try { - if (gBBInput.getCustomer().getServiceSubscription() != null) { + if (gBBInput.getCustomer() != null && gBBInput.getCustomer().getServiceSubscription() != null) { for (GenericVnf vnf : gBBInput.getCustomer().getServiceSubscription().getServiceInstances() .get(0).getVnfs()) { if (vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { @@ -173,7 +173,7 @@ public class ExecuteBuildingBlockRainyDay { String serviceRole = ASTERISK; try { - if (gBBInput.getCustomer().getServiceSubscription() != null) { + if (gBBInput.getCustomer() != null && gBBInput.getCustomer().getServiceSubscription() != null) { serviceRole = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0) .getModelInfoServiceInstance().getServiceRole(); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java deleted file mode 100644 index 7b1066d48c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 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.exception; - -public class BadResponseException extends Exception { - - String responseCode; - - public BadResponseException() {} - - public BadResponseException(String message) { - super(message); - } - - public BadResponseException(String message, String responseCode) { - super(message); - this.responseCode = responseCode; - } - - public String getResponseCode() { - return responseCode; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java deleted file mode 100644 index 354c669d62..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 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.exception; - -public class MapperException extends Exception { - - public MapperException() {} - - public MapperException(String message) { - super(message); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java index 13d2b7d3d3..4755e58582 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -39,6 +39,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; @@ -75,7 +76,6 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; -import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.VnfcCustomization; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.RequestDetails; @@ -422,6 +422,17 @@ public class BBInputSetupMapperLayerTest { } @Test + public void testMapAAIPnfIntoPnf() throws IOException { + Pnf expected = mapper.readValue(new File(RESOURCE_PATH + "PnfExpected.json"), Pnf.class); + org.onap.aai.domain.yang.Pnf aaiPnf = + mapper.readValue(new File(RESOURCE_PATH + "aaiPnfInput.json"), org.onap.aai.domain.yang.Pnf.class); + + Pnf actual = bbInputSetupMapperLayer.mapAAIPnfIntoPnf(aaiPnf); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test public void testMapAAICollectionIntoCollection() throws JsonParseException, JsonMappingException, IOException { org.onap.aai.domain.yang.Collection aaiCollection = mapper .readValue(new File(RESOURCE_PATH + "CollectionInput.json"), org.onap.aai.domain.yang.Collection.class); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java index 0eef9cccd8..aa9943b9b1 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java @@ -29,6 +29,7 @@ import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.Pnfs; import static org.mockito.Mockito.doReturn; @@ -38,11 +39,22 @@ public class BBInputSetupPnfTest { @Mock private Pnfs pnfs; + @Mock + private ModelInfo modelInfo; + @Test public void populatePnfShouldSetRequiredFields() { final String pnfId = "PNF_id1"; final String pnfName = "PNF_name1"; + final String modelCustomizationId = "8421fe03-fd1b-4bf7-845a-c3fe91edb031"; + final String modelInvariantId = "3360a2a5-22ff-44c7-8935-08c8e5ecbd06"; + final String modelVersionId = "b80c3a52-abd4-436c-a22e-9c5da768781a"; + + doReturn(modelCustomizationId).when(modelInfo).getModelCustomizationId(); + doReturn(modelInvariantId).when(modelInfo).getModelInvariantId(); + doReturn(modelVersionId).when(modelInfo).getModelVersionId(); doReturn(pnfName).when(pnfs).getInstanceName(); + doReturn(modelInfo).when(pnfs).getModelInfo(); ServiceInstance serviceInstance = new ServiceInstance(); BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance); @@ -53,6 +65,9 @@ public class BBInputSetupPnfTest { assertEquals(pnfId, pnf.getPnfId()); assertEquals(pnfName, pnf.getPnfName()); + assertEquals(modelCustomizationId, pnf.getModelInfoPnf().getModelCustomizationUuid()); + assertEquals(modelInvariantId, pnf.getModelInfoPnf().getModelInvariantUuid()); + assertEquals(modelVersionId, pnf.getModelInfoPnf().getModelUuid()); assertEquals(OrchestrationStatus.PRECREATED, pnf.getOrchestrationStatus()); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java index a74d78e04b..d7cfaf94f7 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java @@ -115,8 +115,7 @@ public class BBInputSetupPopulateMethodsTest { .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class); - executeBB.setConfigurationResourceKeys(configResourceKeys); - executeBB.setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()) .setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); @@ -182,8 +181,7 @@ public class BBInputSetupPopulateMethodsTest { ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class); - executeBB.setConfigurationResourceKeys(configResourceKeys); - executeBB.setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName(AssignFlows.VF_MODULE.toString()).setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); @@ -245,8 +243,7 @@ public class BBInputSetupPopulateMethodsTest { ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class); - executeBB.setConfigurationResourceKeys(configResourceKeys); - executeBB.setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("AssignFabricConfigurationBB").setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index ffdc275dee..dd79d2772f 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -69,6 +69,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; @@ -308,9 +309,8 @@ public class BBInputSetupTest { @Test public void testGetExecuteBBFromExecution() throws IOException { BuildingBlock bb = new BuildingBlock().setBpmnFlowName("AssignServiceInstanceBB"); - ExecuteBuildingBlock expected = new ExecuteBuildingBlock(); - expected.setBuildingBlock(bb); - expected.setRequestId("00032ab7-3fb3-42e5-965d-8ea592502017"); + ExecuteBuildingBlock expected = + new ExecuteBuildingBlock().setBuildingBlock(bb).setRequestId("00032ab7-3fb3-42e5-965d-8ea592502017"); DelegateExecution execution = Mockito.mock(DelegateExecution.class); doReturn(expected).when(execution).getVariable(any(String.class)); ExecuteBuildingBlock actual = SPY_bbInputSetup.getExecuteBBFromExecution(execution); @@ -322,8 +322,7 @@ public class BBInputSetupTest { GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), GeneralBuildingBlock.class); - ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock(); - executeBB.setRequestId("requestId"); + ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock().setRequestId("requestId"); RequestDetails requestDetails = new RequestDetails(); ModelInfo modelInfo = new ModelInfo(); modelInfo.setModelType(ModelType.service); @@ -351,8 +350,7 @@ public class BBInputSetupTest { GeneralBuildingBlock expected = mapper .readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockCMExpected.json"), GeneralBuildingBlock.class); - ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock(); - executeBB.setRequestId("requestId"); + ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock().setRequestId("requestId"); RequestDetails requestDetails = new RequestDetails(); requestDetails.setModelInfo(null); RequestParameters requestParams = new RequestParameters(); @@ -818,6 +816,26 @@ public class BBInputSetupTest { assertThat(actual, sameBeanAs(expected)); } + @Test + public void testGetServiceInstanceHelperCreateScenarioExistingWithName() throws Exception { + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + requestDetails.setRequestInfo(requestInfo); + ServiceSubscription serviceSub = new ServiceSubscription(); + Customer customer = new Customer(); + customer.setServiceSubscription(serviceSub); + ServiceInstance expected = new ServiceInstance(); + expected.setServiceInstanceId("serviceInstanceId"); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance(); + serviceInstanceAAI.setServiceInstanceId("serviceInstanceId"); + + doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils).getAAIServiceInstanceByIdAndCustomer(Mockito.any(), + Mockito.any(), Mockito.any()); + ServiceInstance actual = SPY_bbInputSetup.getServiceInstanceHelper(requestDetails, customer, null, null, + new HashMap<>(), "SharansInstanceId", false, new Service(), "ActivateServiceInstanceBB"); + assertThat(actual, sameBeanAs(expected)); + } + @Test(expected = Exception.class) public void testGetServiceInstanceHelperCreateScenarioExistingNoNameButWithIdExceptionThrown() throws Exception { RequestDetails requestDetails = new RequestDetails(); @@ -1006,9 +1024,7 @@ public class BBInputSetupTest { Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName(AssignFlows.SERVICE_INSTANCE.toString()); - ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock(); - executeBB.setaLaCarte(true); - executeBB.setBuildingBlock(buildingBlock); + ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock().setaLaCarte(true).setBuildingBlock(buildingBlock); RequestDetails requestDetails = new RequestDetails(); RequestInfo reqInfo = new RequestInfo(); reqInfo.setInstanceName("serviceInstanceName"); @@ -1800,6 +1816,29 @@ public class BBInputSetupTest { } @Test + public void testMapPnfs() throws JsonProcessingException { + org.onap.aai.domain.yang.Pnf expectedAAI = new org.onap.aai.domain.yang.Pnf(); + org.onap.aai.domain.yang.RelationshipList relationshipList = new org.onap.aai.domain.yang.RelationshipList(); + org.onap.aai.domain.yang.Relationship relationship = new org.onap.aai.domain.yang.Relationship(); + relationshipList.getRelationship().add(relationship); + expectedAAI.setRelationshipList(relationshipList); + + Pnf expected = new Pnf(); + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, "pnfId"); + AAIResultWrapper pnfWrapper = + new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(pnfWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri); + doReturn(expected).when(bbInputSetupMapperLayer).mapAAIPnfIntoPnf(isA(org.onap.aai.domain.yang.Pnf.class)); + + List<Pnf> pnfs = new ArrayList<>(); + + SPY_bbInputSetup.mapPnfs(Arrays.asList(aaiResourceUri), pnfs); + + assertEquals(expected, pnfs.get(0)); + } + + @Test public void testMapVolumeGroups() throws JsonProcessingException { org.onap.aai.domain.yang.VolumeGroup expectedAAI = new org.onap.aai.domain.yang.VolumeGroup(); @@ -2055,8 +2094,7 @@ public class BBInputSetupTest { Map<ResourceKey, String> lookupKeyMap = prepareLookupKeyMap(); ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); - executeBB.setConfigurationResourceKeys(configResourceKeys); - executeBB.setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("AssignVrfConfigurationBB"); buildingBlock.setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); @@ -2236,8 +2274,7 @@ public class BBInputSetupTest { .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class); - executeBB.setConfigurationResourceKeys(configResourceKeys); - executeBB.setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()) .setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); @@ -2306,8 +2343,7 @@ public class BBInputSetupTest { requestDetails.getRequestParameters().setUserParams(null); ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class); - executeBB.setConfigurationResourceKeys(configResourceKeys); - executeBB.setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()) .setKey("ab153b6e-c364-44c0-bef6-1f2982117f04").setIsVirtualLink(false); @@ -2352,8 +2388,7 @@ public class BBInputSetupTest { requestDetails.getRequestParameters().setUserParams(null); ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class); - executeBB.setConfigurationResourceKeys(configResourceKeys); - executeBB.setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()) .setKey("ab153b6e-c364-44c0-bef6-1f2982117f04").setIsVirtualLink(true); @@ -2399,8 +2434,7 @@ public class BBInputSetupTest { requestDetails.getRequestParameters().setUserParams(null); ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class); - executeBB.setConfigurationResourceKeys(configResourceKeys); - executeBB.setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName(otherFlowName).setKey("ab153b6e-c364-44c0-bef6-1f2982117f04") .setIsVirtualLink(true); @@ -2472,8 +2506,7 @@ public class BBInputSetupTest { aaiNetwork.setModelCustomizationId("modelCustId"); ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); - executeBB.setConfigurationResourceKeys(configResourceKeys); - executeBB.setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("DeleteNetworkBB").setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); @@ -2524,8 +2557,7 @@ public class BBInputSetupTest { aaiVnf.setModelCustomizationId("modelCustId"); ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); - executeBB.setConfigurationResourceKeys(configResourceKeys); - executeBB.setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("ControllerExecutionBB").setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); buildingBlock.setBpmnScope("VNF"); @@ -2577,8 +2609,7 @@ public class BBInputSetupTest { aaiVnf.setModelCustomizationId("modelCustId"); ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); - executeBB.setConfigurationResourceKeys(configResourceKeys); - executeBB.setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("ActivateVnfBB").setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); @@ -2634,8 +2665,7 @@ public class BBInputSetupTest { aaiVfModule.setModelCustomizationId("modelCustId"); ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); - executeBB.setConfigurationResourceKeys(configResourceKeys); - executeBB.setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("ControllerExecutionBB").setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); buildingBlock.setBpmnScope("VfModule"); @@ -2695,8 +2725,7 @@ public class BBInputSetupTest { aaiVfModule.setModelCustomizationId("modelCustId"); ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); - executeBB.setConfigurationResourceKeys(configResourceKeys); - executeBB.setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("UnassignVfModuleBB").setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); @@ -2757,8 +2786,7 @@ public class BBInputSetupTest { aaiVolumeGroup.setModelCustomizationId("modelCustId"); ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); - executeBB.setConfigurationResourceKeys(configResourceKeys); - executeBB.setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("UnassignVolumeGroupBB").setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); @@ -2824,8 +2852,7 @@ public class BBInputSetupTest { aaiConfiguration.setModelCustomizationId("modelCustId"); ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); - executeBB.setConfigurationResourceKeys(configResourceKeys); - executeBB.setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("ActivateFabricConfigurationBB").setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); @@ -2893,8 +2920,7 @@ public class BBInputSetupTest { @Test public void testGetVnfId() { String expected = "vnfId"; - ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock(); - executeBB.setRequestId("requestId"); + ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock().setRequestId("requestId"); Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); InfraActiveRequests request = new InfraActiveRequests(); request.setVnfId(expected); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java index bac29150c1..ee47b514d1 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java @@ -58,8 +58,7 @@ public class ExecuteBuildingBlockRainyDayTest extends BaseTest { vnf = setGenericVnf(); BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName("AssignServiceInstanceBB"); - ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock(); - executeBuildingBlock.setBuildingBlock(buildingBlock); + ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock); delegateExecution.setVariable("gBBInput", gBBInput); delegateExecution.setVariable("WorkflowException", new WorkflowException("", 7000, "")); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PnfExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PnfExpected.json new file mode 100644 index 0000000000..460f72aa31 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PnfExpected.json @@ -0,0 +1,8 @@ +{ + "pnf-id":"pnfId", + "pnf-name":"pnfName", + "nf-role":"gNB", + "orchestration-status":"INVENTORIED", + "cloud-region":null, + "model-info-pnf":null +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiPnfInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiPnfInput.json new file mode 100644 index 0000000000..da0039c923 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiPnfInput.json @@ -0,0 +1,38 @@ +{ + "pnfName":"pnfName", + "pnfName2":null, + "selflink":null, + "pnfName2Source":null, + "pnfId":"pnfId", + "nfNamingCode":null, + "equipType":null, + "equipVendor":null, + "equipModel":null, + "managementOption":null, + "orchestrationStatus":"INVENTORIED", + "ipaddressV4Oam":null, + "swVersion":null, + "inMaint":null, + "frameId":null, + "serialNumber":null, + "ipaddressV4Loopback0":null, + "ipaddressV6Loopback0":null, + "ipaddressV4Aim":null, + "ipaddressV6Aim":null, + "ipaddressV6Oam":null, + "invStatus":null, + "resourceVersion":null, + "provStatus":null, + "nfRole":"gNB", + "adminStatus":null, + "operationalStatus":null, + "modelCustomizationId":null, + "modelInvariantId":null, + "modelVersionId":null, + "pnfIpv4Address":null, + "pnfIpv6Address":null, + "softwareVersions":null, + "relationshipList":null, + "lagInterfaces":null, + "vrfs":null +}
\ No newline at end of file |