Search in sources :

Example 1 with L3Network

use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network 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 L3Network

use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network 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 L3Network

use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network 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 4 with L3Network

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

the class UnassignNetworkBB method checkRelationshipRelatedTo.

/**
 * BPMN access method to prepare overall error messages.
 *
 * @param execution - BuildingBlockExecution
 * @param relatedToValue - String, ex: vf-module
 * @return void - nothing
 */
public void checkRelationshipRelatedTo(BuildingBlockExecution execution, String relatedToValue) {
    try {
        L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
        AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
        Optional<org.onap.aai.domain.yang.L3Network> network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
        if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) {
            String msg = messageCannotPerformUnassign + relatedToValue;
            execution.setVariable("ErrorUnassignNetworkBB", msg);
            logger.error("ErrorUnassignNetworkBB: {}", msg);
            throw new UnassignNetworkException(msg);
        }
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) UnassignNetworkException(org.onap.so.bpmn.infrastructure.flowspecific.exceptions.UnassignNetworkException) UnassignNetworkException(org.onap.so.bpmn.infrastructure.flowspecific.exceptions.UnassignNetworkException) AAIResultWrapper(org.onap.aaiclient.client.aai.entities.AAIResultWrapper)

Example 5 with L3Network

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

the class AAICreateTasks method connectNetworkToNetworkCollectionInstanceGroup.

/**
 * BPMN access method to establish relationships in AAI
 *
 * @param execution
 * @throws Exception
 */
public void connectNetworkToNetworkCollectionInstanceGroup(BuildingBlockExecution execution) {
    try {
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
        // connect network only if Instance Group / Collection objects exist
        if (serviceInstance.getCollection() != null && serviceInstance.getCollection().getInstanceGroup() != null)
            aaiNetworkResources.connectNetworkToNetworkCollectionInstanceGroup(l3network, serviceInstance.getCollection().getInstanceGroup());
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException)

Aggregations

L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)68 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)34 Test (org.junit.Test)29 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)18 AAIResultWrapper (org.onap.aaiclient.client.aai.entities.AAIResultWrapper)13 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)12 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)12 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)11 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)11 Service (org.onap.so.db.catalog.beans.Service)11 File (java.io.File)10 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)10 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)10 Relationships (org.onap.aaiclient.client.aai.entities.Relationships)9 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)9 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)9 AAIResourceUri (org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri)8 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)8 ModelInfoNetwork (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork)8 ArrayList (java.util.ArrayList)7