use of org.onap.aaiclient.client.graphinventory.entities.uri.Depth in project so by onap.
the class AAIQueryClientTest method testCreateClient.
@Test
public void testCreateClient() {
Depth depth = Depth.ZERO;
GraphInventorySubgraphType subgraph = GraphInventorySubgraphType.STAR;
aaiQueryClient.depth(depth);
aaiQueryClient.nodesOnly();
aaiQueryClient.subgraph(subgraph);
AAIResourceUri aaiUri = spy(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY));
doReturn(aaiUri).when(aaiUri).clone();
aaiQueryClient.setupQueryParams(aaiUri);
verify(aaiUri, times(1)).queryParam("depth", "0");
verify(aaiUri, times(1)).queryParam("nodesOnly", "");
verify(aaiUri, times(1)).queryParam("subgraph", subgraph.toString());
}
use of org.onap.aaiclient.client.graphinventory.entities.uri.Depth in project so by onap.
the class HeatBridgeImpl method createTransactionToDeleteSriovPfFromPserver.
private void createTransactionToDeleteSriovPfFromPserver(List<AAIResourceUri> vserverUris) {
Map<String, List<String>> pserverToPciIdMap = getPserverToPciIdMap(vserverUris);
for (Map.Entry<String, List<String>> entry : pserverToPciIdMap.entrySet()) {
String pserverName = entry.getKey();
List<String> pciIds = entry.getValue();
Optional<Pserver> pserver = resourcesClient.get(Pserver.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().pserver(pserverName)).depth(Depth.TWO));
if (pserver.isPresent()) {
// For each pserver/p-interface match sriov-vfs by pic-id and delete them.
pserver.get().getPInterfaces().getPInterface().stream().filter(pIf -> pIf.getSriovPfs() != null && CollectionUtils.isNotEmpty(pIf.getSriovPfs().getSriovPf())).forEach(pIf -> pIf.getSriovPfs().getSriovPf().forEach(sriovPf -> {
if (pciIds.contains(sriovPf.getPfPciId())) {
logger.debug("creating transaction to delete SR-IOV PF: " + pIf.getInterfaceName() + " from PServer: " + pserverName);
if (env.getProperty("heatBridgeDryrun", Boolean.class, false)) {
logger.debug("Would delete Sriov Pf: {}", AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().pserver(pserverName).pInterface(pIf.getInterfaceName()).sriovPf(sriovPf.getPfPciId())).build());
} else {
resourcesClient.delete(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().pserver(pserverName).pInterface(pIf.getInterfaceName()).sriovPf(sriovPf.getPfPciId())));
}
}
}));
}
}
}
Aggregations