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));
}
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;
}
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;
}
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());
}
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();
}
Aggregations