use of org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness in project so by onap.
the class BBInputSetupMapperLayerTest method testMapRequestLineOfBusiness.
@Test
public void testMapRequestLineOfBusiness() throws JsonParseException, JsonMappingException, IOException {
org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = mapper.readValue(new File(RESOURCE_PATH + "RequestLineOfBusinessInput.json"), org.onap.so.serviceinstancebeans.LineOfBusiness.class);
LineOfBusiness expectedLineOfBusiness = mapper.readValue(new File(RESOURCE_PATH + "LineOfBusinessExpected.json"), LineOfBusiness.class);
LineOfBusiness actualLineOfBusiness = bbInputSetupMapperLayer.mapRequestLineOfBusiness(lineOfBusiness);
assertThat(actualLineOfBusiness, sameBeanAs(expectedLineOfBusiness));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness in project so by onap.
the class BBInputSetupMapperLayerTest method testMapAAILineOfBusiness.
@Test
public void testMapAAILineOfBusiness() throws IOException {
LineOfBusiness expected = mapper.readValue(new File(RESOURCE_PATH + "LineOfBusiness.json"), LineOfBusiness.class);
org.onap.aai.domain.yang.LineOfBusiness lobAAI = new org.onap.aai.domain.yang.LineOfBusiness();
lobAAI.setLineOfBusinessName("lineOfBusinessName");
LineOfBusiness actual = bbInputSetupMapperLayer.mapAAILineOfBusiness(lobAAI);
assertThat(actual, sameBeanAs(expected));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness in project so by onap.
the class TestDataSetup method buildGenericVnf.
public GenericVnf buildGenericVnf() {
genericVnfCounter++;
GenericVnf genericVnf = new GenericVnf();
genericVnf.setVnfId("testVnfId" + genericVnfCounter);
genericVnf.setVnfName("testVnfName" + genericVnfCounter);
genericVnf.setVnfType("testVnfType" + genericVnfCounter);
genericVnf.setIpv4OamAddress("10.222.22.2");
Platform platform = new Platform();
platform.setPlatformName(" testPlatformName, testPlatformName2 , testPlatformName3 , testPlatformName4");
genericVnf.setPlatform(platform);
LineOfBusiness lob = new LineOfBusiness();
lob.setLineOfBusinessName(" testLineOfBusinessName , testLineOfBusinessName2, testLineOfBusinessName3, testLineOfBusinessName4");
genericVnf.setLineOfBusiness(lob);
ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
modelInfoGenericVnf.setModelName("testModelName" + genericVnfCounter);
modelInfoGenericVnf.setModelCustomizationUuid("testModelCustomizationUUID" + genericVnfCounter);
modelInfoGenericVnf.setModelInvariantUuid("testModelInvariantUUID" + genericVnfCounter);
modelInfoGenericVnf.setModelVersion("testModelVersion" + genericVnfCounter);
modelInfoGenericVnf.setModelUuid("testModelUUID" + genericVnfCounter);
modelInfoGenericVnf.setModelInstanceName("testInstanceName" + genericVnfCounter);
genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
License license = new License();
List<String> array = new ArrayList<String>();
array.add("testPoolUuid");
license.setEntitlementPoolUuids(array);
genericVnf.setLicense(license);
return genericVnf;
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness in project so by onap.
the class BBInputSetupTest method testPopulateGenericVnf.
@Test
public void testPopulateGenericVnf() throws JsonParseException, JsonMappingException, IOException {
org.onap.so.serviceinstancebeans.Platform platform = new org.onap.so.serviceinstancebeans.Platform();
org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = new org.onap.so.serviceinstancebeans.LineOfBusiness();
String instanceName = "vnfName";
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelType(ModelType.vnf);
ServiceInstance serviceInstance = new ServiceInstance();
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("genericVnfId");
vnf.setVnfName("vnfName");
serviceInstance.getVnfs().add(vnf);
String vnfType = "vnfType";
String applicationId = "applicationId";
RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetails_CreateVnf.json"), RequestDetails.class);
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");
String bbName = AssignFlows.VNF.toString();
ServiceModel serviceModel = new ServiceModel();
serviceModel.setCurrentService(service);
Platform expectedPlatform = new Platform();
LineOfBusiness expectedLineOfBusiness = new LineOfBusiness();
String resourceId = "123";
doReturn(expectedPlatform).when(bbInputSetupMapperLayer).mapRequestPlatform(platform);
doReturn(expectedLineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(lineOfBusiness);
org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf();
vnfAAI.setModelCustomizationId("modelCustId");
doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf, modelInfo, service);
org.onap.aai.domain.yang.InstanceGroup instanceGroupAAI = new org.onap.aai.domain.yang.InstanceGroup();
doReturn(instanceGroupAAI).when(SPY_bbInputSetupUtils).getAAIInstanceGroup(any());
org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup();
doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any());
BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID).setModelInfo(modelInfo).setInstanceName(instanceName).setPlatform(platform).setLineOfBusiness(lineOfBusiness).setService(service).setBbName(bbName).setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).setRelatedInstanceList(requestDetails.getRelatedInstanceList()).setResourceId(resourceId).setVnfType(vnfType).setProductFamilyId(requestDetails.getRequestInfo().getProductFamilyId()).setServiceModel(serviceModel).build();
SPY_bbInputSetup.populateGenericVnf(parameter);
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
SPY_bbInputSetup.populateGenericVnf(parameter);
verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service);
instanceName = "vnfName2";
GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
doNothing().when(SPY_bbInputSetup).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service);
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId2");
SPY_bbInputSetup.populateGenericVnf(parameter);
verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service);
verify(SPY_bbInputSetup, times(2)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
verify(SPY_bbInputSetup, times(2)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service);
assertEquals("modelCustId", modelInfo.getModelCustomizationUuid());
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness in project so by onap.
the class BBInputSetupTest method testCreateNetwork.
@Test
public void testCreateNetwork() {
String networkId = "networkId";
String instanceName = "networkName";
Map<String, String> cloudParams = new HashMap<>();
cloudParams.put("param1", "param1Value");
L3Network expected = new L3Network();
expected.setNetworkId(networkId);
expected.setNetworkName(instanceName);
expected.setCloudParams(cloudParams);
Platform platform = new Platform();
platform.setPlatformName("platformName");
expected.setPlatform(platform);
LineOfBusiness lineOfBusiness = new LineOfBusiness();
lineOfBusiness.setLineOfBusinessName("lineOfBusiness");
expected.setLineOfBusiness(lineOfBusiness);
expected.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
List<Map<String, String>> instanceParams = new ArrayList<>();
instanceParams.add(cloudParams);
org.onap.so.serviceinstancebeans.Platform platformRequest = new org.onap.so.serviceinstancebeans.Platform();
org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusinessRequest = new org.onap.so.serviceinstancebeans.LineOfBusiness();
lineOfBusinessRequest.setLineOfBusinessName("lineOfBusiness");
platformRequest.setPlatformName("platformName");
BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID).setPlatform(platformRequest).setLineOfBusiness(lineOfBusinessRequest).build();
L3Network actual = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, instanceParams, parameter);
assertThat(actual, sameBeanAs(expected));
assertEquals("LookupKeyMap is populated", networkId, lookupKeyMap.get(ResourceKey.NETWORK_ID));
expected.getCloudParams().clear();
actual = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, null, parameter);
assertThat(actual, sameBeanAs(expected));
}
Aggregations