diff options
author | Sonsino, Ofir (os0695) <os0695@intl.att.com> | 2018-05-30 12:22:29 +0300 |
---|---|---|
committer | Sonsino, Ofir (os0695) <os0695@intl.att.com> | 2018-05-30 12:22:29 +0300 |
commit | 97836a9cc172c5857bdfc9aa292ec181c738ed7a (patch) | |
tree | 653bac8326e2e93c5e1ef43224f733e8e9ec3a01 /vid-app-common | |
parent | 683c41801c25daafd5c5edf10555898c038bce58 (diff) |
Scale out fix for vfmodule count
Change-Id: I9bd6fe9439f5779afd9711489a1c3b850f6c864e
Issue-ID: VID-188
Signed-off-by: Sonsino, Ofir (os0695) <os0695@intl.att.com>
Diffstat (limited to 'vid-app-common')
-rw-r--r-- | vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js index 086ae0ff..e4ff1a06 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js @@ -66,10 +66,24 @@ newVNFName.vfModules = vnf.vfModules; newVNFName.category = response.data.service.category; newVNFName.groupModules = _.groupBy(newVNFName.vfModules, "customizationUuid"); + + //list vfmodules ids in AAI that belong to that vnf instance + var modulesAaiIds = _.filter(newVNFName.relatedTo, function(item){ + return item["node-type"] === "vf-module"; + }).map(function(item){ + return item.id; + }); + _.forEach(newVNFName.vfModules, function (mdl, key) { mdl.scale = false; //defaults to not scale unless user changes it if(mdl.properties && mdl.properties.max_vf_module_instances) { - mdl.scalable = mdl.properties.max_vf_module_instances.value - newVNFName.groupModules[mdl.customizationUuid].length > 0; + + //how many vf modules of the same customizationId belong to that vnf instance + mdl.currentCount = _.filter(vm.vfModules, function(item){ + return modulesAaiIds.indexOf(item.id) > -1 && item.properties["model-customization-id"] === mdl.customizationUuid; + }).length; + + mdl.scalable = mdl.properties.max_vf_module_instances.value - mdl.currentCount > 0; }else{ mdl.scalable = false; } @@ -254,7 +268,7 @@ relatedInstanceList: [], requestParameters:requestParametersData }; - requestInfoData.instanceName = vnf.name + "_" + (vnf.groupModules[moduleToScale.customizationUuid].length + 1); + requestInfoData.instanceName = vnf.name + "_" + (moduleToScale.currentCount + 1); }else{ data = { vnfName: vnf.name, @@ -389,6 +403,7 @@ // var promiseArrOfGetVnfs = preparePromiseArrOfGetVnfs(instances); vm.vnfs = []; + vm.vfModules = []; AaiService.getVnfsByCustomerIdAndServiceType( vm.changeManagement.subscriberId, @@ -407,6 +422,8 @@ } } else if (nodeType === "service-instance") { vm.serviceInstances.push(vnfsData[i]); + } else if (nodeType === "vf-module") { + vm.vfModules.push(vnfsData[i]); } } } |