aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/reception-plugins/src/main
diff options
context:
space:
mode:
authorliboNet <libo.zhu@intel.com>2018-10-01 04:01:30 +0800
committerliboNet <libo.zhu@intel.com>2018-10-01 04:01:30 +0800
commit5e880aefe549a5825429740962c1acf9ff91e49e (patch)
treedc68b0b6348172bc88d534222ef7fd586a92f883 /plugins/reception-plugins/src/main
parentca479a6ab265de8b3d45a8ad194eaf5063a3ad36 (diff)
Update the schema parse based on newer version
the schema format of HPA requirement has been modified so that the parse needs update too based on the wiki: https://wiki.onap.org/display/DW/Specifying+HPA+ Capability+Requirements+using+TOSCA-based+VNF+Descriptors Change-Id: I48b39797e70d686ed0b9b2e7001b9a00068e76fd Issue-ID: POLICY-1160 Signed-off-by: liboNet <libo.zhu@intel.com>
Diffstat (limited to 'plugins/reception-plugins/src/main')
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/ExtractFromNode.java32
1 files changed, 19 insertions, 13 deletions
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/ExtractFromNode.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/ExtractFromNode.java
index d60aa113..4f822b20 100644
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/ExtractFromNode.java
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/ExtractFromNode.java
@@ -48,7 +48,7 @@ import org.onap.sdc.toscaparser.api.RequirementAssignment;
*/
public class ExtractFromNode {
- private static final String CONFIGURATION_VALUE = "configuration-value";
+ private static final String CONFIGURATION_VALUE = "configurationValue";
private static final Logger LOGGER = FlexLogger.getLogger(ExtractFromNode.class);
private static final String VDU_TYPE = "tosca.nodes.nfv.Vdu.Compute";
private static final String VDU_CP_TYPE = "tosca.nodes.nfv.VduCp";
@@ -215,8 +215,8 @@ public class ExtractFromNode {
/**
* GenerateHugePages, supported hpa features, All under the capability of tosca.nodes.nfv.Vdu.Compute. The format is
- * a map like: {"schema-version": "0", "schema-location": "", "platform-id": "generic", "mandatory": true,
- * "configuration-value": "2 MB"}
+ * a map like: {"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true",
+ * "configurationValue": "2 MB"}
*
* @param capabilityAssignment represents the capability of node
*
@@ -227,11 +227,14 @@ public class ExtractFromNode {
sdcCsarHelper.getCapabilityPropertyLeafValue(capabilityAssignment, MEMORY_PAGE_SIZE_PATH);
LOGGER.debug("the memoryPageSize = " + memoryPageSize);
if (memoryPageSize != null) {
- final Map<String, Object> retMap =
- gson.fromJson(memoryPageSize, new TypeToken<HashMap<String, Object>>() {}.getType());
+ final Map<String, String> retMap =
+ gson.fromJson(memoryPageSize, new TypeToken<HashMap<String, String>>() {}.getType());
LOGGER.debug("the retMap = " + retMap);
- final String memoryPageSizeValue = retMap.get(CONFIGURATION_VALUE).toString();
- final String mandatory = retMap.get("mandatory").toString();
+ final String memoryPageSizeValue = retMap.get(CONFIGURATION_VALUE);
+ final String mandatory = retMap.get("mandatory");
+ if (memoryPageSizeValue == null) {
+ return;
+ }
final HpaFeatureAttribute hpaFeatureAttribute =
generateHpaFeatureAttribute("memoryPageSize", memoryPageSizeValue);
final FlavorProperty flavorProperty = new FlavorProperty();
@@ -283,7 +286,7 @@ public class ExtractFromNode {
return;
}
} else {
- LOGGER.debug(" no configuration-value defined in interfaceType");
+ LOGGER.debug(" no configurationValue defined in interfaceType");
return;
}
@@ -303,8 +306,8 @@ public class ExtractFromNode {
/**
* GenerateNetworkFeature, all pci feature are grouped into FlavorFeature together. The format is a map like:
- * {"schema-version": "0", "schema-location": "", "platform-id": "generic", "mandatory": true,
- * "configuration-value": "2 MB"}
+ * {"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true",
+ * "configurationValue": "2 MB"}
*
* @param networkHpaFeature represents the specified Hpa feature
* @param node represents the CP Node
@@ -321,9 +324,12 @@ public class ExtractFromNode {
final String pciValue = sdcCsarHelper.getNodeTemplatePropertyLeafValue(node, pciKeyPath);
if (pciValue != null) {
LOGGER.debug("the pciValue = " + pciValue);
- final Map<String, Object> retMap =
- gson.fromJson(pciValue, new TypeToken<HashMap<String, Object>>() {}.getType());
- final String pciConfigValue = retMap.get(CONFIGURATION_VALUE).toString();
+ final Map<String, String> retMap =
+ gson.fromJson(pciValue, new TypeToken<HashMap<String, String>>() {}.getType());
+ final String pciConfigValue = retMap.get(CONFIGURATION_VALUE);
+ if (pciConfigValue == null) {
+ return;
+ }
final HpaFeatureAttribute hpaFeatureAttribute = generateHpaFeatureAttribute(pciKey, pciConfigValue);
flavorProperty.getHpaFeatureAttributes().add(hpaFeatureAttribute);
}