Search in sources :

Example 6 with Platform

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

the class BBInputSetupTest method testMapPlatform.

@Test
public void testMapPlatform() throws JsonProcessingException {
    org.onap.aai.domain.yang.Platform expectedAAI = new org.onap.aai.domain.yang.Platform();
    Platform expected = new Platform();
    AAIResultWrapper vnfWrapper = new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
    doReturn(expected).when(bbInputSetupMapperLayer).mapAAIPlatform(isA(org.onap.aai.domain.yang.Platform.class));
    GenericVnf vnf = new GenericVnf();
    SPY_bbInputSetup.mapPlatform(Arrays.asList(new AAIResultWrapper[] { vnfWrapper }), vnf);
    assertEquals(expected, vnf.getPlatform());
}
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) AAICommonObjectMapperProvider(org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider) AAIResultWrapper(org.onap.aaiclient.client.aai.entities.AAIResultWrapper) Test(org.junit.Test)

Example 7 with Platform

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

the class BBInputSetupMapperLayerTest method testSetPlatformAndLOB.

@Test
public void testSetPlatformAndLOB() throws IOException {
    ServiceInstance expected = mapper.readValue(new File(RESOURCE_PATH + "ServiceInstance_aaiPlatformAndLOBToSI.json"), ServiceInstance.class);
    Map<ResourceKey, String> resourcesToBeOrchestrated = new HashMap<>();
    resourcesToBeOrchestrated.put(ResourceKey.GENERIC_VNF_ID, "vnfId");
    Platform platformMSO = new Platform();
    platformMSO.setPlatformName("platformName");
    LineOfBusiness lineOfBusinessMSO = new LineOfBusiness();
    lineOfBusinessMSO.setLineOfBusinessName("lineOfBusinessName");
    ServiceInstance actual = mapper.readValue(new File(RESOURCE_PATH + "ServiceInstanceAAIPlatformAndLOBInput.json"), ServiceInstance.class);
    bbInputSetupMapperLayer.setPlatformAndLOBIntoServiceInstance(platformMSO, lineOfBusinessMSO, actual, resourcesToBeOrchestrated);
    assertThat(actual, sameBeanAs(expected));
}
Also used : Platform(org.onap.so.bpmn.servicedecomposition.bbobjects.Platform) HashMap(java.util.HashMap) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) LineOfBusiness(org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness) File(java.io.File) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) Test(org.junit.Test)

Example 8 with Platform

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

the class BBInputSetup method mapPlatform.

protected void mapPlatform(List<AAIResultWrapper> platforms, GenericVnf genericVnf) {
    if (!platforms.isEmpty()) {
        AAIResultWrapper platformWrapper = platforms.get(0);
        Optional<org.onap.aai.domain.yang.Platform> aaiPlatformOp = platformWrapper.asBean(org.onap.aai.domain.yang.Platform.class);
        if (aaiPlatformOp.isPresent()) {
            Platform platform = this.mapperLayer.mapAAIPlatform(aaiPlatformOp.get());
            genericVnf.setPlatform(platform);
        }
    }
}
Also used : Platform(org.onap.so.bpmn.servicedecomposition.bbobjects.Platform) AAIResultWrapper(org.onap.aaiclient.client.aai.entities.AAIResultWrapper)

Example 9 with Platform

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

the class AAICreateTasks method createPlatformNetwork.

protected void createPlatformNetwork(L3Network network) {
    Platform platform = network.getPlatform();
    if (platform != null) {
        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 -> aaiNetworkResources.createPlatformAndConnectNetwork(new Platform(platformName), network));
        }
    }
}
Also used : Platform(org.onap.so.bpmn.servicedecomposition.bbobjects.Platform)

Example 10 with Platform

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

the class AAIVnfResourcesTest method createPlatformandConnectVnfTest.

@Test
public void createPlatformandConnectVnfTest() {
    Platform platform = new Platform();
    platform.setPlatformName("a123");
    doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
    doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class));
    aaiVnfResources.createPlatformandConnectVnf(platform, genericVnf);
    verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), isA(AAIResourceUri.class));
}
Also used : Platform(org.onap.so.bpmn.servicedecomposition.bbobjects.Platform) Optional(java.util.Optional) AAIResourceUri(org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri) 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