Search in sources :

Example 11 with LineOfBusiness

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));
}
Also used : LineOfBusiness(org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness) File(java.io.File) Test(org.junit.Test)

Example 12 with LineOfBusiness

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));
}
Also used : LineOfBusiness(org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness) File(java.io.File) Test(org.junit.Test)

Example 13 with LineOfBusiness

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;
}
Also used : ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) Platform(org.onap.so.bpmn.servicedecomposition.bbobjects.Platform) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) License(org.onap.so.bpmn.servicedecomposition.generalobjects.License) ArrayList(java.util.ArrayList) LineOfBusiness(org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness)

Example 14 with LineOfBusiness

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());
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Platform(org.onap.so.bpmn.servicedecomposition.bbobjects.Platform) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) HashMap(java.util.HashMap) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) ServiceModel(org.onap.so.bpmn.servicedecomposition.entities.ServiceModel) Service(org.onap.so.db.catalog.beans.Service) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup) LineOfBusiness(org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness) File(java.io.File) Test(org.junit.Test)

Example 15 with LineOfBusiness

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));
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) Platform(org.onap.so.bpmn.servicedecomposition.bbobjects.Platform) HashMap(java.util.HashMap) AAIFluentTypeBuilder(org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder) ArrayList(java.util.ArrayList) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) LineOfBusiness(org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness) Map(java.util.Map) BaseBBInputSetupTestHelper.prepareLookupKeyMap(org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareLookupKeyMap) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

LineOfBusiness (org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness)15 Test (org.junit.Test)10 Platform (org.onap.so.bpmn.servicedecomposition.bbobjects.Platform)8 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)7 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)7 File (java.io.File)6 HashMap (java.util.HashMap)6 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)6 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)4 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)4 ArrayList (java.util.ArrayList)3 InstanceGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup)3 ModelInfoInstanceGroup (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup)3 Service (org.onap.so.db.catalog.beans.Service)3 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)3 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)3 Map (java.util.Map)2 AAIResultWrapper (org.onap.aaiclient.client.aai.entities.AAIResultWrapper)2 AAIFluentTypeBuilder (org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder)2 BaseBBInputSetupTestHelper.prepareLookupKeyMap (org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareLookupKeyMap)2