Search in sources :

Example 1 with ServiceInstance

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

the class CreateNetwork method buildCreateNetworkRequest.

/**
 * BPMN access method to build CreateNetworkRequest object
 */
public void buildCreateNetworkRequest(BuildingBlockExecution execution) throws Exception {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
        Map<String, String> userInput = gBBInput.getUserInput();
        String cloudRegionPo = execution.getVariable("cloudRegionPo");
        CreateNetworkRequest createNetworkRequest = networkAdapterObjectMapper.createNetworkRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, userInput, cloudRegionPo, gBBInput.getCustomer());
        // set CreateNetowrkRequest object on execution to be re-used within current BB
        execution.setVariable("createNetworkRequest", createNetworkRequest);
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) CreateNetworkRequest(org.onap.so.adapters.nwrest.CreateNetworkRequest) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)

Example 2 with ServiceInstance

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

the class NamingServiceCreateTasks method createVpnBondingServiceName.

public void createVpnBondingServiceName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
    ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
    L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
    VpnBinding vpnBinding = extractPojosForBB.extractByKey(execution, ResourceKey.VPN_ID);
    NamingRequestObject namingRequestObject = new NamingRequestObject();
    namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId());
    namingRequestObject.setPolicyInstanceNameValue(serviceInstance.getModelInfoServiceInstance().getNamingPolicy());
    namingRequestObject.setNamingTypeValue(NamingServiceConstants.NAMING_TYPE_SERVICE);
    namingRequestObject.setServiceModelNameValue(serviceInstance.getModelInfoServiceInstance().getModelName());
    namingRequestObject.setModelVersionValue(serviceInstance.getModelInfoServiceInstance().getModelVersion());
    namingRequestObject.setNetworkNameValue(network.getNetworkName());
    namingRequestObject.setVpnNameValue(vpnBinding.getVpnName());
    namingRequestObject.setResourceNameValue(NamingServiceConstants.RESOURCE_NAME_SERVICE_INSTANCE_NAME);
    String generatedVpnBondingServiceName = "";
    try {
        generatedVpnBondingServiceName = namingServiceResources.generateServiceInstanceName(namingRequestObject);
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
    serviceInstance.setServiceInstanceName(generatedVpnBondingServiceName);
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) VpnBinding(org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) NamingRequestObject(org.onap.so.client.namingservice.NamingRequestObject) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException)

Example 3 with ServiceInstance

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

the class SDNCActivateTasks method activateVnf.

/**
 * This method is used to prepare a SDNC request and set it to the execution Object.
 *
 * Which is used for activate the vnf.
 *
 * @param execution
 */
public void activateVnf(BuildingBlockExecution execution) {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        RequestContext requestContext = gBBInput.getRequestContext();
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
        CloudRegion cloudRegion = gBBInput.getCloudRegion();
        Customer customer = gBBInput.getCustomer();
        SDNCRequest sdncRequest = new SDNCRequest();
        GenericResourceApiVnfOperationInformation req = sdncVnfResources.activateVnf(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 SDNCActivateTasks activateVnf process", 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) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException) GenericResourceApiVnfOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation)

Example 4 with ServiceInstance

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

the class SDNCActivateTasks method activateVfModule.

/**
 * This method is used to prepare a SDNC request and set it to the execution Object.
 *
 * Which is used for activate the activateVfModule.
 *
 * @param execution
 */
public void activateVfModule(BuildingBlockExecution execution) {
    GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
    RequestContext requestContext = gBBInput.getRequestContext();
    ServiceInstance serviceInstance = null;
    GenericVnf vnf = null;
    VfModule vfModule = null;
    try {
        serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
        vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
        Customer customer = gBBInput.getCustomer();
        CloudRegion cloudRegion = gBBInput.getCloudRegion();
        SDNCRequest sdncRequest = new SDNCRequest();
        GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest));
        sdncRequest.setSDNCPayload(req);
        sdncRequest.setTopology(SDNCTopology.VFMODULE);
        execution.setVariable(SDNC_REQUEST, sdncRequest);
    } catch (Exception ex) {
        logger.error("Exception occurred in SDNCActivateTasks activateVfModule process", 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) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException) GenericResourceApiVfModuleOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation)

Example 5 with ServiceInstance

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

the class SDNCChangeAssignTasks method changeModelVnf.

public void changeModelVnf(BuildingBlockExecution execution) {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        SDNCRequest sdncRequest = new SDNCRequest();
        GenericResourceApiVnfOperationInformation req = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, gBBInput.getCustomer(), gBBInput.getCloudRegion(), gBBInput.getRequestContext(), buildCallbackURI(sdncRequest));
        sdncRequest.setSDNCPayload(req);
        sdncRequest.setTopology(SDNCTopology.VNF);
        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) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) GenericResourceApiVnfOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation)

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