diff options
author | RachelF <rachel.fishbein@intl.att.com> | 2019-07-23 09:05:23 +0300 |
---|---|---|
committer | RachelF <rachel.fishbein@intl.att.com> | 2019-07-25 14:37:39 +0300 |
commit | ec47169ebb8d480fed1f4bf513a0e79e0243da4e (patch) | |
tree | 0cc3482f1edb010e4fb5400d818302e9c5978b7d | |
parent | bfcf8e43eab481162f41eb5076a7bf7c67f0ad22 (diff) |
Merge workflow from vid to onap, fix workflow selenium tests
Issue-ID: VID-532
Change-Id: I5ae0a74d382cd31a9da1ec5b1220c5322f3abb40
Signed-off-by: RachelF <rachel.fishbein@intl.att.com>
8 files changed, 383 insertions, 284 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java b/vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java index b44bce163..9ec917d9c 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java @@ -21,11 +21,16 @@ package org.onap.vid.model; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + /** * Created by Oren on 7/4/17. */ + +@JsonIgnoreProperties(ignoreUnknown = true) public class Subscriber { @JsonProperty("global-customer-id") @@ -39,8 +44,4 @@ public class Subscriber { @JsonProperty("resource-version") public String resourceVersion; - - - - } 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 eea501f15..d5040b138 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 @@ -128,10 +128,10 @@ //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; - }); + 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 @@ -164,10 +164,10 @@ var extractVNFModel = function (csarVNF, sdcService, selectionVNF) { /** - @param selectionVNF A vnf *instance* selected in "available VNF" drop-down box - @param csarVNF A VNF *MODEL* that has an invariantUuid same as selectionVNF (might be - a different version; i.e. selectionVNF.modelVersionId <> csarVNF.uuid) - @param sdcService The Service *MODEL* which has the related VNF `csarVNF`. + @param selectionVNF A vnf *instance* selected in "available VNF" drop-down box + @param csarVNF A VNF *MODEL* that has an invariantUuid same as selectionVNF (might be + a different version; i.e. selectionVNF.modelVersionId <> csarVNF.uuid) + @param sdcService The Service *MODEL* which has the related VNF `csarVNF`. */ var versionCsarData = { vnfInstanceId: "", @@ -233,177 +233,177 @@ }; - /***converting objects to scheduler format (taken from IST) - was altered for Scale out support ***/ - function extractChangeManagementCallbackDataStr(changeManagement) { - console.log(changeManagement); - var result = {}; - result.requestType = changeManagement.workflow; - var workflowType = changeManagement.workflow; - result.requestDetails = []; - _.forEach(changeManagement.vnfNames, function (vnf) { - - try{ - var requestInfoData ={}; - var requestParametersData ={}; - var moduleToScale = _.find(vnf.vfModules, {"scale": true}); - if (vnf.availableVersions && vnf.availableVersions.length!=0){ - - requestInfoData ={ - source: vnf.availableVersions[0].requestInfo.source, - suppressRollback: vnf.availableVersions[0].requestInfo.suppressRollback, - requestorId: vnf.availableVersions[0].requestInfo.requestorId - } - - if(workflowType=='Update'){ - requestParametersData = { - usePreload: vnf.availableVersions[0].requestParameters.usePreload - } - }else if(workflowType=="Replace"){ - requestParametersData = { - rebuildVolumeGroups: vnf.availableVersions[0].requestParameters.usePreload - } - }else if(workflowType=="VNF In Place Software Update"){ - var payloadObj = { - 'existing_software_version':vm.getInternalWorkFlowParameter(workflowType, 'text', 'Existing software version').value, - 'new_software_version':vm.getInternalWorkFlowParameter(workflowType, 'text', 'New software version').value, - 'operations_timeout':vm.getInternalWorkFlowParameter(workflowType, 'text', 'Operations timeout').value - }; - requestParametersData = { + /***converting objects to scheduler format (taken from IST) - was altered for Scale out support ***/ + function extractChangeManagementCallbackDataStr(changeManagement) { + console.log(changeManagement); + var result = {}; + result.requestType = changeManagement.workflow; + var workflowType = changeManagement.workflow; + result.requestDetails = []; + _.forEach(changeManagement.vnfNames, function (vnf) { + + try{ + var requestInfoData ={}; + var requestParametersData ={}; + var moduleToScale = _.find(vnf.vfModules, {"scale": true}); + if (vnf.availableVersions && vnf.availableVersions.length!=0){ + + requestInfoData ={ + source: vnf.availableVersions[0].requestInfo.source, + suppressRollback: vnf.availableVersions[0].requestInfo.suppressRollback, + requestorId: vnf.availableVersions[0].requestInfo.requestorId + } + + if(workflowType=='Update'){ + requestParametersData = { + usePreload: vnf.availableVersions[0].requestParameters.usePreload + } + }else if(workflowType=="Replace"){ + requestParametersData = { + rebuildVolumeGroups: vnf.availableVersions[0].requestParameters.usePreload + } + }else if(workflowType=="VNF In Place Software Update"){ + var payloadObj = { + 'existing_software_version':vm.getInternalWorkFlowParameter(workflowType, 'text', 'Existing software version').value, + 'new_software_version':vm.getInternalWorkFlowParameter(workflowType, 'text', 'New software version').value, + 'operations_timeout':vm.getInternalWorkFlowParameter(workflowType, 'text', 'Operations timeout').value + }; + requestParametersData = { + payload: JSON.stringify(payloadObj) + } + }else if(workflowType=="VNF Config Update"){ + requestParametersData = { + payload: vm.getInternalWorkFlowParameter("VNF Config Update", "FILE", "Attach configuration file").value + } + }else if(workflowType=="VNF Scale Out"){ + if(!moduleToScale) return null; + + if(moduleToScale.userParams) { + requestParametersData = { + userParams: moduleToScale.userParams + //,usePreload: true + } + }else{ + requestParametersData = { + userParams: [] + //,usePreload: false + } + } + } + $log.info('SchedulerWidgetCtrl:extractChangeManagementCallbackDataStr info:: workflowType '+ workflowType); + $log.info('SchedulerWidgetCtrl:extractChangeManagementCallbackDataStr info:: requestParametersData '+ requestParametersData); + + }else if(workflowType=="VNF In Place Software Update"){ + var payloadObj = { + 'existing_software_version':vm.getInternalWorkFlowParameter(workflowType, 'text', 'Existing software version').value, + 'new_software_version':vm.getInternalWorkFlowParameter(workflowType, 'text', 'New software version').value, + 'operations_timeout':vm.getInternalWorkFlowParameter(workflowType, 'text', 'Operations timeout').value + }; + requestParametersData = { payload: JSON.stringify(payloadObj) - } - }else if(workflowType=="VNF Config Update"){ - requestParametersData = { - payload: vm.getInternalWorkFlowParameter("VNF Config Update", "FILE", "Attach configuration file").value - } - }else if(workflowType=="VNF Scale Out"){ - if(!moduleToScale) return null; - - if(moduleToScale.userParams) { - requestParametersData = { - userParams: moduleToScale.userParams - //,usePreload: true - } - }else{ - requestParametersData = { - userParams: [] - //,usePreload: false - } - } - } - $log.info('SchedulerWidgetCtrl:extractChangeManagementCallbackDataStr info:: workflowType '+ workflowType); - $log.info('SchedulerWidgetCtrl:extractChangeManagementCallbackDataStr info:: requestParametersData '+ requestParametersData); - - }else if(workflowType=="VNF In Place Software Update"){ - var payloadObj = { - 'existing_software_version':vm.getInternalWorkFlowParameter(workflowType, 'text', 'Existing software version').value, - 'new_software_version':vm.getInternalWorkFlowParameter(workflowType, 'text', 'New software version').value, - 'operations_timeout':vm.getInternalWorkFlowParameter(workflowType, 'text', 'Operations timeout').value - }; - requestParametersData = { - payload: JSON.stringify(payloadObj) - } - }else if(workflowType=="VNF Config Update"){ - requestParametersData = { - payload: vm.getInternalWorkFlowParameter("VNF Config Update", "FILE", "Attach configuration file").value - } - } - - var data; - if(workflowType=="VNF Scale Out") { - data = { - vnfName: vnf.name, - vnfInstanceId: vnf.id, - modelInfo: { - modelType: 'vfModule', - modelInvariantId: moduleToScale.invariantUuid, - modelName: moduleToScale.modelCustomizationName, - modelVersion: moduleToScale.version, - modelCustomizationName: moduleToScale.modelCustomizationName, - modelCustomizationId: moduleToScale.customizationUuid, - modelVersionId: moduleToScale.uuid - }, - cloudConfiguration: vnf.cloudConfiguration, - requestInfo: requestInfoData, - relatedInstanceList: [], - requestParameters:requestParametersData, - configurationParameters: JSON.parse(vm.getInternalWorkFlowParameter("VNF Scale Out", "text", "Configuration Parameters").value) - }; - requestInfoData.instanceName = vnf.name + "_" + (moduleToScale.currentCount + 1); - }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 - }; - } + } + }else if(workflowType=="VNF Config Update"){ + requestParametersData = { + payload: vm.getInternalWorkFlowParameter("VNF Config Update", "FILE", "Attach configuration file").value + } + } - var serviceInstanceId = ''; - _.forEach(vnf['service-instance-node'], function (instanceNode) { - if(instanceNode['node-type'] === 'service-instance'){ - serviceInstanceId = instanceNode.properties['service-instance-id']; - } - }); - - if (vnf.availableVersions && vnf.availableVersions.length!=0){ - _.forEach(vnf.availableVersions[0].relatedInstanceList, function (related) { - var rel = related.relatedInstance; - var relatedInstance = { - instanceId: serviceInstanceId, - modelInfo: { - modelType: rel.modelInfo.modelType, - modelInvariantId: rel.modelInfo.modelInvariantId, - modelVersionId: rel.modelInfo.modelVersionId, - modelName: rel.modelInfo.modelName, - modelVersion: rel.modelInfo.modelVersion, - modelCustomizationName: rel.modelInfo.modelCustomizationName, - modelCustomizationId: rel.modelInfo.modelCustomizationId - } - }; - if (rel.vnfInstanceId) - relatedInstance.instanceId = rel.vnfInstanceId; - - data.relatedInstanceList.push({relatedInstance: relatedInstance}); - }); + var data; if(workflowType=="VNF Scale Out") { - //push vnf to related as well as the service instance - var relatedInstance = { - instanceId: vnf.id, + data = { + vnfName: vnf.name, + vnfInstanceId: vnf.id, modelInfo: { - modelCustomizationId: vnf.availableVersions[0].modelInfo.modelCustomizationId, - modelCustomizationName: vnf.availableVersions[0].modelInfo.modelCustomizationName, - modelInvariantId: vnf.availableVersions[0].modelInfo.modelInvariantId, - modelName: vnf.availableVersions[0].modelInfo.modelName, - modelType: vnf.availableVersions[0].modelInfo.modelType, - modelVersion: vnf.availableVersions[0].modelInfo.modelVersion, - modelVersionId: vnf.availableVersions[0].modelInfo.modelVersionId - } + modelType: 'vfModule', + modelInvariantId: moduleToScale.invariantUuid, + modelName: moduleToScale.modelCustomizationName, + modelVersion: moduleToScale.version, + modelCustomizationName: moduleToScale.modelCustomizationName, + modelCustomizationId: moduleToScale.customizationUuid, + modelVersionId: moduleToScale.uuid + }, + cloudConfiguration: vnf.cloudConfiguration, + requestInfo: requestInfoData, + relatedInstanceList: [], + requestParameters:requestParametersData, + configurationParameters: JSON.parse(vm.getInternalWorkFlowParameter("VNF Scale Out", "text", "Configuration Parameters").value) + }; + requestInfoData.instanceName = vnf.name + "_" + (moduleToScale.currentCount + 1); + }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 }; - data.relatedInstanceList.push({relatedInstance: relatedInstance}); } + + var serviceInstanceId = ''; + _.forEach(vnf['service-instance-node'], function (instanceNode) { + if(instanceNode['node-type'] === 'service-instance'){ + serviceInstanceId = instanceNode.properties['service-instance-id']; + } + }); + + if (vnf.availableVersions && vnf.availableVersions.length!=0){ + _.forEach(vnf.availableVersions[0].relatedInstanceList, function (related) { + var rel = related.relatedInstance; + var relatedInstance = { + instanceId: serviceInstanceId, + modelInfo: { + modelType: rel.modelInfo.modelType, + modelInvariantId: rel.modelInfo.modelInvariantId, + modelVersionId: rel.modelInfo.modelVersionId, + modelName: rel.modelInfo.modelName, + modelVersion: rel.modelInfo.modelVersion, + modelCustomizationName: rel.modelInfo.modelCustomizationName, + modelCustomizationId: rel.modelInfo.modelCustomizationId + } + }; + if (rel.vnfInstanceId) + relatedInstance.instanceId = rel.vnfInstanceId; + + data.relatedInstanceList.push({relatedInstance: relatedInstance}); + }); + if(workflowType=="VNF Scale Out") { + //push vnf to related as well as the service instance + var relatedInstance = { + instanceId: vnf.id, + modelInfo: { + modelCustomizationId: vnf.availableVersions[0].modelInfo.modelCustomizationId, + modelCustomizationName: vnf.availableVersions[0].modelInfo.modelCustomizationName, + modelInvariantId: vnf.availableVersions[0].modelInfo.modelInvariantId, + modelName: vnf.availableVersions[0].modelInfo.modelName, + modelType: vnf.availableVersions[0].modelInfo.modelType, + modelVersion: vnf.availableVersions[0].modelInfo.modelVersion, + modelVersionId: vnf.availableVersions[0].modelInfo.modelVersionId + } + }; + data.relatedInstanceList.push({relatedInstance: relatedInstance}); + } + } + }catch(err){ + $log.error('SchedulerCtrl::extractChangeManagementCallbackDataStr error: ' + err); + vm.errorMsg = err; } - }catch(err){ - $log.error('SchedulerCtrl::extractChangeManagementCallbackDataStr error: ' + err); - vm.errorMsg = err; - } - result.requestDetails.push(data); - }); - return JSON.stringify(result); - } + result.requestDetails.push(data); + }); + return JSON.stringify(result); + } - function getWorkflowParametersFromForm() { + function getWorkflowParametersFromForm() { let workflowParameters = {requestDetails:{ cloudConfiguration:{}, @@ -414,8 +414,8 @@ let parameters = vm.getRemoteWorkFlowParameters(vm.changeManagement.workflow); parameters.forEach((parameter)=>{ let inputField = document.getElementById('so-workflow-parameter-'+parameter.soFieldName); - workflowParameters.requestDetails.requestParameters.userParams[0][parameter.soFieldName]=inputField.value; - }); + workflowParameters.requestDetails.requestParameters.userParams[0][parameter.soFieldName]=inputField.value; + }); return workflowParameters; } @@ -423,13 +423,13 @@ vm.openModal = function () { if(vm.hasScheduler) { //scheduling supported vm.scheduleWorkflow(); - } else { + } else { //no scheduling support vm.executeWorkflow(); } }; - vm.scheduleWorkflow = function () { + vm.scheduleWorkflow = function () { $scope.widgetParameter = ""; // needed by the scheduler? // properties needed by the scheduler so it knows whether to show @@ -525,8 +525,8 @@ const nodeType = vnfsData[i]['node-type']; if (nodeType === "generic-vnf") { if (_.find(vnfsData[i]['related-to'], function (node) { - return node['node-type'] === 'vserver' - }) !== undefined) { + return node['node-type'] === 'vserver' + }) !== undefined) { vm.vnfs.push(vnfsData[i]); } } else if (nodeType === "service-instance") { @@ -566,8 +566,8 @@ var versions = []; _.forEach(vm.vnfs, function (vnf) { if (vnf.properties['nf-role'] === vm.changeManagement['vnfType'] - && vnf.properties["model-invariant-id"] - && vnf.properties["model-version-id"]) { + && vnf.properties["model-invariant-id"] + && vnf.properties["model-version-id"]) { vm.serviceInstancesToGetVersions.push({ "model-invariant-id": vnf.properties["model-invariant-id"], "model-version-id": vnf.properties["model-version-id"] @@ -710,70 +710,70 @@ }; vm.loadWorkFlows = function () { - vm.localWorkflowsParameters = new Map(); - vm.remoteWorkflowsParameters = new Map(); + vm.localWorkflowsParameters = new Map(); + vm.remoteWorkflowsParameters = new Map(); if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_HANDLE_SO_WORKFLOWS)) { - return vm.loadRemoteWorkFlows() - .then(function () { - vm.workflows = vm.remoteWorkflows.map(item => item.name); - }).then(function () { - vm.loadRemoteWorkFlowsParameters(); - }); - }else{ - return vm.loadLocalWorkFlows() - .then(vm.loadLocalWorkFlowsParameters) - .then(function () { - vm.workflows = vm.localWorkflows; - }) - } + return vm.loadRemoteWorkFlows() + .then(function () { + vm.workflows = vm.remoteWorkflows.map(item => item.name); + }).then(function () { + vm.loadRemoteWorkFlowsParameters(); + }); + }else{ + return vm.loadLocalWorkFlows() + .then(vm.loadLocalWorkFlowsParameters) + .then(function () { + vm.workflows = vm.localWorkflows; + }) + } }; vm.loadLocalWorkFlows = function () { - return changeManagementService.getWorkflows(vm.changeManagement.vnfNames) - .then(function (response) { - vm.localWorkflows = response.data.workflows || []; - }).catch(function (error) { - $log.error(error); - vm.errorMsg = error; - }); + return changeManagementService.getWorkflows(vm.changeManagement.vnfNames) + .then(function (response) { + vm.localWorkflows = response.data.workflows || []; + }).catch(function (error) { + $log.error(error); + vm.errorMsg = error; + }); }; vm.loadRemoteWorkFlows = function () { - let vnfModelIDs = vm.changeManagement.vnfNames.map(vnfName => vnfName.modelVersionId); - return changeManagementService.getSOWorkflows(vnfModelIDs) - .then(function (response) { - vm.remoteWorkflows = response.data || []; - }).catch(function (error) { - $log.error(error); - vm.errorMsg = error; - }); + let vnfModelIDs = vm.changeManagement.vnfNames.map(vnfName => vnfName.modelVersionId); + return changeManagementService.getSOWorkflows(vnfModelIDs) + .then(function (response) { + vm.remoteWorkflows = response.data || []; + }).catch(function (error) { + $log.error(error); + vm.errorMsg = error; + }); }; vm.loadLocalWorkFlowsParameters = function () { - vm.localWorkflows.forEach(function(workflow) { - vm.loadLocalWorkFlowParameters(workflow); - }); + vm.localWorkflows.forEach(function(workflow) { + vm.loadLocalWorkFlowParameters(workflow); + }); }; vm.loadLocalWorkFlowParameters = function (workflow) { - changeManagementService.getLocalWorkflowParameter(workflow) - .then(function (response) { - vm.localWorkflowsParameters.set(workflow, response.data.parameterDefinitions); - }) - .catch(function (error) { - $log.error(error); - vm.errorMsg = error; - }); + changeManagementService.getLocalWorkflowParameter(workflow) + .then(function (response) { + vm.localWorkflowsParameters.set(workflow, response.data.parameterDefinitions); + }) + .catch(function (error) { + $log.error(error); + vm.errorMsg = error; + }); }; vm.loadRemoteWorkFlowsParameters = function () { - vm.remoteWorkflows.forEach(function(workflow) { - if (workflow.source ==='SDC' || workflow.source === 'sdc' ){ - vm.loadRemoteWorkFlowParameters(workflow); - } else { - vm.loadLocalWorkFlowParameters(workflow.name); - } - }); + vm.remoteWorkflows.forEach(function(workflow) { + if (workflow.source ==='SDC' || workflow.source === 'sdc' ){ + vm.loadRemoteWorkFlowParameters(workflow); + } else { + vm.loadLocalWorkFlowParameters(workflow.name); + } + }); }; vm.loadRemoteWorkFlowParameters = function (workflow) { @@ -783,21 +783,21 @@ return param.soPayloadLocation === "userParams" }) .forEach(function (param) { - let workflowParams = vm.repackAttributes(param); - if (param.validation.length > 0) { - let validation = param.validation[0]; - if ('maxLength' in validation) { - workflowParams.maxLength = validation.maxLength; - } - if ('allowableChars' in validation) { - workflowParams.pattern = validation.allowableChars; + let workflowParams = vm.repackAttributes(param); + if (param.validation.length > 0) { + let validation = param.validation[0]; + if ('maxLength' in validation) { + workflowParams.maxLength = validation.maxLength; + } + if ('allowableChars' in validation) { + workflowParams.pattern = validation.allowableChars; + } } - } - workflowParams.type = param.inputType; + workflowParams.type = param.inputType; - parameters.push(workflowParams); - } - ); + parameters.push(workflowParams); + } + ); vm.remoteWorkflowsParameters.set(workflow.name, parameters); }; @@ -813,23 +813,35 @@ }; vm.getRemoteWorkFlowParameters = function (workflow) { - if (workflow && vm.remoteWorkflowsParameters.has(workflow)) { - return vm.remoteWorkflowsParameters.get(workflow) - } - return []; + if (workflow && vm.remoteWorkflowsParameters.has(workflow)) { + return vm.remoteWorkflowsParameters.get(workflow) + } + return []; }; + vm.hasPatternError = function(form, itemName){ + return form[itemName].$error.pattern; + } + + vm.hasAsyncFnError = function(form, itemName){ + return form[itemName].$error.validateAsyncFn; + } + + vm.getIdFor = function(type, id, name){ + return "internal-workflow-parameter-" + type + "-" + id + "-" + (name ? name.split(' ').join('-').toLowerCase() : ""); + } + vm.getInternalWorkFlowParameters = function (workflow, type) { if (workflow && vm.localWorkflowsParameters.has(workflow) && vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type==type) != []) { - return vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type==type) - } - return []; + return vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type==type); + } + return []; }; vm.getInternalWorkFlowParameter = function (workflow, type, parameterName) { if (workflow && vm.localWorkflowsParameters.has(workflow) && vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type==type) != []) { return vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type==type).filter(parameter => parameter.name === parameterName)[0] - } + } }; vm.getRemoteWorkflowSource = (workflow) => { @@ -896,4 +908,4 @@ 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.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html index 7ccddbafd..3f4a94ee0 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 @@ -7,9 +7,9 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -83,22 +83,22 @@ <div class="form-group" ng-if="vm.changeManagement.workflow" ng-repeat="item in vm.getInternalWorkFlowParameters(vm.changeManagement.workflow, 'FILE')"> <label class="control-label">{{item.name}}</label> <div class="file-wrapper"> - <input id="internal-workflow-parameter-file-{{item.id}}" class="file-input" type="file" ngf-select ng-model="item.value" ngf-validate-async-fn="vm.uploadConfigFile($file)" name="configUpdateFile" accept="{{item.acceptableFileType}}" ngf-pattern="{{item.acceptableFileType}}" ng-required="{{item.required}}"/> - <label id="internal-workflow-parameter-file-{{item.id}}-label" class="file-input-label">{{item.value&&item.value.name||"Select File"}} </label> - <label for="internal-workflow-parameter-file-{{item.id}}"><span class="icon-browse"></span></label> + <input id="{{vm.getIdFor('file',item.id,item.name)}}" ng-change="vm.onChange(item)" class="file-input" type="file" ngf-select ng-model="item.value" ngf-validate-async-fn="vm.uploadConfigFile($file)" ng-attr-name="{{'internal-workflow-parameter-file-name-' + item.id}}" accept="{{item.acceptableFileType}}" ngf-pattern="{{item.acceptableFileType}}" ng-required="{{item.required}}"/> + <label id="{{vm.getIdFor('file',item.id,item.name)}}-label" class="file-input-label">{{item.value&&item.value.name||"Select File"}} </label> + <label ng-attr-for="{{vm.getIdFor('file',item.id,item.name)}}"><span class="icon-browse"></span></label> </div> - <label id="errorLabel" class="icon-alert error" ng-if="item.value.$error.pattern">{{item.msgOnPatternError}}</label> - <label id="errorContentLabel" class="icon-alert error" ng-if="item.value.$error.validateAsyncFn">{{item.msgOnContentError}}</label> + <label id="errorLabel" class="icon-alert error" ng-if="vm.hasPatternError(newChangeManagement, 'internal-workflow-parameter-file-name-' + item.id)">{{item.msgOnPatternError}}</label> + <label id="errorContentLabel" class="icon-alert error" ng-if="vm.hasAsyncFnError(newChangeManagement, 'internal-workflow-parameter-file-name-' + item.id)">{{item.msgOnContentError}}</label> </div> <div class="form-group" ng-if="vm.changeManagement.workflow" ng-repeat="item in vm.getInternalWorkFlowParameters(vm.changeManagement.workflow, 'text')"> - <label for="internal-workflow-parameter-text-{{item.id}}" class="control-label">{{item.name}}</label> - <input ng-model="item.value" type="text" id="internal-workflow-parameter-text-{{item.id}}" pattern="{{item.pattern}}" ng-required="{{item.required}}"> + <label ng-attr-for="{{vm.getIdFor('text',item.id,item.name)}}" class="control-label">{{item.name}}</label> + <input ng-model="item.value" type="text" id="{{vm.getIdFor('text',item.id,item.name)}}" pattern="{{item.pattern}}" ng-required="{{item.required}}"> </div> <div class="form-group" ng-if="vm.changeManagement.workflow" ng-repeat="item in vm.getRemoteWorkFlowParameters(vm.changeManagement.workflow)"> - <label for="so-workflow-parameter-{{item.id}}" class="control-label">{{item.name}}</label> - <input ng-model="item.value" type="text" id="so-workflow-parameter-{{item.id}}" pattern="{{item.pattern}}" maxlength="{{item.maxLength}}" ng-required="{{item.required}}" soFieldName="{{item.soFieldName}}"> + <label for="so-workflow-parameter-{{item.id}}" class="control-label">{{item.name}}</label> + <input ng-model="item.value" type="text" id="so-workflow-parameter-{{item.id}}" pattern="{{item.pattern}}" maxlength="{{item.maxLength}}" ng-required="{{item.required}}" soFieldName="{{item.soFieldName}}"> </div> </div> @@ -146,7 +146,6 @@ </div> </div> </div> - </div> <div class="modal-footer"> @@ -155,9 +154,9 @@ </div> <div class="pull-right"> <button type="button" id="cancel" name="cancel" class="btn btn-white" ng-click="vm.close()">Cancel</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 ng-if="!vm.isScaleOut() || (vm.isScaleOut() && vm.wizardStep === 2) || vm.hasScheduler" 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) && !vm.hasScheduler" ng-click="vm.nextStep();" type="button" id="next" name="next" class="btn btn-primary" data-ng-disabled="newChangeManagement.$invalid">Next</button> <button ng-if="isShowErrorReport() && vm.errorMsg!==''" ng-click="showReportWindow()" type="button" class="btn btn-danger" >Create report</button> </div> </div> -</form> +</form>
\ No newline at end of file diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/scheduler/PresetDeleteSchedulerChangeManagement.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/scheduler/PresetDeleteSchedulerChangeManagement.java new file mode 100644 index 000000000..0005cbd75 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/scheduler/PresetDeleteSchedulerChangeManagement.java @@ -0,0 +1,26 @@ +package org.onap.simulator.presetGenerator.presets.scheduler; + +import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; +import org.springframework.http.HttpMethod; + +public class PresetDeleteSchedulerChangeManagement extends BasePreset { + + @Override + public HttpMethod getReqMethod() { + return HttpMethod.DELETE; + } + + @Override + public String getReqPath() { + return getRootPath() + "/83aec7bf-602f-49eb-9788-bbc33ac550d9"; + } + + @Override + protected String getRootPath() { + return "/scheduler/v1/ChangeManagement/schedules"; + } + + @Override + public int getResponseCode() { return 204; } + +} diff --git a/vid-automation/src/main/java/vid/automation/test/Constants.java b/vid-automation/src/main/java/vid/automation/test/Constants.java index 6605fe2e6..0e614dece 100644 --- a/vid-automation/src/main/java/vid/automation/test/Constants.java +++ b/vid-automation/src/main/java/vid/automation/test/Constants.java @@ -97,7 +97,7 @@ public class Constants { public static final String newModalFromVNFVersionInputId = "fromVNFVersion"; public static final String newModalVNFNameInputId = "vnfName"; public static final String newModalWorkFlowInputId = "workflow"; - public static final String newModalConfigUpdateInputId = "config-update-input"; + public static final String newModalConfigUpdateInputId = "internal-workflow-parameter-file-5-attach-configuration-file"; public static final String newModalTargetVersionInputsClass = "vnf-versions-select-as-text"; public static final String newModalSubscriberText = "CRAIG/ROBERTS"; public static final String newModalServiceTypeText = "vRichardson"; diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Features.java b/vid-automation/src/main/java/vid/automation/test/infra/Features.java index 005c06551..40f3013dd 100644 --- a/vid-automation/src/main/java/vid/automation/test/infra/Features.java +++ b/vid-automation/src/main/java/vid/automation/test/infra/Features.java @@ -40,6 +40,7 @@ public enum Features implements Feature { FLAG_1908_RESUME_MACRO_SERVICE, FLAG_1908_RELEASE_TENANT_ISOLATION, FLAG_1908_VNF_FC_NEW_INSTANTIATION_UI, + FLAG_HANDLE_SO_WORKFLOWS ; public boolean isActive() { diff --git a/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java b/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java index 2f5489f31..dbc603c26 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java @@ -8,6 +8,7 @@ import org.junit.Assert; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.onap.sdc.ci.tests.datatypes.UserCredentials; import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.simulator.presetGenerator.presets.scheduler.PresetDeleteSchedulerChangeManagement; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.RemoteWebElement; @@ -69,11 +70,13 @@ public class ChangeManagementTest extends VidBaseTestCase { private void openAndFill1stScreen(String vnfName, String vnfTargetVersion, String workflow) { String subscriberId = VNF_DATA_WITH_IN_PLACE.subscriberId; + String subscriberName = VNF_DATA_WITH_IN_PLACE.subscriberName; String serviceType = VNF_DATA_WITH_IN_PLACE.serviceType; String vnfType = VNF_DATA_WITH_IN_PLACE.vnfType; String vnfSourceVersion = VNF_DATA_WITH_IN_PLACE.vnfSourceVersion; ChangeManagementPage.openNewChangeManagementModal(); Wait.angularHttpRequestsLoaded(); + SelectOption.waitForOptionInSelect(subscriberName, "subscriberName"); ChangeManagementPage.selectSubscriberById(subscriberId); Wait.angularHttpRequestsLoaded(); SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalServiceTypeInputId, serviceType); @@ -119,6 +122,7 @@ public class ChangeManagementTest extends VidBaseTestCase { static final int vnfZrdm3amdns02test2Id = 11822; static final int vnfHarrisonKrisId = 12822; static String subscriberId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"; + static String subscriberName = "Emanuel"; static String serviceType = "vRichardson"; static String vnfType = "vMobileDNS"; static String vnfSourceVersion = "1.0"; @@ -164,6 +168,7 @@ public class ChangeManagementTest extends VidBaseTestCase { , "changeManagement/service-design-and-creation.json" , "changeManagement/mso_get_manual_task.json" , "changeManagement/mso_post_manual_task.json" + , "changeManagement/mso_get_change_managements_scaleout.json" ); SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(),SimulatorApi.RegistrationStrategy.APPEND); @@ -253,8 +258,10 @@ public class ChangeManagementTest extends VidBaseTestCase { @Test public void clickOnScheduledJob_SuccessfulMessageAppear() { + + SimulatorApi.registerExpectationFromPreset(new PresetDeleteSchedulerChangeManagement(),SimulatorApi.RegistrationStrategy.APPEND); + ChangeManagementPage.openChangeManagementPage(); -// Wait.angularHttpRequestsLoaded(); GeneralUIUtils.ultimateWait(); clickAndAssertOnCancelButton(SCHEDULED_ID); updateSimulatorWithParametersOfScheduledJod("get_scheduler_details_short_with_after_cancel" + @@ -305,6 +312,7 @@ public class ChangeManagementTest extends VidBaseTestCase { boolean isNotDisplayed = GeneralUIUtils.waitForElementInVisibilityByTestId("icon-status-" + scheduledId, 5); Assert.assertTrue(isNotDisplayed); } + public void updateSimulatorWithParametersOfScheduledJod(String jasonFile){ SimulatorApi.registerExpectation( new String[] {"changeManagement/"+jasonFile}, @@ -312,12 +320,15 @@ public class ChangeManagementTest extends VidBaseTestCase { ); } + @FeatureTogglingTest(value = Features.FLAG_HANDLE_SO_WORKFLOWS, flagActive = false) @Test public void testWorkflowVNFInPlaceSoftwareUpdateNotInWorkflowsListWhenNotExpected() { + List<String> workflows = getListOfWorkflowsFor("Harrison Kris"); assertThat(workflows, not(hasItem(VNF_DATA_WITH_IN_PLACE.workflowName))); } + @FeatureTogglingTest(value = Features.FLAG_HANDLE_SO_WORKFLOWS, flagActive = false) @Test public void testWorkflowVNFInPlaceSoftwareUpdateInWorkflowsListWhenExpected() { List<String> workflows = getListOfWorkflowsFor(VNF_DATA_WITH_IN_PLACE.vnfName); @@ -344,13 +355,14 @@ public class ChangeManagementTest extends VidBaseTestCase { @Test public void testWorkflowVNFInPlaceSoftwareUpdateShows3Fields() { + openAndFill1stScreenWithWorkflowVNFInPlaceSoftwareUpdate(); List<String> idsWithoutMatchingElement = Stream.of( - "operations-timeout", - "existing-software-version", - "new-software-version") + "internal-workflow-parameter-text-2-operations-timeout", + "internal-workflow-parameter-text-3-existing-software-version", + "internal-workflow-parameter-text-4-new-software-version") .filter(id -> Get.byId(id) == null) .collect(Collectors.toList()); assertThat("all three special VNFInPlace fields should appear", idsWithoutMatchingElement, is(empty())); @@ -403,13 +415,13 @@ public class ChangeManagementTest extends VidBaseTestCase { } private void fillVNFInPlace3Fields(String operationsTimeout, String existingSwVersion, String newSwVersion) { - Get.byId("operations-timeout").clear(); - Get.byId("existing-software-version").clear(); - Get.byId("new-software-version").clear(); + Get.byId("internal-workflow-parameter-text-2-operations-timeout").clear(); + Get.byId("internal-workflow-parameter-text-3-existing-software-version").clear(); + Get.byId("internal-workflow-parameter-text-4-new-software-version").clear(); - Get.byId("operations-timeout").sendKeys(operationsTimeout); - Get.byId("existing-software-version").sendKeys(existingSwVersion); - Get.byId("new-software-version").sendKeys(newSwVersion); + Get.byId("internal-workflow-parameter-text-2-operations-timeout").sendKeys(operationsTimeout); + Get.byId("internal-workflow-parameter-text-3-existing-software-version").sendKeys(existingSwVersion); + Get.byId("internal-workflow-parameter-text-4-new-software-version").sendKeys(newSwVersion); } private List<String> getListOfWorkflowsFor(String vnfName) { @@ -533,13 +545,8 @@ public class ChangeManagementTest extends VidBaseTestCase { ChangeManagementPage.openChangeManagementPage(); Click.byId(Constants.ChangeManagement.dashboardFinishedTabId); Assert.assertThat(Get.byClassAndText("vnf-name","Unlocked instance"),is(notNullValue())); - } - - - - @Test public void testMainDashboardTableContent () { ChangeManagementPage.openChangeManagementPage(); @@ -549,7 +556,6 @@ public class ChangeManagementTest extends VidBaseTestCase { //TODO: After scheduler will be ready than we will examine if the content is valid. } - @Test public void testOnlyOneModalIsOpen() throws Exception { diff --git a/vid-automation/src/main/resources/registration_to_simulator/changeManagement/mso_get_change_managements_scaleout.json b/vid-automation/src/main/resources/registration_to_simulator/changeManagement/mso_get_change_managements_scaleout.json new file mode 100644 index 000000000..01d28a41c --- /dev/null +++ b/vid-automation/src/main/resources/registration_to_simulator/changeManagement/mso_get_change_managements_scaleout.json @@ -0,0 +1,54 @@ +{ + "simulatorRequest": { + "method": "GET", + "path": "/mso/orchestrationRequests/v.", + "queryParams": { + "filter": "action:EQUALS:scaleOut" + } + }, + "simulatorResponse": { + "responseCode": 200, + "body": { + "requestList": [ + { + "request": { + "requestId":"2a22aff4-620f-44b6-92a1-8a41be396d96\n\n", + "requestScope":"vfModule", + "requestStatus":{ + "percentProgress":100.0, + "requestState":"IN_PROGRESS", + "statusMessage":"Scale-Out Is In Progress", + "finishTime":"Fri, 08 Sep 2017 19:34:33 GMT" + }, + "requestType":"scaleOut", + "startTime":"Fri, 08 Sep 2017 19:34:32 GMT", + "instanceReferences":{ + "serviceInstanceId":"6dd0f8de-93c7-48a2-914b-1a8d58e0eb48", + "vnfInstanceId":"7c00cc1e-6425-4fc3-afc3-0289db288d4c", + "requestorId":"ds828e" + } + } + }, + { + "request": { + "requestId": "2d6502bf-c488-4903-817e-2ed2c644dcf4", + "requestScope": "vfModule", + "requestStatus": { + "percentProgress": 100.0, + "requestState": "COMPLETE", + "statusMessage": "Completed successfully", + "finishTime": "Thu, 09 Nov 2017 10:58:14 GMT" + }, + "requestType": "scaleOut", + "startTime": "Thu, 09 Nov 2017 10:58:14 GMT", + "instanceReferences": { + "serviceInstanceId": "54ba3628-9ee5-4b32-8a2a-3abf001bed4e", + "vnfInstanceId": "b8d99523-1e83-4fd1-b42f-849361ef7024", + "requestorId": "az2016" + } + } + } + ] + } + } +}
\ No newline at end of file |