summaryrefslogtreecommitdiffstats
path: root/asdc-controller/src
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-02-14 18:12:24 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-02-14 18:12:43 -0500
commitdee8836500bde1433ab74b1a5006b27e8cd7ea07 (patch)
tree55e3f3d4e0eff4f55ee3f26579ea8f522a707fc2 /asdc-controller/src
parent1d69925fef5c972f045081db9b5e4795d96c6f84 (diff)
extract subinterface_network_quantity from policy
- Removed duplicate code that was causing a NumberFormatException - Changed name from crTarget to policyNetworkCollection - Added code to check we are setting the quantity on the correct NetworkCollection - Added code to extract the subinterface_network_quantity from the nodeTemplate policy Change-Id: Id12fa0241f16bfd4467209f08af5068d57b2d049 Issue-ID: SO-1510 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'asdc-controller/src')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java49
1 files changed, 39 insertions, 10 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index 4f64af0110..f8d9d6c96c 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -1220,16 +1220,32 @@ public class ToscaResourceInstaller {
crInstanceGroupCustomization.setModelCustomizationUUID(
networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- String quantityName = instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
- String fixedQuantity = quantityName.replace("NetworkCollection", "Fixed");
- if (toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
- fixedQuantity + "_quantity") != null) {
-
- crInstanceGroupCustomization.setSubInterfaceNetworkQuantity(Integer.parseInt(
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
- fixedQuantity + "_quantity")));
+ // Loop through the template policy to find the subinterface_network_quantity property name. Then extract the value for it.
+ List<Policy> policyList = toscaResourceStructure.getSdcCsarHelper().getPoliciesOfOriginOfNodeTemplateByToscaPolicyType(networkNodeTemplate, "org.openecomp.policies.scaling.Fixed");
+
+ if(policyList != null){
+ for(Policy policy : policyList){
+ for(String policyNetworkCollection : policy.getTargets()){
+
+ if(policyNetworkCollection.equalsIgnoreCase(group.getName())){
+
+ Map<String, Object> propMap = policy.getPolicyProperties();
+
+ if(propMap.get("quantity") != null){
+
+ String quantity = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, getPropertyInput(propMap.get("quantity").toString()));
+
+ if(quantity != null){
+ crInstanceGroupCustomization.setSubInterfaceNetworkQuantity(Integer.parseInt(quantity));
+ }
+
+ }
+
+ }
+ }
+ }
}
-
+
crInstanceGroupCustomization.setDescription(
toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)
@@ -1246,7 +1262,6 @@ public class ToscaResourceInstaller {
networkInstanceGroupList.add(networkInstanceGroup);
- //}
toscaResourceStructure.setCatalogNetworkInstanceGroup(networkInstanceGroupList);
@@ -2032,6 +2047,20 @@ public class ToscaResourceInstaller {
+ vfModuleStructure.getVfModuleMetadata().getVfModuleModelName();
}
+ protected String getPropertyInput(String propertyName){
+
+ String inputName = new String();
+
+ if (propertyName != null) {
+ int getInputIndex = propertyName.indexOf("{get_input=");
+ if (getInputIndex > -1) {
+ inputName = propertyName.substring(getInputIndex+11, propertyName.length()-1);
+ }
+ }
+
+ return inputName;
+ }
+
protected static Timestamp getCurrentTimeStamp() {