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());
}
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));
}
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);
}
}
}
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));
}
}
}
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));
}
Aggregations