Search in sources :

Example 6 with GenericVnf

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());
}
Also used : GenericVnf(org.onap.aai.domain.yang.GenericVnf) Test(org.junit.Test)

Example 7 with GenericVnf

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);
}
Also used : CloudRegion(org.onap.aai.domain.yang.CloudRegion) Tenant(org.onap.aai.domain.yang.Tenant) GenericVnf(org.onap.aai.domain.yang.GenericVnf) ServiceInstance(org.onap.aai.domain.yang.ServiceInstance) ModelVer(org.onap.aai.domain.yang.ModelVer)

Example 8 with GenericVnf

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);
}
Also used : Response(org.onap.policy.appc.Response) GenericVnf(org.onap.aai.domain.yang.GenericVnf) ResponseStatus(org.onap.policy.appc.ResponseStatus)

Example 9 with GenericVnf

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);
    }
}
Also used : GenericVnf(org.onap.aai.domain.yang.GenericVnf) GenericVnfNotFoundException(org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.exception.GenericVnfNotFoundException) GenericVnfNotFoundException(org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.exception.GenericVnfNotFoundException)

Example 10 with GenericVnf

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);
}
Also used : GenericVnf(org.onap.aai.domain.yang.GenericVnf) AAIEntityNotFound(org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound) VfModule(org.onap.aai.domain.yang.VfModule)

Aggregations

GenericVnf (org.onap.aai.domain.yang.GenericVnf)63 Test (org.junit.Test)42 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)15 WorkflowResourceIds (org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds)11 File (java.io.File)9 GenericVnfs (org.onap.aai.domain.yang.GenericVnfs)9 VfModule (org.onap.aai.domain.yang.VfModule)9 BuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock)9 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)9 ArrayList (java.util.ArrayList)8 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)8 ServiceInstance (org.onap.aai.domain.yang.ServiceInstance)7 AAIPluralResourceUri (org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri)7 RestClient (org.onap.so.client.RestClient)6 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)4 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)4 List (java.util.List)3 DelegateExecution (org.camunda.bpm.engine.delegate.DelegateExecution)3