use of org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters in project so by onap.
the class GeneralTopologyObjectMapperTest method buildVfModuleInformationTest_withModel.
@Test
public void buildVfModuleInformationTest_withModel() {
VfModule vfModule = new VfModule();
vfModule.setVfModuleId("TestVfModuleId");
ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID");
modelInfoVfModule.setModelName("testModelName");
modelInfoVfModule.setModelVersion("testModelVersion");
modelInfoVfModule.setModelUUID("testModelUUID");
modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID");
vfModule.setModelInfoVfModule(modelInfoVfModule);
ServiceInstance serviceInstance = new ServiceInstance();
serviceInstance.setServiceInstanceId("serviceInstanceId");
GenericVnf genericVnf = new GenericVnf();
genericVnf.setVnfId("TestVnfId");
RequestContext requestContext = new RequestContext();
RequestParameters requestParameters = new RequestParameters();
requestParameters.setUsePreload(true);
requestContext.setRequestParameters(requestParameters);
GenericResourceApiVfmoduleinformationVfModuleInformation gcRequestInput = null;
try {
gcRequestInput = genObjMapper.buildVfModuleInformation(vfModule, genericVnf, serviceInstance, requestContext, true);
} catch (MapperException ex) {
}
assertNotNull(gcRequestInput);
assertNotNull(vfModule.getModelInfoVfModule());
assertNotNull(gcRequestInput.getOnapModelInformation());
assertEquals(modelInfoVfModule.getModelInvariantUUID(), gcRequestInput.getOnapModelInformation().getModelInvariantUuid());
assertEquals(modelInfoVfModule.getModelName(), gcRequestInput.getOnapModelInformation().getModelName());
assertEquals(modelInfoVfModule.getModelVersion(), gcRequestInput.getOnapModelInformation().getModelVersion());
assertEquals(modelInfoVfModule.getModelUUID(), gcRequestInput.getOnapModelInformation().getModelUuid());
assertEquals(modelInfoVfModule.getModelCustomizationUUID(), gcRequestInput.getOnapModelInformation().getModelCustomizationUuid());
assertEquals(vfModule.getVfModuleId(), gcRequestInput.getVfModuleId());
assertNotNull(gcRequestInput.getVfModuleId());
assertTrue(gcRequestInput.getFromPreload());
}
use of org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters in project so by onap.
the class BBInputSetupMapperLayer method mapRequestParameters.
protected RequestParameters mapRequestParameters(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) {
RequestParameters requestParams = new RequestParameters();
requestParams.setaLaCarte(requestParameters.getALaCarte());
requestParams.setUsePreload(requestParameters.getUsePreload());
requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType());
requestParams.setUserParams(requestParameters.getUserParams());
requestParams.setPayload(requestParameters.getPayload());
return requestParams;
}
use of org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters in project so by onap.
the class VfModuleTopologyOperationRequestMapperTest method assignGenericResourceApiVfModuleInformationTest.
@Test
public void assignGenericResourceApiVfModuleInformationTest() throws Exception {
// prepare and set service instance
ServiceInstance serviceInstance = new ServiceInstance();
serviceInstance.setServiceInstanceId("serviceInstanceId");
ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
modelInfoServiceInstance.setModelName("serviceModelName");
modelInfoServiceInstance.setModelUuid("serviceModelUuid");
modelInfoServiceInstance.setModelVersion("serviceModelVersion");
serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
// prepare Customer object
Customer customer = new Customer();
customer.setGlobalCustomerId("globalCustomerId");
ServiceSubscription serviceSubscription = new ServiceSubscription();
serviceSubscription.setServiceType("productFamilyId");
customer.setServiceSubscription(serviceSubscription);
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
//
RequestContext requestContext = new RequestContext();
Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value1");
requestContext.setUserParams(userParams);
requestContext.setProductFamilyId("productFamilyId");
RequestParameters requestParameters = new RequestParameters();
requestParameters.setUsePreload(true);
requestContext.setRequestParameters(requestParameters);
requestContext.setMsoRequestId("MsoRequestId");
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("testVnfId");
vnf.setVnfType("testVnfType");
vnf.setVnfName("testVnfName");
ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid");
modelInfoGenericVnf.setModelName("vnfModelName");
modelInfoGenericVnf.setModelVersion("vnfModelVersion");
modelInfoGenericVnf.setModelUuid("vnfModelUuid");
modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid");
vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
VfModule vfModule = new VfModule();
vfModule.setVfModuleId("testVfModuleId");
vfModule.setVfModuleName("testVfModuleName");
ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid");
modelInfoVfModule.setModelName("vfModuleModelName");
modelInfoVfModule.setModelVersion("vfModuleModelVersion");
modelInfoVfModule.setModelUUID("vfModuleModelUuid");
modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
vfModule.setModelInfoVfModule(modelInfoVfModule);
HashMap<String, String> cloudParams = new HashMap<String, String>();
cloudParams.put("key2", "value2");
vfModule.setCloudParams(cloudParams);
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("volumeGroupId");
volumeGroup.setVolumeGroupName("volumeGroupName");
CloudRegion cloudRegion = new CloudRegion();
GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null, new URI("http://localhost:8080"));
String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleOperationInformationAssign.json")));
ObjectMapper omapper = new ObjectMapper();
GenericResourceApiVfModuleOperationInformation reqMapper1 = omapper.readValue(jsonToCompare, GenericResourceApiVfModuleOperationInformation.class);
assertThat(vfModuleSDNCrequest, sameBeanAs(reqMapper1).ignoring("sdncRequestHeader.svcRequestId").ignoring("requestInformation.requestId"));
assertEquals("MsoRequestId", vfModuleSDNCrequest.getRequestInformation().getRequestId());
}
use of org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters in project so by onap.
the class VfModuleTopologyOperationRequestMapperTest method reqMapperTest.
@Test
public void reqMapperTest() throws Exception {
// prepare and set service instance
ServiceInstance serviceInstance = new ServiceInstance();
serviceInstance.setServiceInstanceId("serviceInstanceId");
ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
modelInfoServiceInstance.setModelName("serviceModelName");
modelInfoServiceInstance.setModelUuid("serviceModelUuid");
modelInfoServiceInstance.setModelVersion("serviceModelVersion");
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);
//
RequestContext requestContext = new RequestContext();
RequestParameters requestParameters = new RequestParameters();
HashMap<String, Object> userParams1 = new HashMap<>();
userParams1.put("key1", "value1");
List<Map<String, Object>> userParams = new ArrayList<>();
userParams.add(userParams1);
requestParameters.setUserParams(userParams);
requestContext.setRequestParameters(requestParameters);
requestContext.setProductFamilyId("productFamilyId");
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("testVnfId");
vnf.setVnfType("testVnfType");
ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid");
modelInfoGenericVnf.setModelName("vnfModelName");
modelInfoGenericVnf.setModelVersion("vnfModelVersion");
modelInfoGenericVnf.setModelUuid("vnfModelUuid");
modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid");
vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
VfModule vfModule = new VfModule();
vfModule.setVfModuleId("testVfModuleId");
vfModule.setVfModuleName("testVfModuleName");
ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid");
modelInfoVfModule.setModelName("vfModuleModelName");
modelInfoVfModule.setModelVersion("vfModuleModelVersion");
modelInfoVfModule.setModelUUID("vfModuleModelUuid");
modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
vfModule.setModelInfoVfModule(modelInfoVfModule);
CloudRegion cloudRegion = new CloudRegion();
GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext, null, new URI("http://localhost:8080"));
assertNull(vfModuleSDNCrequest.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid());
assertEquals("vnfModelCustomizationUuid", vfModuleSDNCrequest.getVnfInformation().getOnapModelInformation().getModelCustomizationUuid());
assertEquals("vfModuleModelCustomizationUuid", vfModuleSDNCrequest.getVfModuleInformation().getOnapModelInformation().getModelCustomizationUuid());
}
use of org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters in project so by onap.
the class VfModuleTopologyOperationRequestMapperTest method reqMapperChangeAssignTest.
@Test
public void reqMapperChangeAssignTest() throws Exception {
// prepare and set service instance
ServiceInstance serviceInstance = new ServiceInstance();
serviceInstance.setServiceInstanceId("serviceInstanceId");
ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
modelInfoServiceInstance.setModelName("serviceModelName");
modelInfoServiceInstance.setModelUuid("serviceModelUuid");
modelInfoServiceInstance.setModelVersion("serviceModelVersion");
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);
//
RequestContext requestContext = new RequestContext();
RequestParameters requestParameters = new RequestParameters();
HashMap<String, Object> userParams1 = new HashMap<>();
userParams1.put("key1", "value1");
List<Map<String, Object>> userParams = new ArrayList<>();
userParams.add(userParams1);
requestParameters.setUserParams(userParams);
requestContext.setRequestParameters(requestParameters);
requestContext.setProductFamilyId("productFamilyId");
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("testVnfId");
vnf.setVnfType("testVnfType");
ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid");
modelInfoGenericVnf.setModelName("vnfModelName");
modelInfoGenericVnf.setModelVersion("vnfModelVersion");
modelInfoGenericVnf.setModelUuid("vnfModelUuid");
modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid");
vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
VfModule vfModule = new VfModule();
vfModule.setVfModuleId("testVfModuleId");
vfModule.setVfModuleName("testVfModuleName");
ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid");
modelInfoVfModule.setModelName("vfModuleModelName");
modelInfoVfModule.setModelVersion("vfModuleModelVersion");
modelInfoVfModule.setModelUUID("vfModuleModelUuid");
modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
vfModule.setModelInfoVfModule(modelInfoVfModule);
CloudRegion cloudRegion = new CloudRegion();
GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext, null, new URI("http://localhost:8080"));
assertEquals("vnfModelCustomizationUuid", vfModuleSDNCrequest.getVnfInformation().getOnapModelInformation().getModelCustomizationUuid());
assertEquals("vfModuleModelCustomizationUuid", vfModuleSDNCrequest.getVfModuleInformation().getOnapModelInformation().getModelCustomizationUuid());
}
Aggregations