diff options
author | Steve Smokowski <ss835w@att.com> | 2019-10-09 11:49:01 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-10-09 11:49:01 +0000 |
commit | cdf30280fcb6c682ce5a0b1d9ae66fc8ea4c4069 (patch) | |
tree | 96e2251d40ff2ad1f1b4e7a4b7d4dc3f07df70fa | |
parent | 3101834b333d45277cc6c635c61b102f0d18442c (diff) | |
parent | db8c5258cbae99abb8e7cb4d1e3f5341bed7608f (diff) |
Merge "Add model info on CHANGEASSIGN req to SDNC"
2 files changed, 69 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java index 6ddb292a6c..a41c79b171 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java @@ -96,6 +96,10 @@ public class VfModuleTopologyOperationRequestMapper { genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.UNASSIGN; requestAction = GenericResourceApiRequestActionEnumeration.DELETEVFMODULEINSTANCE; includeModelInformation = false; + } else if (svcAction.equals(SDNCSvcAction.CHANGE_ASSIGN)) { + genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.CHANGEASSIGN; + requestAction = GenericResourceApiRequestActionEnumeration.CREATEVFMODULEINSTANCE; + includeModelInformation = true; } String sdncReqId = UUID.randomUUID().toString(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java index b71ddba63b..2fd684e0f0 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java @@ -334,4 +334,69 @@ public class VfModuleTopologyOperationRequestMapperTest { serviceInstance, customer, cloudRegion, requestContext, null, new URI("http://localhost:8080")); } + @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()); + } + } |