diff options
author | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2021-04-30 10:30:19 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-04-30 10:30:19 +0000 |
commit | a22c07352eac20679273a24f19f17ea0a64b8833 (patch) | |
tree | 0cc0f1e66783eb27ab38fc506de59c2f690364d3 | |
parent | 9494994212985be72f48761c378d4304314c688e (diff) | |
parent | df9e776db27ad83648286297f4b7c745f92d5e8c (diff) |
Merge "NPE when deleting or activate PnP PNF" into guilin
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, |