diff options
author | Joey Sullivan <joey.sullivan@amdocs.com> | 2021-01-11 11:57:18 -0500 |
---|---|---|
committer | Joey Sullivan <joey.sullivan@amdocs.com> | 2021-03-29 08:55:06 -0400 |
commit | df9e776db27ad83648286297f4b7c745f92d5e8c (patch) | |
tree | c139f9fca0f36259176d47f6bdf73954372f52cb | |
parent | f62f81f372ff497294266af8ad1df9362e5a1424 (diff) |
NPE when deleting or activate PnP PNF
The ControllerExecutionBB throws an NPE when deleting or activateing PnP PNF
Issue-ID: SO-3463
Change-Id: I82d9f4556d7a889261ad9c508f3aa137b5692db8
Signed-off-by: Joey Sullivan <joey.sullivan@amdocs.com>
3 files changed, 30 insertions, 8 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 2bb383e4ec..90e23e1524 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -96,6 +96,7 @@ import java.util.Optional; @Component("BBInputSetupMapperLayer") public class BBInputSetupMapperLayer { + private static final String USER_PARAM_NAME_KEY = "name"; private static final String USER_PARAM_VALUE_KEY = "value"; @@ -103,6 +104,20 @@ public class BBInputSetupMapperLayer { private ModelMapper modelMapper = new ModelMapper(); + public BBInputSetupMapperLayer() { + initPnfTypeMaps(); + } + + private void initPnfTypeMaps() { + modelMapper.typeMap(org.onap.aai.domain.yang.Pnf.class, Pnf.class) + .addMappings(mapper -> mapper.<String>map(src -> src.getModelCustomizationId(), + (dest, v) -> dest.getModelInfoPnf().setModelCustomizationUuid(v))) + .addMappings(mapper -> mapper.<String>map(src -> src.getModelInvariantId(), + (dest, v) -> dest.getModelInfoPnf().setModelInvariantUuid(v))) + .addMappings(mapper -> mapper.<String>map(src -> src.getModelVersionId(), + (dest, v) -> dest.getModelInfoPnf().setModelUuid(v))); + } + public Customer mapAAICustomer(org.onap.aai.domain.yang.Customer customerAAI) { return modelMapper.map(customerAAI, Customer.class); } @@ -215,10 +230,11 @@ public class BBInputSetupMapperLayer { protected ModelInfoInstanceGroup mapCatalogInstanceGroupToInstanceGroup( CollectionResourceCustomization collectionCust, InstanceGroup instanceGroup) { ModelInfoInstanceGroup modelInfoInstanceGroup = modelMapper.map(instanceGroup, ModelInfoInstanceGroup.class); - if (instanceGroup.getType() != null && instanceGroup.getType().equals(InstanceGroupType.L3_NETWORK)) + if (instanceGroup.getType() != null && instanceGroup.getType().equals(InstanceGroupType.L3_NETWORK)) { modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_L3_NETWORK); - else + } else { modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_VNFC); + } if (collectionCust != null) { List<CollectionResourceInstanceGroupCustomization> instanceGroupCustList = instanceGroup.getCollectionInstanceGroupCustomizations(); @@ -434,10 +450,12 @@ public class BBInputSetupMapperLayer { protected CloudRegion mapCloudRegion(CloudConfiguration cloudConfiguration, org.onap.aai.domain.yang.CloudRegion aaiCloudRegion) { CloudRegion cloudRegion = new CloudRegion(); - if (cloudConfiguration != null) + if (cloudConfiguration != null) { cloudRegion = modelMapper.map(cloudConfiguration, CloudRegion.class); - if (aaiCloudRegion != null) + } + if (aaiCloudRegion != null) { modelMapper.map(aaiCloudRegion, cloudRegion); + } return cloudRegion; } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PnfExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PnfExpected.json index 460f72aa31..e47f4bac22 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PnfExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PnfExpected.json @@ -4,5 +4,9 @@ "nf-role":"gNB", "orchestration-status":"INVENTORIED", "cloud-region":null, - "model-info-pnf":null + "model-info-pnf": { + "model-customization-uuid": "model-customization-uuid", + "model-invariant-uuid": "model-invariant-uuid", + "model-uuid": "model-uuid" + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiPnfInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiPnfInput.json index da0039c923..1b51355906 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiPnfInput.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiPnfInput.json @@ -26,9 +26,9 @@ "nfRole":"gNB", "adminStatus":null, "operationalStatus":null, - "modelCustomizationId":null, - "modelInvariantId":null, - "modelVersionId":null, + "modelCustomizationId":"model-customization-uuid", + "modelInvariantId":"model-invariant-uuid", + "modelVersionId":"model-uuid", "pnfIpv4Address":null, "pnfIpv6Address":null, "softwareVersions":null, |