aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common
diff options
context:
space:
mode:
authorSonsino, Ofir (os0695) <os0695@intl.att.com>2018-03-13 15:24:31 +0200
committerSonsino, Ofir (os0695) <os0695@intl.att.com>2018-03-13 15:24:31 +0200
commit80098ffa01c5a0f4dd5b99f41c31d51e9dc25762 (patch)
treea22bbda352a725b6a29f46acf645bc79fc639f60 /vid-app-common
parent07f0f107427ee35ffb721d9bab5b83da62341680 (diff)
bypassing scheduler for immediate operations
Change-Id: I634763a2065b75b0d550e2896a9352a74dd02b44 Issue-ID: VID-174 Signed-off-by: Sonsino, Ofir (os0695) <os0695@intl.att.com>
Diffstat (limited to 'vid-app-common')
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js1
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js150
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js11
3 files changed, 148 insertions, 14 deletions
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js b/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
index fa9ff1c75..a59da0580 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
@@ -108,6 +108,7 @@ appDS2
VPN_ID_1 : "1a2b3c4d5e6f",
// PATHS
+ CHANGE_MANAGEMENT_OPERATION_NO_SCHEDULER: "change-management/workflow/@vnfName",
GET_WORKFLOW: "change-management/get_vnf_workflow_relation",
GET_MSO_WORKFLOWS: "change-management/mso",
GET_SCHEDULER_CHANGE_MANAGEMENTS: "change-management/scheduler",
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 f0b85a6e3..2444646fe 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
@@ -132,21 +132,143 @@
};
+ /***converting objects to scheduler format (taken from IST)***/
+ 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 ={};
+ 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':changeManagement.existingSoftwareVersion,
+ 'new_software_version':changeManagement.newSoftwareVersion,
+ 'operations_timeout':changeManagement.operationTimeout
+ };
+ requestParametersData = {
+ payload: JSON.stringify(payloadObj)
+ }
+ }else if(workflowType=="VNF Config Update"){
+ requestParametersData = {
+ payload: changeManagement.configUpdateFile
+ }
+ }
+ $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':changeManagement.existingSoftwareVersion,
+ 'new_software_version':changeManagement.newSoftwareVersion,
+ 'operations_timeout':changeManagement.operationTimeout
+ };
+ requestParametersData = {
+ payload: JSON.stringify(payloadObj)
+ }
+ }else if(workflowType=="VNF Config Update"){
+ 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 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});
+ });
+ }
+ }catch(err){
+ $log.error('SchedulerCtrl::extractChangeManagementCallbackDataStr error: ' + err);
+ }
+
+ result.requestDetails.push(data);
+ });
+ return JSON.stringify(result);
+ }
+
vm.openModal = function () {
- $scope.widgetParameter = ""; // needed by the scheduler?
-
- // properties needed by the scheduler so it knows whether to show
- // policy or sniro related features on the scheduler UI or not.
- vm.changeManagement.policyYN = "Y";
- vm.changeManagement.sniroYN = "Y";
-
- var data = {
- widgetName: 'Portal-Common-Scheduler',
- widgetData: vm.changeManagement,
- widgetParameter: $scope.widgetParameter
- };
-
- window.parent.postMessage(data, VIDCONFIGURATION.SCHEDULER_PORTAL_URL);
+ if(VIDCONFIGURATION.SCHEDULER_PORTAL_URL) { //scheduling supported
+ $scope.widgetParameter = ""; // needed by the scheduler?
+
+ // properties needed by the scheduler so it knows whether to show
+ // policy or sniro related features on the scheduler UI or not.
+ vm.changeManagement.policyYN = "Y";
+ vm.changeManagement.sniroYN = "Y";
+
+ var data = {
+ widgetName: 'Portal-Common-Scheduler',
+ widgetData: vm.changeManagement,
+ widgetParameter: $scope.widgetParameter
+ };
+
+ window.parent.postMessage(data, VIDCONFIGURATION.SCHEDULER_PORTAL_URL);
+ } else {
+ //no scheduling support
+ var dataToSo = extractChangeManagementCallbackDataStr(vm.changeManagement);
+ var vnfName = vm.changeManagement.vnfNames[0].name;
+ changeManagementService.postChangeManagementNow(dataToSo, vnfName);
+ }
};
vm.loadSubscribers = function () {
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js
index fdab6564b..f170c4182 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js
@@ -76,5 +76,16 @@
return deferred.promise;
};
+
+ this.postChangeManagementNow = function (requestData, vnfName) {
+ var url = COMPONENT.CHANGE_MANAGEMENT_OPERATION_NO_SCHEDULER.replace('@vnfName', vnfName);
+ return $http.post(url, requestData)
+ .success(function (response) {
+ return {data: response};
+ })
+ .catch(function (err) {
+ return {data: []};
+ });
+ };
}
})();