use of org.onap.so.serviceinstancebeans.RelatedInstance in project so by onap.
the class RelatedInstancesValidation method validate.
@Override
public ValidationInformation validate(ValidationInformation info) throws ValidationException {
ServiceInstancesRequest sir = info.getSir();
Actions action = info.getAction();
int reqVersion = info.getReqVersion();
String requestScope = info.getRequestScope();
String serviceInstanceType = null;
String networkType = null;
String vnfType = null;
String vfModuleType = null;
String vfModuleModelName = null;
ModelInfo modelInfo = info.getSir().getRequestDetails().getModelInfo();
RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList();
String serviceModelName = null;
String vnfModelName = null;
String asdcServiceModelVersion = null;
String volumeGroupId = null;
boolean isRelatedServiceInstancePresent = false;
boolean isRelatedVnfInstancePresent = false;
boolean isSourceVnfPresent = false;
boolean isDestinationVnfPresent = false;
boolean isConnectionPointPresent = false;
if (requestScope.equalsIgnoreCase(ModelType.service.name())) {
serviceInstanceType = modelInfo.getModelName();
info.setServiceInstanceType(serviceInstanceType);
}
if (requestScope.equalsIgnoreCase(ModelType.network.name())) {
networkType = modelInfo.getModelName();
info.setNetworkType(networkType);
}
if (instanceList != null) {
for (RelatedInstanceList relatedInstanceList : instanceList) {
RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo();
if (relatedInstanceModelInfo == null) {
throw new ValidationException("modelInfo in relatedInstance");
}
if (relatedInstanceModelInfo.getModelType() == null) {
throw new ValidationException("modelType in relatedInstance");
}
if (empty(relatedInstance.getInstanceName()) && ModelType.pnf.equals(relatedInstanceModelInfo.getModelType())) {
throw new ValidationException("instanceName in relatedInstance for pnf modelType");
}
if (!empty(relatedInstance.getInstanceName())) {
if (!relatedInstance.getInstanceName().matches(Constants.VALID_INSTANCE_NAME_FORMAT)) {
throw new ValidationException("instanceName format in relatedInstance");
}
}
if (empty(relatedInstance.getInstanceId()) && !ModelType.pnf.equals(relatedInstanceModelInfo.getModelType())) {
throw new ValidationException("instanceId in relatedInstance");
}
if (!empty(relatedInstance.getInstanceId()) && !UUIDChecker.isValidUUID(relatedInstance.getInstanceId())) {
throw new ValidationException("instanceId format in relatedInstance");
}
if (empty(relatedInstanceModelInfo.getModelVersionId()) && requestScope.equals(ModelType.instanceGroup.toString()) && relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
throw new ValidationException("modelVersionId in relatedInstance", true);
}
if (requestScope.equalsIgnoreCase(ModelType.instanceGroup.toString()) && relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
isRelatedServiceInstancePresent = true;
}
if (requestScope.equalsIgnoreCase(ModelType.service.name())) {
if (empty(relatedInstance.getInstanceName()) && ModelType.vpnBinding.equals(relatedInstanceModelInfo.getModelType())) {
throw new ValidationException("instanceName in relatedInstance for vpnBinding modelType", true);
}
if (empty(relatedInstance.getInstanceName()) && ModelType.network.equals(relatedInstanceModelInfo.getModelType())) {
throw new ValidationException("instanceName in relatedInstance for network modelType", true);
}
}
if (action != Action.deleteInstance && !requestScope.equalsIgnoreCase(ModelType.instanceGroup.toString())) {
if (!(relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup) || relatedInstanceModelInfo.getModelType().equals(ModelType.connectionPoint) || relatedInstanceModelInfo.getModelType().equals(ModelType.pnf) || relatedInstanceModelInfo.getModelType().equals(ModelType.networkInstanceGroup) || relatedInstanceModelInfo.getModelType().equals(ModelType.network) || relatedInstanceModelInfo.getModelType().equals(ModelType.vpnBinding))) {
if (empty(relatedInstanceModelInfo.getModelInvariantId())) {
throw new ValidationException("modelInvariantId in relatedInstance");
} else if (reqVersion >= 4 && empty(relatedInstanceModelInfo.getModelVersionId())) {
throw new ValidationException("modelVersionId in relatedInstance");
} else if (empty(relatedInstanceModelInfo.getModelName())) {
throw new ValidationException("modelName in relatedInstance");
} else if (empty(relatedInstanceModelInfo.getModelVersion())) {
throw new ValidationException("modelVersion in relatedInstance");
}
}
if (!empty(relatedInstanceModelInfo.getModelInvariantId()) && !UUIDChecker.isValidUUID(relatedInstanceModelInfo.getModelInvariantId())) {
throw new ValidationException("modelInvariantId format in relatedInstance");
}
if (ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
if (InstanceDirection.source.equals(relatedInstance.getInstanceDirection()) && relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)) {
isSourceVnfPresent = true;
} else if (InstanceDirection.destination.equals(relatedInstance.getInstanceDirection()) && (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf) || (relatedInstanceModelInfo.getModelType().equals(ModelType.pnf)))) {
isDestinationVnfPresent = true;
}
}
if (ModelType.connectionPoint.equals(relatedInstanceModelInfo.getModelType()) && ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
isConnectionPointPresent = true;
}
}
if (empty(relatedInstanceModelInfo.getModelCustomizationName()) && relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)) {
if (reqVersion >= 4 && empty(relatedInstanceModelInfo.getModelCustomizationId()) && action != Action.deleteInstance) {
throw new ValidationException("modelCustomizationName or modelCustomizationId in relatedInstance of vnf");
}
}
if (relatedInstanceModelInfo.getModelType().equals(ModelType.service) && !(requestScope.equalsIgnoreCase(ModelType.instanceGroup.toString()) && action == Action.createInstance)) {
isRelatedServiceInstancePresent = true;
if (!relatedInstance.getInstanceId().equals(sir.getServiceInstanceId())) {
throw new ValidationException("serviceInstanceId matching the serviceInstanceId in request URI");
}
serviceModelName = relatedInstanceModelInfo.getModelName();
asdcServiceModelVersion = relatedInstanceModelInfo.getModelVersion();
} else if (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf) && !(ModelType.configuration.name().equalsIgnoreCase(requestScope))) {
isRelatedVnfInstancePresent = true;
if (!relatedInstance.getInstanceId().equals(sir.getVnfInstanceId())) {
throw new ValidationException("vnfInstanceId matching the vnfInstanceId in request URI");
}
vnfModelName = relatedInstanceModelInfo.getModelCustomizationName();
} else if (relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) {
volumeGroupId = relatedInstance.getInstanceId();
}
}
if (action == Action.createInstance && ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
if (!isSourceVnfPresent) {
throw new ValidationException("source vnf relatedInstance for Port Configuration");
}
if (!isDestinationVnfPresent) {
throw new ValidationException("destination vnf relatedInstance for Port Configuration");
}
}
if ((action == Action.enablePort || action == Action.disablePort) && ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
if (!isConnectionPointPresent) {
throw new ValidationException("connectionPoint relatedInstance for Port Configuration");
}
}
if (requestScope.equals(ModelType.instanceGroup.toString())) {
if (!isRelatedServiceInstancePresent) {
throw new ValidationException("related service instance for instanceGroup request", true);
}
}
if (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name())) {
if (!isRelatedServiceInstancePresent) {
throw new ValidationException("related service instance for volumeGroup request");
}
if (!isRelatedVnfInstancePresent) {
throw new ValidationException("related vnf instance for volumeGroup request");
}
serviceInstanceType = serviceModelName;
vnfType = serviceModelName + "/" + vnfModelName;
info.setServiceInstanceType(serviceInstanceType);
info.setVnfType(vnfType);
} else if (requestScope.equalsIgnoreCase(ModelType.vfModule.name())) {
if (!isRelatedServiceInstancePresent) {
throw new ValidationException("related service instance for vfModule request");
}
if (!isRelatedVnfInstancePresent) {
throw new ValidationException("related vnf instance for vfModule request");
}
vfModuleModelName = modelInfo.getModelName();
serviceInstanceType = serviceModelName;
vnfType = serviceModelName + "/" + vnfModelName;
vfModuleType = vnfType + "::" + vfModuleModelName;
sir.setVolumeGroupInstanceId(volumeGroupId);
info.setVfModuleModelName(vfModuleModelName);
info.setVnfType(vnfType);
info.setServiceInstanceType(serviceInstanceType);
info.setVfModuleType(vfModuleType);
} else if (requestScope.equalsIgnoreCase(ModelType.vnf.name())) {
if (!isRelatedServiceInstancePresent) {
throw new ValidationException("related service instance for vnf request");
}
vnfType = serviceModelName + "/" + sir.getRequestDetails().getModelInfo().getModelCustomizationName();
info.setVnfType(vnfType);
}
} else if (((requestScope.equalsIgnoreCase(ModelType.vnf.name()) || requestScope.equalsIgnoreCase(ModelType.volumeGroup.name()) || requestScope.equalsIgnoreCase(ModelType.vfModule.name()) || requestScope.equalsIgnoreCase(ModelType.configuration.name())) && (action == Action.createInstance || action == Action.enablePort || action == Action.disablePort)) || (reqVersion >= 4 && (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name()) || requestScope.equalsIgnoreCase(ModelType.vfModule.name())) && action == Action.updateInstance || (requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.scaleOut)) || (requestScope.equalsIgnoreCase(ModelType.service.name()) && (action.equals(Action.addRelationships) || action.equals(Action.removeRelationships)))) {
logger.debug("related instance exception");
throw new ValidationException("related instances");
}
if (instanceList == null && requestScope.equalsIgnoreCase(ModelType.instanceGroup.toString()) && action == Action.createInstance) {
throw new ValidationException("relatedInstanceList", true);
}
info.setVfModuleModelName(vfModuleModelName);
info.setServiceInstanceType(serviceInstanceType);
info.setVnfType(vnfType);
info.setAsdcServiceModelVersion(asdcServiceModelVersion);
info.setVfModuleType(vfModuleType);
return info;
}
use of org.onap.so.serviceinstancebeans.RelatedInstance in project so by onap.
the class WorkflowAction method getConfigBuildingBlocks.
protected List<ExecuteBuildingBlock> getConfigBuildingBlocks(ConfigBuildingBlocksDataObject dataObj) throws AAIEntityNotFoundException, VnfcMultipleRelationshipException {
List<ExecuteBuildingBlock> flowsToExecuteConfigs = new ArrayList<>();
List<OrchestrationFlow> result = dataObj.getOrchFlows().stream().filter(item -> item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList());
String vnfId = dataObj.getWorkflowResourceIds().getVnfId();
String vfModuleId = dataObj.getWorkflowResourceIds().getVfModuleId();
String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
String vfModuleCustomizationUUID;
org.onap.aai.domain.yang.VfModule aaiVfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId);
if (aaiVfModule == null) {
logger.error("No matching VfModule is found in Generic-Vnf in AAI for vnfId: {} and vfModuleId : {}", vnfId, vfModuleId);
throw new AAIEntityNotFoundException("No matching VfModule is found in Generic-Vnf in AAI for vnfId: " + vnfId + " and vfModuleId : " + vfModuleId);
} else {
vfModuleCustomizationUUID = aaiVfModule.getModelCustomizationId();
}
String replaceVfModuleCustomizationUUID = "";
String replaceVnfModuleCustomizationUUID = "";
boolean isReplace = false;
if (dataObj.getRequestAction().equalsIgnoreCase("replaceInstance") || dataObj.getRequestAction().equalsIgnoreCase("replaceInstanceRetainAssignments")) {
for (RelatedInstanceList relatedInstList : dataObj.getRequestDetails().getRelatedInstanceList()) {
RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
replaceVnfModuleCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
}
}
replaceVfModuleCustomizationUUID = dataObj.getRequestDetails().getModelInfo().getModelCustomizationId();
isReplace = true;
}
List<org.onap.aai.domain.yang.Vnfc> vnfcs = getRelatedResourcesInVfModule(vnfId, vfModuleId, org.onap.aai.domain.yang.Vnfc.class, Types.VNFC);
for (org.onap.aai.domain.yang.Vnfc vnfc : vnfcs) {
WorkflowResourceIds workflowIdsCopy = SerializationUtils.clone(dataObj.getWorkflowResourceIds());
org.onap.aai.domain.yang.Configuration configuration = getRelatedResourcesInVnfc(vnfc, org.onap.aai.domain.yang.Configuration.class, Types.CONFIGURATION);
if (configuration == null) {
logger.warn(String.format("No configuration found for VNFC %s in AAI", vnfc.getVnfcName()));
continue;
}
workflowIdsCopy.setConfigurationId(configuration.getConfigurationId());
for (OrchestrationFlow orchFlow : result) {
if (!isReplace || (isReplace && (orchFlow.getFlowName().contains("Delete")))) {
if (!isReplace) {
dataObj.getResourceKey().setVfModuleCustomizationId(vfModuleCustomizationUUID);
dataObj.getResourceKey().setVnfCustomizationId(vnfCustomizationUUID);
} else {
if (orchFlow.getFlowName().contains("Delete")) {
dataObj.getResourceKey().setVfModuleCustomizationId(vfModuleCustomizationUUID);
dataObj.getResourceKey().setVnfCustomizationId(vnfCustomizationUUID);
} else {
dataObj.getResourceKey().setVfModuleCustomizationId(replaceVfModuleCustomizationUUID);
dataObj.getResourceKey().setVnfCustomizationId(replaceVnfModuleCustomizationUUID);
}
}
dataObj.getResourceKey().setCvnfModuleCustomizationId(vnfc.getModelCustomizationId());
String vnfcName = vnfc.getVnfcName();
if (vnfcName == null || vnfcName.isEmpty()) {
buildAndThrowException(dataObj.getExecution(), "Exception in create execution list " + ": VnfcName does not exist or is null while there is a configuration for the vfModule", new Exception("Vnfc and Configuration do not match"));
}
ExecuteBuildingBlock ebb = executeBuildingBlockBuilder.buildExecuteBuildingBlock(orchFlow, dataObj.getRequestId(), dataObj.getResourceKey(), dataObj.getApiVersion(), dataObj.getResourceId(), dataObj.getRequestAction(), dataObj.isaLaCarte(), dataObj.getVnfType(), workflowIdsCopy, dataObj.getRequestDetails(), false, null, vnfcName, true, null);
flowsToExecuteConfigs.add(ebb);
}
}
}
return flowsToExecuteConfigs;
}
use of org.onap.so.serviceinstancebeans.RelatedInstance in project so by onap.
the class ServiceEBBLoader method traverseCatalogDbService.
public void traverseCatalogDbService(DelegateExecution execution, ServiceInstancesRequest sIRequest, List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds) throws JsonProcessingException, VrfBondingServiceException {
String modelUUID = sIRequest.getRequestDetails().getModelInfo().getModelVersionId();
org.onap.so.db.catalog.beans.Service service = catalogDbClient.getServiceByID(modelUUID);
if (service == null) {
buildAndThrowException(execution, "Could not find the service model in catalog db.");
} else {
Resource serviceResource = new Resource(WorkflowType.SERVICE, service.getModelUUID(), false, null);
resourceList.add(serviceResource);
RelatedInstance relatedVpnBinding = bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.vpnBinding);
RelatedInstance relatedLocalNetwork = bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.network);
if (relatedVpnBinding != null && relatedLocalNetwork != null) {
traverseVrfConfiguration(aaiResourceIds, resourceList, serviceResource, service, relatedVpnBinding, relatedLocalNetwork);
} else {
traverseNetworkCollection(execution, resourceList, serviceResource, service);
}
}
}
use of org.onap.so.serviceinstancebeans.RelatedInstance in project so by onap.
the class BBInputSetupTest method testPopulateVolumeGroup.
@Test
public void testPopulateVolumeGroup() throws Exception {
RequestDetails requestDetails = new RequestDetails();
RelatedInstanceList ril = new RelatedInstanceList();
RelatedInstance ri = new RelatedInstance();
ModelInfo mi = new ModelInfo();
mi.setModelType(ModelType.vnf);
mi.setModelCustomizationUuid("vnfModelCustomizationUUID");
mi.setModelCustomizationId("vnfModelCustomizationUUID");
ri.setModelInfo(mi);
ril.setRelatedInstance(ri);
requestDetails.setRelatedInstanceList(new RelatedInstanceList[] { ril });
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelCustomizationId("volumeGroupCustId");
RequestInfo reqInfo = new RequestInfo();
reqInfo.setInstanceName("volumeGroupName");
requestDetails.setModelInfo(modelInfo);
requestDetails.setRequestInfo(reqInfo);
ServiceInstance serviceInstance = new ServiceInstance();
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("genericVnfId");
VolumeGroup vg = new VolumeGroup();
vg.setVolumeGroupName("volumeGroupName");
vg.setVolumeGroupId("volumeGroupId");
vg.setModelInfoVfModule(new ModelInfoVfModule());
vg.getModelInfoVfModule().setModelCustomizationUUID("volumeGroupCustId");
vnf.getVolumeGroups().add(vg);
serviceInstance.getVnfs().add(vnf);
Service service = mapper.readValue(new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class);
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId");
ServiceModel serviceModel = new ServiceModel();
serviceModel.setCurrentService(service);
String bbName = AssignFlows.VOLUME_GROUP.toString();
String resourceId = "123";
doNothing().when(SPY_bbInputSetup).mapCatalogVolumeGroup(isA(VolumeGroup.class), eq(modelInfo), eq(service), eq("vnfModelCustomizationUUID"));
org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = new org.onap.aai.domain.yang.GenericVnf();
aaiGenericVnf.setModelCustomizationId("vnfModelCustomizationUUID");
doReturn(aaiGenericVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId");
BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID).setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setRequestDetails(requestDetails).setInstanceName(reqInfo.getInstanceName()).setServiceModel(serviceModel).build();
SPY_bbInputSetup.populateVolumeGroup(parameter);
verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(eq(vg), isA(ModelInfo.class), eq(service), eq("vnfModelCustomizationUUID"));
vnf.getVolumeGroups().clear();
SPY_bbInputSetup.populateVolumeGroup(parameter);
verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(vnf.getVolumeGroups().get(0), modelInfo, service, "vnfModelCustomizationUUID");
}
use of org.onap.so.serviceinstancebeans.RelatedInstance in project so by onap.
the class BBInputSetupTest method testPopulateVfModuleIsReplace.
@Test
public void testPopulateVfModuleIsReplace() throws Exception {
String vnfId = "vnfId";
String vfModuleId = "vfModuleId";
String volumeGroupId = "volumeGroupId";
String vfModuleCustomizationId = "vfModuleCustomizationId";
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelCustomizationId(vfModuleCustomizationId);
Service currentService = new Service();
Service newService = new Service();
ServiceModel serviceModel = new ServiceModel();
serviceModel.setCurrentService(currentService);
currentService.setModelUUID("currentUUID");
serviceModel.setNewService(newService);
currentService.setModelUUID("newUUID");
String bbName = AssignFlows.VF_MODULE.toString();
ServiceInstance serviceInstance = new ServiceInstance();
GenericVnf vnf = new GenericVnf();
vnf.setVnfId(vnfId);
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId(volumeGroupId);
vnf.getVolumeGroups().add(volumeGroup);
serviceInstance.getVnfs().add(vnf);
VfModule vfModule1 = new VfModule();
vfModule1.setVfModuleId("vfModuleId1");
VfModule vfModule2 = new VfModule();
vfModule2.setVfModuleId("vfModuleId2");
vnf.getVfModules().add(vfModule1);
vnf.getVfModules().add(vfModule2);
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId);
lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModuleId);
String resourceId = vfModuleId;
RelatedInstanceList[] relatedInstanceList = new RelatedInstanceList[1];
RelatedInstanceList relatedInstanceListObj = new RelatedInstanceList();
RelatedInstance relatedInstance = new RelatedInstance();
relatedInstance.setInstanceId(vnfId);
ModelInfo vnfModelInfo = new ModelInfo();
vnfModelInfo.setModelCustomizationId("vnfCustomizationId");
vnfModelInfo.setModelType(ModelType.vnf);
relatedInstance.setModelInfo(vnfModelInfo);
relatedInstanceListObj.setRelatedInstance(relatedInstance);
relatedInstanceList[0] = relatedInstanceListObj;
String instanceName = "vfModuleName";
List<Map<String, String>> instanceParams = null;
CloudConfiguration cloudConfiguration = new CloudConfiguration();
org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf();
vnfAAI.setModelCustomizationId("vnfModelCustId");
org.onap.aai.domain.yang.VolumeGroup volumeGroupAAI = new org.onap.aai.domain.yang.VolumeGroup();
volumeGroupAAI.setModelCustomizationId(vfModuleCustomizationId);
org.onap.aai.domain.yang.VfModule vfModuleAAI = new org.onap.aai.domain.yang.VfModule();
vfModuleAAI.setModelCustomizationId(vfModuleCustomizationId);
doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
doReturn(volumeGroupAAI).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(CLOUD_OWNER, cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
doReturn(vfModuleAAI).when(SPY_bbInputSetupUtils).getAAIVfModule(isA(String.class), isA(String.class));
doNothing().when(SPY_bbInputSetup).mapCatalogVnf(isA(GenericVnf.class), isA(ModelInfo.class), isA(Service.class));
doNothing().when(SPY_bbInputSetup).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), isA(Service.class), isA(String.class));
BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setModelInfo(modelInfo).setService(newService).setServiceInstance(serviceInstance).setBbName(bbName).setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setRelatedInstanceList(relatedInstanceList).setInstanceName(instanceName).setInstanceParams(instanceParams).setCloudConfiguration(cloudConfiguration).setIsReplace(true).setServiceModel(serviceModel).build();
SPY_bbInputSetup.populateVfModule(parameter);
verify(SPY_bbInputSetup, times(2)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), eq(serviceModel.getCurrentService()), isA(String.class));
verify(SPY_bbInputSetup, times(1)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), eq(serviceModel.getNewService()), isA(String.class));
assertEquals("Lookup Key Map populated with VfModule Id", vfModuleId, lookupKeyMap.get(ResourceKey.VF_MODULE_ID));
assertEquals("Lookup Key Map populated with VolumeGroup Id", volumeGroupId, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID));
}
Aggregations