use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance in project so by onap.
the class SniroHomingV2IT method testProcessSolution_success_3Allotteds_1Solution.
@Test
public void testProcessSolution_success_3Allotteds_1Solution() {
beforeAllottedResource();
JSONObject asyncResponse = new JSONObject();
asyncResponse.put("transactionId", "testRequestId").put("requestId", "testRequestId").put("requestState", "completed");
JSONArray solution1 = new JSONArray();
solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId1").put("solution", new JSONObject().put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId1"))).put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "True")).put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName1")).put(new JSONObject().put("key", "aicClli").put("value", "testAicClli1")).put(new JSONObject().put("key", "aicVersion").put("value", "3")).put(new JSONObject().put("key", "vnfId").put("value", "testVnfId1")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testCloudRegionId1"))));
solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId2").put("solution", new JSONObject().put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId2"))).put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "True")).put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName2")).put(new JSONObject().put("key", "aicClli").put("value", "testAicClli2")).put(new JSONObject().put("key", "aicVersion").put("value", "3")).put(new JSONObject().put("key", "vnfId").put("value", "testVnfId1")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testCloudRegionId2"))));
solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId3").put("solution", new JSONObject().put("identifierType", "cloudRegionId").put("identifiers", new JSONArray().put("testCloudRegionId3"))).put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "True")).put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "aicClli").put("value", "testAicClli2")).put(new JSONObject().put("key", "aicVersion").put("value", "3"))));
asyncResponse.put("solutions", new JSONObject().put("placementSolutions", new JSONArray().put(solution1)).put("licenseSolutions", new JSONArray()));
sniroHoming.processSolution(execution, asyncResponse.toString());
ServiceInstance si = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0);
assertFalse(si.getAllottedResources().isEmpty());
AllottedResource ar = si.getAllottedResources().get(0);
assertNotNull(ar);
assertEquals("testServiceInstanceId1", ar.getParentServiceInstance().getServiceInstanceId());
assertNotNull(ar.getParentServiceInstance().getSolutionInfo());
assertEquals("testVnfHostName1", ar.getParentServiceInstance().getVnfs().get(0).getVnfName());
AllottedResource ar2 = si.getAllottedResources().get(1);
assertNotNull(ar2);
assertEquals("testServiceInstanceId2", ar2.getParentServiceInstance().getServiceInstanceId());
assertNotNull(ar2.getParentServiceInstance().getSolutionInfo());
assertEquals("testVnfHostName2", ar2.getParentServiceInstance().getVnfs().get(0).getVnfName());
AllottedResource ar3 = si.getAllottedResources().get(2);
assertNotNull(ar3);
assertNotNull(ar3.getParentServiceInstance().getSolutionInfo());
assertEquals("testCloudRegionId3", ar3.getParentServiceInstance().getSolutionInfo().getTargetedCloudRegion().getLcpCloudRegionId());
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance in project so by onap.
the class SniroHomingV2IT method testProcessSolution_success_1Vnf_1Solution.
@Test
public void testProcessSolution_success_1Vnf_1Solution() {
beforeVnf();
JSONObject asyncResponse = new JSONObject();
asyncResponse.put("transactionId", "testRequestId").put("requestId", "testRequestId").put("requestState", "completed");
JSONArray licenseSolution = new JSONArray();
licenseSolution.put(new JSONObject().put("serviceResourceId", "testVnfId1").put("entitlementPoolUUID", new JSONArray().put("f1d563e8-e714-4393-8f99-cc480144a05e").put("j1d563e8-e714-4393-8f99-cc480144a05e")).put("licenseKeyGroupUUID", new JSONArray().put("s1d563e8-e714-4393-8f99-cc480144a05e").put("b1d563e8-e714-4393-8f99-cc480144a05e")));
asyncResponse.put("solutions", new JSONObject().put("licenseSolutions", licenseSolution));
sniroHoming.processSolution(execution, asyncResponse.toString());
ServiceInstance si = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0);
GenericVnf vnf = si.getVnfs().get(0);
assertNotNull(vnf);
assertNotNull(vnf.getLicense());
assertEquals(2, vnf.getLicense().getEntitlementPoolUuids().size());
assertEquals(2, vnf.getLicense().getLicenseKeyGroupUuids().size());
assertEquals("f1d563e8-e714-4393-8f99-cc480144a05e", vnf.getLicense().getEntitlementPoolUuids().get(0));
assertEquals("s1d563e8-e714-4393-8f99-cc480144a05e", vnf.getLicense().getLicenseKeyGroupUuids().get(0));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance in project so by onap.
the class GeneralTopologyObjectMapperTest method testBuildServiceInformation.
@Test
public void testBuildServiceInformation() {
// 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);
// set Customer on service instance
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");
GenericResourceApiServiceinformationServiceInformation serviceInfo = genObjMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
assertEquals("serviceModelInvariantUuid", serviceInfo.getOnapModelInformation().getModelInvariantUuid());
assertEquals("serviceModelName", serviceInfo.getOnapModelInformation().getModelName());
assertEquals("serviceModelUuid", serviceInfo.getOnapModelInformation().getModelUuid());
assertEquals("serviceModelVersion", serviceInfo.getOnapModelInformation().getModelVersion());
assertNull(serviceInfo.getOnapModelInformation().getModelCustomizationUuid());
assertEquals("serviceInstanceId", serviceInfo.getServiceInstanceId());
assertEquals("serviceInstanceId", serviceInfo.getServiceId());
assertEquals("globalCustomerId", serviceInfo.getGlobalCustomerId());
assertEquals("productFamilyId", serviceInfo.getSubscriptionServiceType());
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance 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.bbobjects.ServiceInstance in project so by onap.
the class BBInputSetupMapperLayer method mapAAIServiceInstanceIntoServiceInstance.
public ServiceInstance mapAAIServiceInstanceIntoServiceInstance(org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance) {
ServiceInstance serviceInstance = modelMapper.map(aaiServiceInstance, ServiceInstance.class);
if (aaiServiceInstance.getAllottedResources() != null) {
for (org.onap.aai.domain.yang.AllottedResource allottedResource : aaiServiceInstance.getAllottedResources().getAllottedResource()) {
serviceInstance.getAllottedResources().add(mapAAIAllottedResource(allottedResource));
}
}
serviceInstance.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiServiceInstance.getOrchestrationStatus()));
return serviceInstance;
}
Aggregations