use of org.onap.aai.domain.yang.GenericVnf in project policy-models by onap.
the class AaiCqResponseTest method testGetGenericVnfByVfModuleModelInvariantId.
@Test
public void testGetGenericVnfByVfModuleModelInvariantId() throws Exception {
String responseString = getAaiCqResponse();
AaiCqResponse aaiCqResponse;
aaiCqResponse = new AaiCqResponse(responseString);
GenericVnf genVnf = aaiCqResponse.getGenericVnfByVfModuleModelInvariantId("e6130d03-56f1-4b0a-9a1d-e1b2ebc30e0e");
assertNotNull(genVnf);
assertEquals(ETE_VNF, genVnf.getVnfName());
LOGGER.info(genVnf.getVnfName());
}
use of org.onap.aai.domain.yang.GenericVnf in project policy-models by onap.
the class VfModuleCreateTest method loadProperties.
private void loadProperties() {
// set the properties
ServiceInstance instance = new ServiceInstance();
instance.setServiceInstanceId(SVC_INSTANCE_ID);
oper.setProperty(OperationProperties.AAI_SERVICE, instance);
ModelVer modelVers = new ModelVer();
modelVers.setModelName(MODEL_NAME2);
modelVers.setModelVersion(MODEL_VERS2);
oper.setProperty(OperationProperties.AAI_SERVICE_MODEL, modelVers);
oper.setProperty(OperationProperties.AAI_VNF_MODEL, modelVers);
GenericVnf vnf = new GenericVnf();
vnf.setVnfId(VNF_ID);
oper.setProperty(OperationProperties.AAI_VNF, vnf);
CloudRegion cloudRegion = new CloudRegion();
cloudRegion.setCloudRegionId("my-cloud-id");
oper.setProperty(OperationProperties.AAI_DEFAULT_CLOUD_REGION, cloudRegion);
Tenant tenant = new Tenant();
tenant.setTenantId("my-tenant-id");
oper.setProperty(OperationProperties.AAI_DEFAULT_TENANT, tenant);
oper.setProperty(OperationProperties.DATA_VF_COUNT, VF_COUNT);
}
use of org.onap.aai.domain.yang.GenericVnf in project policy-models by onap.
the class BasicAppcOperation method setUp.
/**
* Initializes mocks and sets up.
*/
public void setUp() throws Exception {
super.setUpBasic();
response = new Response();
ResponseStatus status = new ResponseStatus();
response.setStatus(status);
status.setCode(ResponseCode.SUCCESS.getValue());
status.setDescription(MY_DESCRIPTION);
genvnf = new GenericVnf();
genvnf.setVnfId(MY_VNF);
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class MonitorVnfmNodeTask method getNodeStatus.
/**
* Check the final status of vnf in A&AI
*
* @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
*/
public void getNodeStatus(final BuildingBlockExecution execution) {
try {
LOGGER.debug("Executing getNodeStatus ...");
final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
final String vnfId = vnf.getVnfId();
LOGGER.debug("Query A&AI for generic VNF using vnfID: {}", vnfId);
final Optional<GenericVnf> aaiGenericVnfOptional = aaiVnfResources.getGenericVnf(vnfId);
if (!aaiGenericVnfOptional.isPresent()) {
throw new GenericVnfNotFoundException("Unable to find generic vnf in A&AI using vnfID: " + vnfId);
}
final GenericVnf genericVnf = aaiGenericVnfOptional.get();
final String orchestrationStatus = genericVnf.getOrchestrationStatus();
LOGGER.debug("Found generic vnf with orchestration status : {}", orchestrationStatus);
execution.setVariable(getNodeStatusVariableName(), isOrchestrationStatusValid(orchestrationStatus));
} catch (final Exception exception) {
LOGGER.error("Unable to get vnf from AAI", exception);
exceptionUtil.buildAndThrowWorkflowException(execution, 1220, exception);
}
}
use of org.onap.aai.domain.yang.GenericVnf in project so by onap.
the class BpmnRequestBuilder method buildVFModuleDeleteRequest.
public ServiceInstancesRequest buildVFModuleDeleteRequest(String vnfId, String vfModuleId, ModelType modelType) throws AAIEntityNotFound {
GenericVnf vnf = aaiDataRet.getGenericVnf(vnfId);
if (vnf == null) {
throw new AAIEntityNotFound(GENERIC_VNF_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId);
}
VfModule vfModule = aaiDataRet.getAAIVfModule(vnfId, vfModuleId);
if (vfModule == null) {
throw new AAIEntityNotFound(VF_MODULE_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId + " vfModuleId: " + vfModuleId);
}
return createServiceInstancesRequest(vnf, vfModule, modelType);
}
Aggregations