Search in sources :

Example 1 with Complex

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());
}
Also used : CustomQuery(org.onap.aaiclient.client.aai.entities.CustomQuery) Complex(org.onap.aai.domain.yang.Complex) Test(org.junit.Test)

Example 2 with Complex

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);
    }
}
Also used : CloudRegion(org.onap.aai.domain.yang.CloudRegion) AAIResourceUri(org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri) Complex(org.onap.aai.domain.yang.Complex)

Aggregations

Complex (org.onap.aai.domain.yang.Complex)2 Test (org.junit.Test)1 CloudRegion (org.onap.aai.domain.yang.CloudRegion)1 CustomQuery (org.onap.aaiclient.client.aai.entities.CustomQuery)1 AAIResourceUri (org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri)1