diff options
author | Sonsino, Ofir (os0695) <os0695@intl.att.com> | 2018-05-14 13:30:27 +0300 |
---|---|---|
committer | Sonsino, Ofir (os0695) <os0695@intl.att.com> | 2018-05-14 13:30:27 +0300 |
commit | 84183c37cc8fa626f85e1651df8827cae2a94819 (patch) | |
tree | 5535290eb95a33b2370cad260b3c746f11b5b97d | |
parent | 5da04228a33e616d2b5909d1ec5e35274b5808f1 (diff) |
Scale out and CM update
Change-Id: I313a82dfa92e49f868ea0d0b8a3ed1bffee423c9
Issue-ID: VID-188
Signed-off-by: Sonsino, Ofir (os0695) <os0695@intl.att.com>
6 files changed, 129 insertions, 51 deletions
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 @@ <div class="table-header table-row"> <div></div> - <div>VNF instance name</div> + <div>Service Instance Name</div> + <div>VNF Instance Name</div> <div>Model V</div> <div>Category</div> - <div>Sub Category</div> <div>UUID</div> <div>Invariant UUID</div> </div> - <div class="table-row" ng-repeat-start="vnf in vm.changeManagement.vnfNames" ng-if="vnf['prov-status'] === 'PROV'"> - <div></div> - <div>{{vnf.name}} service instance name: {{vnf['service-instance-node'].properties['service-instance-name']}}</div> - <div>2</div> - <div>Category</div> - <div>Sub Category</div> + <div class="table-row" ng-repeat-start="vnf in vm.changeManagement.vnfNames" ng-if="vnf['prov-status'] === 'PROV'" ng-click="vnf.isOpen=!!!vnf.isOpen"> + <div>+</div> + <div>{{vnf['service-instance-node'].properties['service-instance-name']}}</div> + <div>{{vnf.name}}</div> + <div>{{vnf['availableVersions'][0].modelInfo.modelVersion}}</div> + <div>{{vnf.category}}</div> <div>{{vnf.modelVersionId}}</div> <div>{{vnf['invariant-id']}}</div> </div> - <div class="modules-table open" ng-repeat-end=""> + <div class="modules-table" ng-repeat-end="" ng-class="{'open' :vnf.isOpen}"> <div class="table-header table-row"> <div>VF Module</div> <div>In Service</div> @@ -124,13 +124,17 @@ <div>File</div> </div> - <div class="table-row" ng-repeat="(key, module) in vnf.vfModules"> - <div>{{module.modelCustomizationName}}</div> - <div>{{module.properties.minCountInstances}} - {{module.properties.maxCountInstances}}</div> - <div>Category</div> - <div>{{module.uuid}}</div> + <div class="table-row" ng-repeat="(custUUID, moduleArr) in vnf.groupModules"> + <div>{{moduleArr[0].modelCustomizationName}}</div> + <div>{{moduleArr.length}}</div> + <div ng-if="moduleArr[0].properties.minCountInstances == moduleArr[0].properties.maxCountInstances">N/A</div> + <div ng-if="moduleArr[0].properties.minCountInstances != moduleArr[0].properties.maxCountInstances"> + <input type="number" ng-model="moduleArr[0].scale" step="1" + ng-min="moduleArr[0].properties.minCountInstances" ng-max="moduleArr[0].properties.maxCountInstances - moduleArr.length" /> + </div> + <div>{{moduleArr[0].uuid}}</div> <div> - <input type="file" ng-model="module.file" accept="application/json" /> + <input type="file" accept="application/json" onchange="angular.element(this).scope().setPreload(this)" /> </div> </div> </div> @@ -139,7 +143,7 @@ <div class="modal-footer"> <div class="pull-right"> - <button ng-if="!vm.isScaleOut() || (vm.isScaleOut() && vm.wizardStep === 2)" type="submit" id="submit" name="submit" class="btn btn-primary" data-ng-disabled="newChangeManagement.$invalid">Schedule</button> + <button ng-if="!vm.isScaleOut() || (vm.isScaleOut() && vm.wizardStep === 2)" type="submit" id="submit" name="submit" class="btn btn-primary" data-ng-disabled="newChangeManagement.$invalid">{{vm.hasScheduler ? "Schedule" : "Confirm"}}</button> <button ng-if="vm.isScaleOut() && vm.wizardStep === 1" ng-click="vm.nextStep();" type="button" id="next" name="next" class="btn btn-primary" data-ng-disabled="newChangeManagement.$invalid">Next</button> <button type="button" id="cancel" name="cancel" class="btn btn-white" ng-click="vm.close()">Cancel</button> </div> diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/change-management.html index 94a1790db..65c8ec713 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/change-management.html +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/change-management.html @@ -59,7 +59,7 @@ </table> </div> <div class="table-wrapper"> - <table class="table table-bordered" data-tests-id="pending-table-cm" id="pending-table"> + <table ng-if="vm.hasScheduler" class="table table-bordered" data-tests-id="pending-table-cm" id="pending-table"> <thead ng-click="collapsePending=!collapsePending"> <tr class="table-headline-row"> <th class="col-md-6"> |