Merge "fix lookup of si if customer exists"
authorSteve Smokowski <ss835w@att.com>
Wed, 12 Dec 2018 12:38:17 +0000 (12:38 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 12 Dec 2018 12:38:17 +0000 (12:38 +0000)
1  2 
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java

@@@ -609,27 -609,16 +609,27 @@@ public class BBInputSetup implements Ja
                        vnf = createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness,
                                        resourceId, generatedVnfType, instanceParams);
                        serviceInstance.getVnfs().add(vnf);
 +                      mapVnfcCollectionInstanceGroup(vnf, modelInfo, service);
                }
                if(vnf != null) {
                        mapCatalogVnf(vnf, modelInfo, service);
 -                      mapVnfcCollectionInstanceGroup(vnf, modelInfo, service);
 -                      if (instanceGroupId != null && instanceGroupModelInfo != null) {
 +                      if (instanceGroupId != null && instanceGroupModelInfo != null
 +                                      && instanceGroupModelInfo.getModelType().equals(ModelType.networkInstanceGroup)
 +                                      && !instanceGroupInList(vnf, instanceGroupId)) {
                                mapNetworkCollectionInstanceGroup(vnf, instanceGroupId);
                        }
                }
        }
  
 +      protected boolean instanceGroupInList(GenericVnf vnf, String instanceGroupId) {
 +              for(InstanceGroup instanceGroup : vnf.getInstanceGroups()) {
 +                      if(instanceGroup.getId() != null && instanceGroup.getId().equalsIgnoreCase(instanceGroupId)) {
 +                              return true;
 +                      }
 +              }
 +              return false;
 +      }
 +
        protected void mapVnfcCollectionInstanceGroup(GenericVnf genericVnf, ModelInfo modelInfo, Service service) {
                VnfResourceCustomization vnfResourceCustomization = getVnfResourceCustomizationFromService(modelInfo, service);
                if(vnfResourceCustomization != null) {
                        String serviceInstanceId, boolean aLaCarte, String bbName) throws Exception {
                ServiceInstance serviceInstance = this.getServiceInstanceHelper(requestDetails, customer, project, owningEntity,
                                lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName);
-               org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = this.bbInputSetupUtils
-                               .getAAIServiceInstanceById(serviceInstanceId);
+               org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = null;
+               if(customer != null && customer.getServiceSubscription() != null) {
+                       serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(), 
+                                       customer.getServiceSubscription().getServiceType(), serviceInstanceId);
+               } else {
+                       serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId);
+               }
                if (serviceInstanceAAI != null
                                && !serviceInstanceAAI.getModelVersionId().equalsIgnoreCase(service.getModelUUID())) {
                        Service tempService = this.bbInputSetupUtils