diff options
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, |