Search in sources :

Example 56 with L3Network

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

the class SDNCActivateTasks method activateNetwork.

/**
 * BPMN access method to perform Assign action on SDNC for L3Network
 *
 * @param execution
 * @throws BBObjectNotFoundException
 */
public void activateNetwork(BuildingBlockExecution execution) throws BBObjectNotFoundException {
    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.activateNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion);
        SDNCRequest sdncRequest = new SDNCRequest();
        sdncRequest.setSDNCPayload(req);
        sdncRequest.setTopology(SDNCTopology.NETWORK);
        execution.setVariable(SDNC_REQUEST, sdncRequest);
    } catch (Exception 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) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException)

Example 57 with L3Network

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

the class SDNCChangeAssignTasks method changeAssignNetwork.

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

Example 58 with L3Network

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

the class SDNCUnassignTasks method unassignNetwork.

/**
 * This method is used to prepare a SDNC request and set it to the execution Object.
 *
 * Which is used for unassign the Network.
 *
 * @param execution
 */
public void unassignNetwork(BuildingBlockExecution execution) throws Exception {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        L3Network network = 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();
        String cloudRegionSdnc = execution.getVariable("cloudRegionSdnc");
        cloudRegion.setLcpCloudRegionId(cloudRegionSdnc);
        GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.unassignNetwork(network, 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 SDNCUnassignTasks unassignNetwork", 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 59 with L3Network

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

the class OrchestrationStatusValidator method getOrchestrationStatus.

private OrchestrationStatus getOrchestrationStatus(BuildingBlockExecution execution, String buildingBlockFlowName, BuildingBlockDetail buildingBlockDetail) throws BBObjectNotFoundException, OrchestrationStatusValidationException {
    OrchestrationStatus orchestrationStatus = null;
    switch(buildingBlockDetail.getResourceType()) {
        case SERVICE:
            ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
            orchestrationStatus = serviceInstance.getOrchestrationStatus();
            break;
        case VNF:
            GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
            orchestrationStatus = genericVnf.getOrchestrationStatus();
            break;
        case VF_MODULE:
            VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
            orchestrationStatus = vfModule.getOrchestrationStatus();
            break;
        case VOLUME_GROUP:
            VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
            orchestrationStatus = volumeGroup.getOrchestrationStatus();
            break;
        case NETWORK:
            L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
            orchestrationStatus = network.getOrchestrationStatus();
            break;
        case NETWORK_COLLECTION:
            Collection networkCollection = getNetworkCollection(execution);
            orchestrationStatus = networkCollection.getOrchestrationStatus();
            break;
        case CONFIGURATION:
            Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
            orchestrationStatus = configuration.getOrchestrationStatus();
            break;
        case INSTANCE_GROUP:
            InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
            orchestrationStatus = instanceGroup.getOrchestrationStatus();
            break;
        case NO_VALIDATE:
            // short circuit and exit method
            execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
            break;
        default:
            // code
            throw new OrchestrationStatusValidationException(String.format(UNKNOWN_RESOURCE_TYPE, buildingBlockFlowName, buildingBlockDetail.getResourceType(), buildingBlockDetail.getTargetAction()));
    }
    return orchestrationStatus;
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) Collection(org.onap.so.bpmn.servicedecomposition.bbobjects.Collection) OrchestrationStatusValidationException(org.onap.so.client.exception.OrchestrationStatusValidationException) OrchestrationStatus(org.onap.so.db.catalog.beans.OrchestrationStatus) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup)

Example 60 with L3Network

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

the class AAIObjectMapperTest method networkMap.

@Test
public void networkMap() throws Exception {
    L3Network l3Network = new L3Network();
    l3Network.setNetworkId("networkId");
    l3Network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
    l3Network.setNetworkName("networkName");
    l3Network.setNetworkRole("networkRole");
    l3Network.setNetworkTechnology("networkTechnology");
    l3Network.setNeutronNetworkId("neutronNetworkId");
    l3Network.setNetworkRoleInstance(0L);
    l3Network.setContrailNetworkFqdn("contrailNetworkFqdn");
    l3Network.setIsBoundToVpn(false);
    l3Network.setIsCascaded(false);
    l3Network.setIsSharedNetwork(false);
    l3Network.setHeatStackId("heatStackId");
    l3Network.setOperationalStatus("operationalStatus");
    l3Network.setPhysicalNetworkName("physicalNetworkName");
    l3Network.setIsProviderNetwork(false);
    l3Network.setSelflink("selflink");
    l3Network.setServiceId("serviceId");
    ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
    modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUUID");
    modelInfoNetwork.setModelInvariantUUID("modelInvariantUUID");
    modelInfoNetwork.setModelUUID("modelUUID");
    l3Network.setModelInfoNetwork(modelInfoNetwork);
    org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(l3Network);
    ObjectMapper omapper = new ObjectMapper();
    org.onap.aai.domain.yang.L3Network network = omapper.readValue(getJson("aaiL3NetworkMapped.json"), org.onap.aai.domain.yang.L3Network.class);
    com.shazam.shazamcrest.MatcherAssert.assertThat(aaiL3Network, sameBeanAs(network));
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

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