Search in sources :

Example 1 with Platform

use of org.onap.so.bpmn.servicedecomposition.bbobjects.Platform in project so by onap.

the class AAICreateTasks method createPlatformVnf.

protected void createPlatformVnf(GenericVnf vnf) {
    Platform platform = vnf.getPlatform();
    if (Strings.isNullOrEmpty(platform.getPlatformName())) {
        logger.debug("PlatformName is null in input. Skipping create platform...");
    } else {
        List<String> platforms = splitCDL(platform.getPlatformName());
        platforms.stream().forEach(platformName -> aaiVnfResources.createPlatformandConnectVnf(new Platform(platformName), vnf));
    }
}
Also used : Platform(org.onap.so.bpmn.servicedecomposition.bbobjects.Platform)

Example 2 with Platform

use of org.onap.so.bpmn.servicedecomposition.bbobjects.Platform in project so by onap.

the class BuildingBlockTestDataSetup method buildGenericVnf.

public GenericVnf buildGenericVnf() {
    genericVnfCounter++;
    GenericVnf genericVnf = new GenericVnf();
    genericVnf.setVnfId("testVnfId" + genericVnfCounter);
    genericVnf.setVnfName("testVnfName" + genericVnfCounter);
    genericVnf.setVnfType("testVnfType" + genericVnfCounter);
    Platform platform = new Platform();
    platform.setPlatformName("testPlatformName");
    genericVnf.setPlatform(platform);
    LineOfBusiness lob = new LineOfBusiness();
    lob.setLineOfBusinessName("testLineOfBusinessName");
    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("testModelInstanceName" + genericVnfCounter);
    genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
    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) LineOfBusiness(org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness)

Example 3 with Platform

use of org.onap.so.bpmn.servicedecomposition.bbobjects.Platform in project so by onap.

the class BBInputSetupTest method testPopulateGenericVnfReplace.

@Test
public void testPopulateGenericVnfReplace() 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();
    String resourceId = "123";
    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().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()).setApplicationId(applicationId).setIsReplace(true).build();
    SPY_bbInputSetup.populateGenericVnf(parameter);
    assertEquals("my-test-uuid", 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) 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 4 with Platform

use of org.onap.so.bpmn.servicedecomposition.bbobjects.Platform in project so by onap.

the class BBInputSetupTest method testPopulateGenericVnfWhereVnfTypeIsNull.

@Test
public void testPopulateGenericVnfWhereVnfTypeIsNull() 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 = null;
    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();
    Platform expectedPlatform = new Platform();
    LineOfBusiness expectedLineOfBusiness = new LineOfBusiness();
    String resourceId = "123";
    String applicationId = "applicationId";
    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()).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);
    org.onap.aai.domain.yang.GenericVnf vnf2AAI = new org.onap.aai.domain.yang.GenericVnf();
    vnfAAI.setModelCustomizationId("modelCustId2");
    doReturn(vnf2AAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf2.getVnfId());
    doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf2, modelInfo, service);
    doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
    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(1)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service);
}
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) AAIFluentTypeBuilder(org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) 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 5 with Platform

use of org.onap.so.bpmn.servicedecomposition.bbobjects.Platform in project so by onap.

the class BBInputSetupTest method testCreateGenericVnf.

@Test
public void testCreateGenericVnf() {
    String vnfId = "vnfId";
    String instanceName = "vnfName";
    String vnfType = "vnfType";
    String platformName = "platformName";
    String lineOfBusinessName = "lineOfBusinessName";
    String productFamilyId = "productFamilyId";
    String applicationId = "applicationId";
    Platform platform = new Platform();
    platform.setPlatformName(platformName);
    LineOfBusiness lineOfBusiness = new LineOfBusiness();
    lineOfBusiness.setLineOfBusinessName(lineOfBusinessName);
    Map<String, String> cloudParams = new HashMap<>();
    cloudParams.put("param1", "param1Value");
    GenericVnf expected = new GenericVnf();
    expected.setVnfId(vnfId);
    expected.setVnfName(instanceName);
    expected.setVnfType(vnfType);
    expected.setCloudParams(cloudParams);
    expected.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
    expected.setPlatform(platform);
    expected.setLineOfBusiness(lineOfBusiness);
    expected.setProvStatus("PREPROV");
    expected.setServiceId(productFamilyId);
    expected.setApplicationId(applicationId);
    Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
    List<Map<String, String>> instanceParams = new ArrayList<>();
    instanceParams.add(cloudParams);
    org.onap.so.serviceinstancebeans.Platform requestPlatform = new org.onap.so.serviceinstancebeans.Platform();
    platform.setPlatformName(platformName);
    org.onap.so.serviceinstancebeans.LineOfBusiness requestLineOfBusiness = new org.onap.so.serviceinstancebeans.LineOfBusiness();
    lineOfBusiness.setLineOfBusinessName(lineOfBusinessName);
    doReturn(platform).when(bbInputSetupMapperLayer).mapRequestPlatform(requestPlatform);
    doReturn(lineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(requestLineOfBusiness);
    GenericVnf actual = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, requestPlatform, requestLineOfBusiness, vnfId, vnfType, instanceParams, productFamilyId, applicationId);
    assertThat(actual, sameBeanAs(expected));
    assertEquals("LookupKeyMap is populated", vnfId, lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID));
    expected.getCloudParams().clear();
    actual = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, requestPlatform, requestLineOfBusiness, vnfId, vnfType, null, productFamilyId, applicationId);
    assertThat(actual, sameBeanAs(expected));
}
Also used : 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) 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

Platform (org.onap.so.bpmn.servicedecomposition.bbobjects.Platform)16 Test (org.junit.Test)10 LineOfBusiness (org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness)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 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)2