Search in sources :

Example 6 with Customer

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

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

the class AAICreateTasks method createServiceSubscription.

/**
 * This method is used for creating and subscribing the service in A&AI.
 *
 * @param execution
 * @throws @return
 */
public void createServiceSubscription(BuildingBlockExecution execution) {
    try {
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        Customer customer = execution.getGeneralBuildingBlock().getCustomer();
        if (null == customer) {
            String errorMessage = "Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: " + serviceInstance.getServiceInstanceId();
            logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, "BPMN", ErrorCode.UnknownError.getValue(), errorMessage);
            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage);
        }
        aaiSIResources.createServiceSubscription(customer);
    } catch (BpmnError ex) {
        throw ex;
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException) BpmnError(org.camunda.bpm.engine.delegate.BpmnError)

Example 8 with Customer

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

the class BBInputSetupMapperLayerTest method testMapAAICustomer.

@Test
public void testMapAAICustomer() throws IOException {
    Customer expected = mapper.readValue(new File(RESOURCE_PATH + "Customer.json"), Customer.class);
    org.onap.aai.domain.yang.Customer customerAAI = mapper.readValue(new File(RESOURCE_PATH + "Customer_AAI.json"), org.onap.aai.domain.yang.Customer.class);
    Customer actual = bbInputSetupMapperLayer.mapAAICustomer(customerAAI);
    assertThat(actual, sameBeanAs(expected));
}
Also used : Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) File(java.io.File) Test(org.junit.Test)

Example 9 with Customer

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

the class BuildingBlockTestDataSetup method setAvpnCustomer.

public Customer setAvpnCustomer() {
    Customer customer = buildCustomer();
    gBBInput.setCustomer(customer);
    return customer;
}
Also used : Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)

Example 10 with Customer

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

the class BuildingBlockTestDataSetup method setCustomer.

public Customer setCustomer() {
    if (gBBInput.getCustomer() != null)
        return gBBInput.getCustomer();
    Customer customer = new Customer();
    customer.setGlobalCustomerId("testGlobalCustomerId");
    customer.setSubscriberType("testSubscriberType");
    customer.setServiceSubscription(buildServiceSubscription());
    gBBInput.setCustomer(customer);
    return customer;
}
Also used : Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)

Aggregations

Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)74 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)52 Test (org.junit.Test)40 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)37 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)25 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)23 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)23 ServiceSubscription (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription)22 HashMap (java.util.HashMap)21 SDNCRequest (org.onap.so.client.sdnc.beans.SDNCRequest)16 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)15 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)14 Service (org.onap.so.db.catalog.beans.Service)13 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)11 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)10 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)10 File (java.io.File)9 GenericResourceApiServiceOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation)9 RequestInfo (org.onap.so.serviceinstancebeans.RequestInfo)9 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)8