Search in sources :

Example 11 with ServiceInstance

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

the class CreateNetworkCollection method connectCollectionToServiceInstance.

/**
 * BPMN access method to connect Network Collection
 *
 * @param execution
 * @throws Exception
 */
public void connectCollectionToServiceInstance(BuildingBlockExecution execution) throws Exception {
    execution.setVariable("connectCollectionToServiceInstanceRollback", false);
    try {
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        Collection networkCollection = serviceInstance.getCollection();
        aaiNetworkResources.connectNetworkCollectionToServiceInstance(networkCollection, serviceInstance);
        execution.setVariable("connectCollectionToServiceInstanceRollback", true);
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) Collection(org.onap.so.bpmn.servicedecomposition.bbobjects.Collection)

Example 12 with ServiceInstance

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

the class CreateNetworkCollection method buildNetworkCollectionName.

/**
 * BPMN access method to build Network Collection Name
 *
 * @param execution
 * @throws Exception
 */
public void buildNetworkCollectionName(BuildingBlockExecution execution) throws Exception {
    try {
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        InstanceGroup instanceGroup = serviceInstance.getCollection().getInstanceGroup();
        if (instanceGroup.getModelInfoInstanceGroup() != null) {
            // Build collection name assembling SI name and IG function
            if (serviceInstance.getServiceInstanceName() != null && instanceGroup.getModelInfoInstanceGroup().getFunction() != null) {
                String networkCollectionName = serviceInstance.getServiceInstanceName().concat(UNDERSCORE).concat(instanceGroup.getModelInfoInstanceGroup().getFunction());
                // set networkCollectionName object on execution to be re-used within current BB
                execution.setVariable(NETWORK_COLLECTION_NAME, networkCollectionName);
            } else {
                throw new IllegalArgumentException("Cannot generate collection name because either one or both fields are null: " + " Service Instance Name: " + serviceInstance.getServiceInstanceName() + ", Instance Group Function: " + instanceGroup.getModelInfoInstanceGroup().getFunction());
            }
        } else {
            throw new IllegalArgumentException("Instance group model info is null");
        }
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup)

Example 13 with ServiceInstance

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

the class SDNCDeactivateTasks method deactivateVnf.

/**
 * BPMN access method to perform Service Topology Deactivate action on SDNC for Vnf
 *
 * @param execution
 * @throws Exception
 */
public void deactivateVnf(BuildingBlockExecution execution) throws Exception {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        RequestContext requestContext = gBBInput.getRequestContext();
        ServiceInstance serviceInstance = null;
        GenericVnf vnf = null;
        serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
        CloudRegion cloudRegion = gBBInput.getCloudRegion();
        Customer customer = gBBInput.getCustomer();
        SDNCRequest sdncRequest = new SDNCRequest();
        GenericResourceApiVnfOperationInformation req = sdncVnfResources.deactivateVnf(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 SDNCDeactivateTasks deactivateVnf", 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 14 with ServiceInstance

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

the class SDNCDeactivateTasks method deactivateNetwork.

/**
 * BPMN access method to invoke deactivate on a L3Network object
 *
 * @param execution
 */
public void deactivateNetwork(BuildingBlockExecution execution) {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        Customer customer = gBBInput.getCustomer();
        RequestContext requestContext = gBBInput.getRequestContext();
        CloudRegion cloudRegion = gBBInput.getCloudRegion();
        GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.deactivateNetwork(l3Network, serviceInstance, customer, requestContext, cloudRegion);
        SDNCRequest sdncRequest = new SDNCRequest();
        sdncRequest.setSDNCPayload(req);
        sdncRequest.setTopology(SDNCTopology.NETWORK);
        execution.setVariable(SDNC_REQUEST, sdncRequest);
    } catch (Exception ex) {
        logger.error("Exception occurred in SDNCDeactivateTasks deactivateNetwork", ex);
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) SDNCRequest(org.onap.so.client.sdnc.beans.SDNCRequest) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) GenericResourceApiNetworkOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)

Example 15 with ServiceInstance

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

the class NamingServiceDeleteTasks method deleteServiceInstanceName.

public void deleteServiceInstanceName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
    ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
    NamingRequestObject namingRequestObject = new NamingRequestObject();
    namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId());
    try {
        namingServiceResources.deleteServiceInstanceName(namingRequestObject);
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) NamingRequestObject(org.onap.so.client.namingservice.NamingRequestObject) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException)

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