use of org.onap.aai.domain.yang.Complex in project so by onap.
the class AAIQueryClientTest method querySingleResourceTest.
@Test
public void querySingleResourceTest() throws IOException {
doReturn(getJson("single-query-result.json")).when(aaiQueryClient).query(eq(Format.RESOURCE_AND_URL), any(CustomQuery.class));
List<Complex> result = aaiQueryClient.querySingleResource(new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(Types.COMPLEX.getFragment("test")))), Complex.class);
assertEquals(2, result.size());
assertEquals("complex-id-15100-jc689q2", result.get(1).getPhysicalLocationId());
}
use of org.onap.aai.domain.yang.Complex in project so by onap.
the class CloudRestImpl method createCloudRegionInAAI.
protected void createCloudRegionInAAI(CloudSite cloudSite) {
try {
CloudRegion cloudRegion = mapCloudRegion(cloudSite);
Optional<Complex> complex = retrieveComplex(cloudSite);
if (complex.isPresent()) {
cloudRegion.setComplexName(complex.get().getComplexName());
}
AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getCloudRegionId()));
getAaiClient().createIfNotExists(cloudRegionURI, Optional.of(cloudRegion));
if (complex.isPresent()) {
AAIResourceUri complexURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().complex(cloudSite.getClli()));
getAaiClient().connect(cloudRegionURI, complexURI);
}
createCloudRegionNetworkTechnologyRelationship(cloudSite, cloudRegionURI);
} catch (Exception e) {
logger.error("Error creating cloud region in AAI", e);
throw new CloudException("Error creating cloud region in AAI: " + e.getMessage(), e);
}
}
Aggregations