Search in sources :

Example 6 with ServiceInstance

use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance in project so by onap.

the class SDNCChangeAssignTasks method changeModelServiceInstance.

public void changeModelServiceInstance(BuildingBlockExecution execution) {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        GenericResourceApiServiceOperationInformation req = sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext());
        SDNCRequest sdncRequest = new SDNCRequest();
        sdncRequest.setSDNCPayload(req);
        sdncRequest.setTopology(SDNCTopology.SERVICE);
        execution.setVariable(SDNC_REQUEST, sdncRequest);
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : SDNCRequest(org.onap.so.client.sdnc.beans.SDNCRequest) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) GenericResourceApiServiceOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)

Example 7 with ServiceInstance

use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance in project so by onap.

the class SDNCChangeAssignTasks method changeAssignModelVfModule.

public void changeAssignModelVfModule(BuildingBlockExecution execution) throws Exception {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        RequestContext requestContext = gBBInput.getRequestContext();
        CloudRegion cloudRegion = gBBInput.getCloudRegion();
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
        VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
        Customer customer = gBBInput.getCustomer();
        SDNCRequest sdncRequest = new SDNCRequest();
        GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest));
        sdncRequest.setSDNCPayload(req);
        sdncRequest.setTopology(SDNCTopology.VFMODULE);
        execution.setVariable(SDNC_REQUEST, sdncRequest);
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) SDNCRequest(org.onap.so.client.sdnc.beans.SDNCRequest) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) GenericResourceApiVfModuleOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation)

Example 8 with ServiceInstance

use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance in project so by onap.

the class SDNCQueryTasks method queryVnf.

/**
 * BPMN access method to query the SDNC for fetching the vnf details.
 *
 * It will get the vnf details according to service instance id.
 *
 * @param execution
 * @throws Exception
 */
public void queryVnf(BuildingBlockExecution execution) throws BBObjectNotFoundException {
    ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
    GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
    String selfLink = "restconf/config/GENERIC-RESOURCE-API:services/service/" + serviceInstance.getServiceInstanceId() + "/service-data/vnfs/vnf/" + genericVnf.getVnfId() + "/vnf-data/vnf-topology/";
    try {
        if (genericVnf.getSelflink() == null) {
            genericVnf.setSelflink(selfLink);
        }
        String response = sdncVnfResources.queryVnf(genericVnf);
        execution.setVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId(), response);
    } catch (BadResponseException ex) {
        logger.error("Exception occurred", ex);
        if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC);
        } else {
            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
        }
    } catch (Exception ex) {
        logger.error("Exception occurred", ex);
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
    }
}
Also used : GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) BadResponseException(org.onap.so.client.exception.BadResponseException) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) BadResponseException(org.onap.so.client.exception.BadResponseException) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException)

Example 9 with ServiceInstance

use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance in project so by onap.

the class SDNCUnassignTasks method unassignVnf.

/**
 * This method is used to prepare a SDNC request and set it to the execution Object.
 *
 * Which is used for unassign the Vnf.
 *
 * @param execution
 */
public void unassignVnf(BuildingBlockExecution execution) {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
        RequestContext requestContext = gBBInput.getRequestContext();
        Customer customer = gBBInput.getCustomer();
        CloudRegion cloudRegion = gBBInput.getCloudRegion();
        SDNCRequest sdncRequest = new SDNCRequest();
        GenericResourceApiVnfOperationInformation req = sdncVnfResources.unassignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest));
        sdncRequest.setSDNCPayload(req);
        sdncRequest.setTopology(SDNCTopology.VNF);
        execution.setVariable(SDNC_REQUEST, sdncRequest);
    } catch (Exception ex) {
        logger.error("Exception occurred in SDNCUnassignTasks unassignVnf", ex);
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) SDNCRequest(org.onap.so.client.sdnc.beans.SDNCRequest) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) GenericResourceApiVnfOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation)

Example 10 with ServiceInstance

use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance in project so by onap.

the class SDNCUnassignTasks method unassignVfModule.

/**
 * This method is used to prepare a SDNC request and set it to the execution Object.
 *
 * Which is used for unassign the VfModule.
 *
 * @param execution
 */
public void unassignVfModule(BuildingBlockExecution execution) {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
        RequestContext requestContext = gBBInput.getRequestContext();
        VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
        SDNCRequest sdncRequest = new SDNCRequest();
        GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance, requestContext, buildCallbackURI(sdncRequest));
        sdncRequest.setSDNCPayload(req);
        sdncRequest.setTopology(SDNCTopology.VFMODULE);
        execution.setVariable(SDNC_REQUEST, sdncRequest);
    } catch (Exception ex) {
        logger.error("Exception occurred in SDNCUnassignTasks unassignVfModule", ex);
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : SDNCRequest(org.onap.so.client.sdnc.beans.SDNCRequest) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) GenericResourceApiVfModuleOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation)

Aggregations

ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)228 Test (org.junit.Test)118 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)110 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)84 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)70 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)61 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)54 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)53 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)51 HashMap (java.util.HashMap)50 Service (org.onap.so.db.catalog.beans.Service)46 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)40 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)38 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)37 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)35 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)33 ModelInfoVfModule (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule)33 File (java.io.File)31 OrchestrationContext (org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext)25 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)24