From 84183c37cc8fa626f85e1651df8827cae2a94819 Mon Sep 17 00:00:00 2001 From: "Sonsino, Ofir (os0695)" Date: Mon, 14 May 2018 13:30:27 +0300 Subject: Scale out and CM update Change-Id: I313a82dfa92e49f868ea0d0b8a3ed1bffee423c9 Issue-ID: VID-188 Signed-off-by: Sonsino, Ofir (os0695) --- .../org/onap/vid/mso/MsoBusinessLogicImpl.java | 6 +- .../controller/change-management.controller.js | 5 +- .../new-change-management.controller.js | 102 ++++++++++++++++----- .../new-change-management.css | 29 +++++- .../new-change-management.html | 36 ++++---- .../vid/scripts/view-models/change-management.html | 2 +- 6 files changed, 129 insertions(+), 51 deletions(-) (limited to 'vid-app-common') diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java index f15c7e5b2..10ac231bf 100644 --- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java +++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java @@ -556,12 +556,12 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic { final String noValidPayloadMsg = "No valid payload in " + ChangeManagementRequest.VNF_IN_PLACE_SOFTWARE_UPDATE + " request"; Map payload = getChangeManagementPayload(requestDetails, noValidPayloadMsg); - validateUpdateVnfSoftwarePayloadProperty(payload, noValidPayloadMsg, "existing-software-version", SOFTWARE_VERSION_PATTERN); - validateUpdateVnfSoftwarePayloadProperty(payload, noValidPayloadMsg, "new-software-version", SOFTWARE_VERSION_PATTERN); + validateUpdateVnfSoftwarePayloadProperty(payload, noValidPayloadMsg, "existing_software_version", SOFTWARE_VERSION_PATTERN); + validateUpdateVnfSoftwarePayloadProperty(payload, noValidPayloadMsg, "new_software_version", SOFTWARE_VERSION_PATTERN); //if "operations-timeout" is not integer, trying to read it as String that represent a number if (!(payload.get("operations-timeout") instanceof Integer)) { - validateUpdateVnfSoftwarePayloadProperty(payload, noValidPayloadMsg, "operations-timeout", NUMBER_PATTERN); + validateUpdateVnfSoftwarePayloadProperty(payload, noValidPayloadMsg, "operations_timeout", NUMBER_PATTERN); } } diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js index 273f13017..488ada697 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js @@ -1,12 +1,13 @@ (function () { 'use strict'; - appDS2.controller("changeManagementController", ["$uibModal", "changeManagementService", "_", "$log", "SchedulerService", "$filter", changeManagementController]); + appDS2.controller("changeManagementController", ["$uibModal", "changeManagementService", "_", "$log", "SchedulerService", "$filter", "VIDCONFIGURATION", changeManagementController]); - function changeManagementController($uibModal, changeManagementService, _, $log, SchedulerService, $filter) { + function changeManagementController($uibModal, changeManagementService, _, $log, SchedulerService, $filter, VIDCONFIGURATION) { var vm = this; vm.lastTimeUpdated = ""; + vm.hasScheduler = !!VIDCONFIGURATION.SCHEDULER_PORTAL_URL; vm.init = function() { vm.lastTimeUpdated = $filter('date')(new Date(), "MM/dd/yyyy | HH:mm:ss"); 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 e337a5271..68f3b02fb 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 @@ -7,6 +7,7 @@ function newChangeManagementModalController($uibModalInstance, $uibModal,$q, AaiService, changeManagementService, Upload, $log, $scope, _, COMPONENT, VIDCONFIGURATION) { var vm = this; + vm.hasScheduler = !!VIDCONFIGURATION.SCHEDULER_PORTAL_URL; vm.configUpdatePatternError = "Invalid file type. Please select a file with a CSV extension."; vm.configUpdateContentError = "Invalid file structure."; vm.controllers = VIDCONFIGURATION.SCALE_OUT_CONTROLLERS; @@ -60,6 +61,10 @@ if (newVNFName["invariant-id"] === vnf.invariantUuid) { availableVersions.push(extractVNFModel(vnf, response.data.service, newVNFName)); newVNFName.vfModules = vnf.vfModules; + + //for scale out screen + newVNFName.category = response.data.service.category; + newVNFName.groupModules = _.groupBy(newVNFName.vfModules, "customizationUuid"); } }); var versions = _.uniqBy(availableVersions, 'modelInfo.modelVersion'); @@ -155,6 +160,9 @@ try{ var requestInfoData ={}; var requestParametersData ={}; + var moduleToScale = _.find(vnf.vfModules, function(key, item){ + return !item.scale; + }); if (vnf.availableVersions && vnf.availableVersions.length!=0){ requestInfoData ={ @@ -185,10 +193,19 @@ payload: changeManagement.configUpdateFile } }else if(workflowType=="VNF Scale Out"){ - requestParametersData = { - controllerType: changeManagement.controllerType - //userParams: { ..json.. } - //usePreload: false + + if(moduleToScale.userParams) { + requestParametersData = { + controllerType: changeManagement.controllerType, + userParams: moduleToScale.userParams, + usePreload: true + } + }else{ + requestParametersData = { + controllerType: changeManagement.controllerType, + userParams: [], + usePreload: false + } } } $log.info('SchedulerWidgetCtrl:extractChangeManagementCallbackDataStr info:: workflowType '+ workflowType); @@ -207,25 +224,46 @@ requestParametersData = { payload: changeManagement.configUpdateFile } - } - - var data = { - vnfName: vnf.name, - vnfInstanceId: vnf.id, - modelInfo: { - modelType: 'vnf', - modelInvariantId: vnf.properties['model-invariant-id'], - modelVersionId: vnf.modelVersionId, - modelName: vnf.properties['vnf-name'], - modelVersion: vnf.version, - modelCustomizationName: vnf.properties['model-customization-name'], - modelCustomizationId: vnf.properties['model-customization-id'] - }, - cloudConfiguration: vnf.cloudConfiguration, - requestInfo: requestInfoData, - relatedInstanceList: [], - requestParameters:requestParametersData - }; + } + + + var data; + if(workflowType=="VNF Scale Out") { + var name = moduleToScale.modelCustomizationName.split('-')[0]; //example: vSAMP12..base..module-0 + name = name + "-" + vnf.groupModules[moduleToScale.customizationUuid].length; + + data = { + modelInfo: { + modelType: 'vfModule', + modelInvariantId: moduleToScale.invariantUuid, + modelName: name, + modelVersion: moduleToScale.version, + modelCustomizationId: moduleToScale.customizationUuid + }, + cloudConfiguration: vnf.cloudConfiguration, + requestInfo: requestInfoData, + relatedInstanceList: [], + requestParameters:requestParametersData + } + }else{ + data = { + vnfName: vnf.name, + vnfInstanceId: vnf.id, + modelInfo: { + modelType: 'vnf', + modelInvariantId: vnf.properties['model-invariant-id'], + modelVersionId: vnf.modelVersionId, + modelName: vnf.properties['vnf-name'], + modelVersion: vnf.version, + modelCustomizationName: vnf.properties['model-customization-name'], + modelCustomizationId: vnf.properties['model-customization-id'] + }, + cloudConfiguration: vnf.cloudConfiguration, + requestInfo: requestInfoData, + relatedInstanceList: [], + requestParameters:requestParametersData + } + } var serviceInstanceId = ''; _.forEach(vnf['service-instance-node'], function (instanceNode) { @@ -265,7 +303,7 @@ } vm.openModal = function () { - if(VIDCONFIGURATION.SCHEDULER_PORTAL_URL) { //scheduling supported + if(vm.hasScheduler) { //scheduling supported $scope.widgetParameter = ""; // needed by the scheduler? // properties needed by the scheduler so it knows whether to show @@ -552,6 +590,22 @@ return vm.changeManagement.workflow === COMPONENT.WORKFLOWS.vnfInPlace; }; + vm.setPreload = function (fileEl) { + var files = fileEl.files; + var file = files[0]; + var reader = new FileReader(); + + reader.onloadend = function(evt) { + if (evt.target.readyState === FileReader.DONE) { + $scope.$apply(function () { + $scope.moduleArr[0].userParams = JSON.parse(evt.target.result); + }); + } + }; + + reader.readAsText(file); + }; + init(); } })(); \ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css index 4dc2d399a..34a6af45d 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css @@ -14,12 +14,13 @@ } .scale-out-modules .table-row > div:nth-child(1) { flex: 40px 0 0; + font-size: 22px; } .scale-out-modules .table-row > div:nth-child(2) { - flex: 363px 1 0; + flex: 220px 1 0; } .scale-out-modules .table-row > div:nth-child(3) { - flex: 90px 0 0; + flex: 200px 1 0; } .scale-out-modules .table-row > div:nth-child(4), .scale-out-modules .table-row > div:nth-child(5) { flex: 150px 0 0; @@ -27,11 +28,25 @@ .scale-out-modules .table-row > div:nth-child(6), .scale-out-modules .table-row > div:nth-child(7) { flex: 120px 0 0; } +.scale-out-modules .table-row.open > div { + line-height: 29px; + border-top: 1px #009FDB solid; + border-bottom: 1px #009FDB solid; +} +.scale-out-modules .table-row.open > div:last-child { + box-shadow: 0px 0px 0px 0px red, 1px 0px 0px 0px #009FDB; +} +.scale-out-modules .table-row.open > div:nth-child(1) { + border-color: green; +} +.scale-out-modules .table-row.open > div:nth-child(2) { + color: #009FDB; +} .scale-out-modules .table-header { border-bottom: none; } .scale-out-modules .table-header > div { - background-color: #F2F2F2;"" + background-color: #F2F2F2; color: black; font-size: 12px; } @@ -48,6 +63,7 @@ } .scale-out-modules .modules-table .table-row > div:nth-child(1) { flex: 539px 0 0; + font-size: 13px; } .scale-out-modules .modules-table .table-row > div:nth-child(2) { flex: 90px 0 0; @@ -69,6 +85,7 @@ /*LESS*/ /* + .scale-out-modules{ .table-row{ @@ -88,12 +105,13 @@ &:nth-child(1){ flex:40px 0 0; + font-size:22px; } &:nth-child(2){ - flex:363px 1 0; + flex:220px 1 0; } &:nth-child(3){ - flex:90px 0 0; + flex:200px 1 0; } &:nth-child(4), &:nth-child(5){ flex:150px 0 0; @@ -145,6 +163,7 @@ &:nth-child(1){ flex:539px 0 0; + font-size:13px; } &:nth-child(2){ flex:90px 0 0; diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html index e14af86d4..fa06258f1 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html @@ -98,24 +98,24 @@
-
VNF instance name
+
Service Instance Name
+
VNF Instance Name
Model V
Category
-
Sub Category
UUID
Invariant UUID
-
-
-
{{vnf.name}} service instance name: {{vnf['service-instance-node'].properties['service-instance-name']}}
-
2
-
Category
-
Sub Category
+
+
+
+
{{vnf['service-instance-node'].properties['service-instance-name']}}
+
{{vnf.name}}
+
{{vnf['availableVersions'][0].modelInfo.modelVersion}}
+
{{vnf.category}}
{{vnf.modelVersionId}}
{{vnf['invariant-id']}}
-
+
VF Module
In Service
@@ -124,13 +124,17 @@
File
-
-
{{module.modelCustomizationName}}
-
{{module.properties.minCountInstances}} - {{module.properties.maxCountInstances}}
-
Category
-
{{module.uuid}}
+
+
{{moduleArr[0].modelCustomizationName}}
+
{{moduleArr.length}}
+
N/A
+
+ +
+
{{moduleArr[0].uuid}}
- +
@@ -139,7 +143,7 @@
- +
-- cgit 1.2.3-korg