Search in sources :

Example 21 with Customer

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

the class SDNCServiceInstanceResourcesTest method deleteServiceInstanceSuccessTest.

@Test
public void deleteServiceInstanceSuccessTest() throws Exception {
    doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
    sdncServiceInstanceResources.deleteServiceInstance(serviceInstance, customer, requestContext);
    verify(MOCK_serviceTopologyOperationMapper, times(1)).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class));
}
Also used : Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) GenericResourceApiServiceOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) Test(org.junit.Test)

Example 22 with Customer

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

the class BBInputSetup method populateGBBWithSIAndAdditionalInfo.

protected GeneralBuildingBlock populateGBBWithSIAndAdditionalInfo(BBInputSetupParameter parameter) throws Exception {
    GeneralBuildingBlock outputBB = new GeneralBuildingBlock();
    OrchestrationContext orchContext = mapperLayer.mapOrchestrationContext(parameter.getRequestDetails());
    RequestContext requestContext = mapperLayer.mapRequestContext(parameter.getRequestDetails());
    requestContext.setAction(parameter.getRequestAction());
    requestContext.setMsoRequestId(parameter.getExecuteBB().getRequestId());
    requestContext.setIsHelm(parameter.getIsHelm());
    org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(parameter.getRequestDetails().getCloudConfiguration());
    CloudRegion cloudRegion = mapperLayer.mapCloudRegion(parameter.getRequestDetails().getCloudConfiguration(), aaiCloudRegion);
    Tenant tenant = getTenant(parameter.getRequestDetails().getCloudConfiguration(), aaiCloudRegion);
    outputBB.setOrchContext(orchContext);
    outputBB.setRequestContext(requestContext);
    outputBB.setCloudRegion(cloudRegion);
    outputBB.setTenant(tenant);
    Customer customer = parameter.getCustomer();
    if (customer == null) {
        Map<String, String> uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(parameter.getServiceInstance().getServiceInstanceId());
        String globalCustomerId = uriKeys.get(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId);
        String subscriptionServiceType = uriKeys.get(AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType);
        customer = mapCustomer(globalCustomerId, subscriptionServiceType);
    }
    outputBB.setServiceInstance(parameter.getServiceInstance());
    if (customer.getServiceSubscription() != null) {
        customer.getServiceSubscription().getServiceInstances().add(parameter.getServiceInstance());
    }
    outputBB.setCustomer(customer);
    return outputBB;
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) Tenant(org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext)

Example 23 with Customer

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

the class BBInputSetup method mapCustomer.

protected Customer mapCustomer(String globalCustomerId, String subscriptionServiceType) {
    org.onap.aai.domain.yang.Customer aaiCustomer = this.bbInputSetupUtils.getAAICustomer(globalCustomerId);
    org.onap.aai.domain.yang.ServiceSubscription aaiServiceSubscription = this.bbInputSetupUtils.getAAIServiceSubscription(globalCustomerId, subscriptionServiceType);
    Customer customer = this.mapperLayer.mapAAICustomer(aaiCustomer);
    ServiceSubscription serviceSubscription = this.mapperLayer.mapAAIServiceSubscription(aaiServiceSubscription);
    if (serviceSubscription != null) {
        customer.setServiceSubscription(serviceSubscription);
    }
    return customer;
}
Also used : ServiceSubscription(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)

Example 24 with Customer

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

the class ServiceTopologyOperationMapperTest method reqMapperTest.

@Test
public void reqMapperTest() throws Exception {
    // prepare and set service instance
    ServiceInstance serviceInstance = new ServiceInstance();
    ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
    modelInfoServiceInstance.setModelInvariantUuid("modelInvariantUuid");
    modelInfoServiceInstance.setModelName("modelName");
    modelInfoServiceInstance.setModelUuid("modelUuid");
    modelInfoServiceInstance.setModelVersion("modelVersion");
    serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
    // prepare Customer object
    Customer customer = new Customer();
    customer.setGlobalCustomerId("globalCustomerId");
    customer.setServiceSubscription(new ServiceSubscription());
    // set Customer on service instance
    customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
    // prepare RequestContext
    RequestContext requestContext = new RequestContext();
    Map<String, Object> userParams = new HashMap<>();
    userParams.put("key1", "value1");
    requestContext.setUserParams(userParams);
    requestContext.setProductFamilyId("productFamilyId");
    requestContext.setMsoRequestId("MsoRequestId");
    GenericResourceApiServiceOperationInformation serviceOpInformation = mapper.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, requestContext);
    GenericResourceApiServiceOperationInformation serviceOpInformationNullReqContext = mapper.reqMapper(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, null);
    String jsonToCompare = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json")));
    ObjectMapper omapper = new ObjectMapper();
    GenericResourceApiOnapmodelinformationOnapModelInformation reqMapper1 = omapper.readValue(jsonToCompare, GenericResourceApiOnapmodelinformationOnapModelInformation.class);
    assertThat(reqMapper1, sameBeanAs(serviceOpInformation.getServiceInformation().getOnapModelInformation()));
    assertEquals("MsoRequestId", serviceOpInformation.getRequestInformation().getRequestId());
    assertNotNull(serviceOpInformationNullReqContext.getRequestInformation().getRequestId());
}
Also used : ServiceSubscription(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) HashMap(java.util.HashMap) GenericResourceApiOnapmodelinformationOnapModelInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation) GenericResourceApiServiceOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) GeneralTopologyObjectMapper(org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Test(org.junit.Test)

Example 25 with Customer

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

the class NetworkTopologyOperationRequestMapperTest method before.

@Before
public void before() {
    // prepare and set service instance
    serviceInstance = new ServiceInstance();
    serviceInstanceNoCollection = new ServiceInstance();
    ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
    modelInfoServiceInstance.setModelInvariantUuid("modelInvariantUuid");
    modelInfoServiceInstance.setModelName("modelName");
    modelInfoServiceInstance.setModelUuid("modelUuid");
    modelInfoServiceInstance.setModelVersion("modelVersion");
    serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
    serviceInstanceNoCollection.setModelInfoServiceInstance(modelInfoServiceInstance);
    // prepare Customer object
    customer = new Customer();
    customer.setGlobalCustomerId("globalCustomerId");
    // serviceInstance.setCustomer(customer);
    // set Customer on service instance
    ServiceSubscription serviceSubscription = new ServiceSubscription();
    serviceSubscription.setServiceType("productFamilyId");
    customer.setServiceSubscription(serviceSubscription);
    // set Customer on service instance
    customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
    customer.getServiceSubscription().getServiceInstances().add(serviceInstanceNoCollection);
    // 
    InstanceGroup networkInstanceGroup = new InstanceGroup();
    networkInstanceGroup.setId("networkInstanceGroupId");
    networkInstanceGroup.setInstanceGroupFunction("instanceGroupFunction");
    Collection networkCollection = new Collection();
    networkCollection.setInstanceGroup(networkInstanceGroup);
    serviceInstance.setCollection(networkCollection);
    // 
    requestContext = new RequestContext();
    Map<String, Object> userParams = new HashMap<>();
    userParams.put("key1", "value1");
    requestContext.setUserParams(userParams);
    requestContext.setProductFamilyId("productFamilyId");
    requestContext.setMsoRequestId("MsoRequestId");
    network = new L3Network();
    network.setNetworkId("TEST_NETWORK_ID");
    network.setNetworkName("TEST_NETWORK_NAME");
    ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
    modelInfoNetwork.setModelInvariantUUID("modelInvariantUuid");
    modelInfoNetwork.setModelName("modelName");
    modelInfoNetwork.setModelVersion("modelVersion");
    modelInfoNetwork.setModelUUID("modelUuid");
    modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUUID");
    network.setModelInfoNetwork(modelInfoNetwork);
    cloudRegion = new CloudRegion();
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) HashMap(java.util.HashMap) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup) ServiceSubscription(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) Collection(org.onap.so.bpmn.servicedecomposition.bbobjects.Collection) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Before(org.junit.Before)

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