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
.getAAIServiceInstanceByName(requestDetails.getRequestInfo().getInstanceName(), customer);
}
if (serviceInstanceId != null && serviceInstanceAAI == null) {
- serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId);
+ if(customer != null && customer.getServiceSubscription() != null) {
+ serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(),
+ customer.getServiceSubscription().getServiceType(), serviceInstanceId);
+ } else {
+ serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId);
+ }
}
if (serviceInstanceAAI != null) {
lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId);