use of org.onap.aaiclient.client.aai.AAIRestClientImpl in project so by onap.
the class ServiceLevelRequestDispatcher method getAndSetPnfNameFromServiceInstance.
private void getAndSetPnfNameFromServiceInstance(final String serviceInstanceId, final String serviceType, final String globalSubscriberId, DelegateExecution delegateExecution) {
AAIRestClientI restClient = new AAIRestClientImpl();
Optional<ServiceInstance> optionalSi = restClient.getServiceInstanceById(serviceInstanceId, serviceType, globalSubscriberId);
optionalSi.ifPresentOrElse(serviceInstance -> {
final List<String> pnfNameList = serviceInstance.getRelationshipList().getRelationship().stream().filter(x -> x.getRelatedTo().contains("pnf")).flatMap(x -> x.getRelationshipData().stream()).filter(data -> data.getRelationshipKey().contains("pnf.pnf-name")).map(x -> x.getRelationshipValue()).collect(Collectors.toList());
if (pnfNameList == null || pnfNameList.size() == 0) {
logger.warn("Unable to find the PNF for service instance id: " + serviceInstance.getServiceInstanceId());
return;
}
delegateExecution.setVariable(ServiceLevelConstants.PNF_NAME_LIST, pnfNameList);
delegateExecution.setVariable(ServiceLevelConstants.PNF_SIZE, pnfNameList.size());
delegateExecution.setVariable(ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.PNF);
}, () -> {
throwExceptionWithWarn(delegateExecution, "Unable to find the service instance: " + serviceInstanceId);
});
}
use of org.onap.aaiclient.client.aai.AAIRestClientImpl in project so by onap.
the class PnfManagementImpl method createEntry.
@Override
public void createEntry(String pnfCorrelationId, Pnf entry) {
AAIRestClientImpl restClient = new AAIRestClientImpl();
restClient.createPnf(pnfCorrelationId, entry);
}
use of org.onap.aaiclient.client.aai.AAIRestClientImpl in project so by onap.
the class PnfManagementImpl method updateEntry.
public void updateEntry(String pnfCorrelationId, Pnf entry) {
AAIRestClientImpl restClient = new AAIRestClientImpl();
restClient.updatePnf(pnfCorrelationId, entry);
}
use of org.onap.aaiclient.client.aai.AAIRestClientImpl in project so by onap.
the class UpdateServiceInstanceInAai method getAndSetServiceInstance.
private void getAndSetServiceInstance(final String serviceInstanceId, final String serviceType, final String globalSubscriberId, String modelVersionId) {
AAIRestClientI restClient = new AAIRestClientImpl();
Optional<ServiceInstance> optionalSi = restClient.getServiceInstanceById(serviceInstanceId, serviceType, globalSubscriberId);
if (!optionalSi.isPresent()) {
// throwExceptionWithWarn(delegateExecution, "Unable to find the service instance: " + serviceInstanceId);
}
ServiceInstance serviceInstance = optionalSi.get();
serviceInstance.setModelVersionId(modelVersionId);
restClient.updateServiceInstance(serviceInstanceId, serviceType, globalSubscriberId, serviceInstance);
}
use of org.onap.aaiclient.client.aai.AAIRestClientImpl in project so by onap.
the class AAIVnfResources method checkVnfPserversLockedFlag.
public boolean checkVnfPserversLockedFlag(String vnfId) throws IOException {
org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.GenericVnf.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))).orElse(new org.onap.aai.domain.yang.GenericVnf());
AAIRestClientImpl client = new AAIRestClientImpl();
aaiValidatorImpl.setClient(client);
return aaiValidatorImpl.isPhysicalServerLocked(vnf.getVnfId());
}
Aggregations