From 0bfedbcc8907a479ea86b8f04d4fb012ec2c9a29 Mon Sep 17 00:00:00 2001 From: "Tait,Trevor(rt0435)" Date: Mon, 14 Jan 2019 14:59:12 -0500 Subject: Upgrade sdc-context-builder to audit-common.1.4.0 Issue-ID: LOG-926 Change-Id: Idc2816e791290b1067a5fb5db3c0cd18d29c45c8 Signed-off-by: Tait,Trevor(rt0435) --- pom.xml | 2 +- .../sdc/model/handlers/ToscaModelConverter.java | 40 +++++++++------------- .../unittest/service/SDCContextBuilderTest.java | 2 +- 3 files changed, 18 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index c5c0056..663d934 100644 --- a/pom.xml +++ b/pom.xml @@ -172,7 +172,7 @@ org.onap.logging-analytics.pomba pomba-audit-common - 1.3.1 + 1.4.0-SNAPSHOT diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdc/model/handlers/ToscaModelConverter.java b/src/main/java/org/onap/pomba/contextbuilder/sdc/model/handlers/ToscaModelConverter.java index a1c6779..b01e75b 100644 --- a/src/main/java/org/onap/pomba/contextbuilder/sdc/model/handlers/ToscaModelConverter.java +++ b/src/main/java/org/onap/pomba/contextbuilder/sdc/model/handlers/ToscaModelConverter.java @@ -21,8 +21,8 @@ import java.util.ArrayList; import java.util.List; import org.onap.pomba.common.datatypes.ModelContext; import org.onap.pomba.common.datatypes.Service; -import org.onap.pomba.common.datatypes.VF; import org.onap.pomba.common.datatypes.VFModule; +import org.onap.pomba.common.datatypes.VNF; import org.onap.pomba.common.datatypes.VNFC; import org.onap.pomba.contextbuilder.sdc.exception.ToscaCsarException; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; @@ -33,8 +33,6 @@ import org.onap.sdc.toscaparser.api.elements.Metadata; public class ToscaModelConverter { - private static final String PROPERTY_NAME_NFC_NAMING_CODE = "nfc_naming_code"; - private ToscaModelConverter() { } @@ -48,7 +46,7 @@ public class ToscaModelConverter { public static ModelContext convert(ISdcCsarHelper helper) throws ToscaCsarException { ModelContext context = new ModelContext(); context.setService(generateService(helper.getServiceMetadata())); - context.setVfs(generateVfList(helper)); + context.setVnfs(generateVnfList(helper)); return context; } @@ -62,7 +60,7 @@ public class ToscaModelConverter { Service service = new Service(); if (serviceMetadata != null) { service.setName(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); - service.setInvariantUuid(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + service.setModelInvariantUUID(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); service.setUuid(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); } return service; @@ -74,24 +72,24 @@ public class ToscaModelConverter { * @return * @throws ToscaCsarException */ - private static List generateVfList(ISdcCsarHelper helper) throws ToscaCsarException { + private static List generateVnfList(ISdcCsarHelper helper) throws ToscaCsarException { - List vfList = new ArrayList<>(); + List vnfList = new ArrayList<>(); List vfNodeTemplateList = helper.getServiceVfList(); for (NodeTemplate vfNodeTemplate : vfNodeTemplateList) { - VF vf = new VF(); - vf.setName(vfNodeTemplate.getName()); - vf.setType(vfNodeTemplate.getType()); - vf.setInvariantUuid(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); - vf.setUuid(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + VNF vnf = new VNF(); + vnf.setName(vfNodeTemplate.getName()); + vnf.setType(vfNodeTemplate.getType()); + vnf.setModelInvariantUUID(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + vnf.setUuid(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); String customizationUUID = vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); - vf.setVnfcs(generateVnfcList(helper.getVfcListByVf(customizationUUID))); - vf.setVfModules(generateVfModuleList(helper.getVfModulesByVf(customizationUUID))); + vnf.setVnfcs(generateVnfcList(helper.getVfcListByVf(customizationUUID))); + vnf.setVfModules(generateVfModuleList(helper.getVfModulesByVf(customizationUUID))); - vfList.add(vf); + vnfList.add(vnf); } - return vfList; + return vnfList; } /** @@ -105,14 +103,8 @@ public class ToscaModelConverter { for (NodeTemplate vfcNodeTemplate : vfcNodeTemplateList) { VNFC vnfc = new VNFC(); vnfc.setName(vfcNodeTemplate.getName()); - vnfc.setInvariantUuid(vfcNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + vnfc.setModelInvariantUUID(vfcNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); vnfc.setUuid(vfcNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); - - Object nfcNamingCode = vfcNodeTemplate.getPropertyValue(PROPERTY_NAME_NFC_NAMING_CODE); - if (nfcNamingCode != null) { - vnfc.setType((String)nfcNamingCode); - } - vnfcList.add(vnfc); } return vnfcList; @@ -128,7 +120,7 @@ public class ToscaModelConverter { List vfModuleList = new ArrayList<>(); for (Group moduleGroup : vfModuleGroupList) { VFModule vfModule = new VFModule(); - vfModule.setInvariantUuid(moduleGroup.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)); + vfModule.setModelInvariantUUID(moduleGroup.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)); vfModule.setUuid(moduleGroup.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)); Object minInstances = moduleGroup.getPropertyValue(SdcPropertyNames.PROPERTY_NAME_MINVFMODULEINSTANCES); diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdc/unittest/service/SDCContextBuilderTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdc/unittest/service/SDCContextBuilderTest.java index 8ec198f..1dd000c 100644 --- a/src/test/java/org/onap/pomba/contextbuilder/sdc/unittest/service/SDCContextBuilderTest.java +++ b/src/test/java/org/onap/pomba/contextbuilder/sdc/unittest/service/SDCContextBuilderTest.java @@ -179,7 +179,7 @@ public class SDCContextBuilderTest { serviceInstanceId, modelVersionId, modelInvariantId); SDCContextResponse sdcResponse = springService.getModelData(request); assertTrue(sdcResponse.getModelData().contains("service")); - assertTrue(sdcResponse.getModelData().contains("vfList")); + assertTrue(sdcResponse.getModelData().contains("vnfList")); } -- cgit 1.2.3-korg