aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTait,Trevor(rt0435) <rtait@amdocs.com>2019-01-14 14:59:12 -0500
committerTait,Trevor(rt0435) <rtait@amdocs.com>2019-01-14 14:59:49 -0500
commit0bfedbcc8907a479ea86b8f04d4fb012ec2c9a29 (patch)
treeee6a5d0ce03ad109e0a1ae17376120c3ed307eaa
parent0c7501c3561a6bd0b78984aa2c1c27c14c802738 (diff)
Upgrade sdc-context-builder to audit-common.1.4.0
Issue-ID: LOG-926 Change-Id: Idc2816e791290b1067a5fb5db3c0cd18d29c45c8 Signed-off-by: Tait,Trevor(rt0435) <rtait@amdocs.com>
-rw-r--r--pom.xml2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdc/model/handlers/ToscaModelConverter.java40
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdc/unittest/service/SDCContextBuilderTest.java2
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 @@
<dependency>
<groupId>org.onap.logging-analytics.pomba</groupId>
<artifactId>pomba-audit-common</artifactId>
- <version>1.3.1</version>
+ <version>1.4.0-SNAPSHOT</version>
</dependency>
<dependency>
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<VF> generateVfList(ISdcCsarHelper helper) throws ToscaCsarException {
+ private static List<VNF> generateVnfList(ISdcCsarHelper helper) throws ToscaCsarException {
- List<VF> vfList = new ArrayList<>();
+ List<VNF> vnfList = new ArrayList<>();
List<NodeTemplate> 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<VFModule> 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"));
}