2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
24 appDS2.service('changeManagementService', ['$http', '$q', 'COMPONENT', 'VIDCONFIGURATION', changeManagementService]);
26 function changeManagementService($http, $q, COMPONENT, VIDCONFIGURATION) {
27 this.getWorkflows = function (vnfs) {
28 var requestVnfs = _.map(vnfs, function (vnf) {
30 UUID: vnf["modelVersionId"],
31 invariantUUID: vnf["invariant-id"]
34 var requestDetails = {vnfsDetails: requestVnfs};
35 return $http.post(COMPONENT.GET_WORKFLOW, requestDetails)
36 .success(function (response) {
37 return {data: response};
44 this.getSOWorkflows = function (vnfNames) {
45 return $http.get(COMPONENT.GET_SO_WORKFLOWS, {params: {vnfName: vnfNames}})
46 .success(function (response) {
47 return {data: response};
48 }).catch(function (ex) {
49 console.error("Problem when getting workflows from SO API occurred.", ex.stack);
54 this.getSOWorkflowParameter = function (workflowID){
55 return $http.get(COMPONENT.GET_SO_WORKFLOW_PARAMETER.replace('@workflowID', workflowID))
56 .success(function (response) {
57 return {data: response.parameterDefinitions}
61 this.getLocalWorkflowParameter = function (workflowName){
62 return $http.get(COMPONENT.GET_LOCAL_WORKFLOW_PARAMETER.replace('@workflowName', encodeURIComponent(workflowName)))
63 .success(function (response) {
64 return {data: response.parameterDefinitions}
68 this.getMSOChangeManagements = function() {
69 var deferred = $q.defer();
71 $http.get(COMPONENT.GET_MSO_WORKFLOWS)
72 .success(function (response) {
73 deferred.resolve({data: response});
75 .error(function(data, status, headers, config) {
76 deferred.reject({message: data, status: status});
79 return deferred.promise;
82 this.getAllSDCServices = function () {
83 var deferred = $q.defer();
85 $http.get(COMPONENT.SERVICES_DIST_STATUS_PATH + VIDCONFIGURATION.ASDC_MODEL_STATUS)
86 .success(function (response) {
87 deferred.resolve({data: response});
89 .error(function(data, status, headers, config) {
90 deferred.reject({message: data, status: status});
93 return deferred.promise;
96 this.getSDCService = function(uuid) {
97 var deferred = $q.defer();
99 $http.get(COMPONENT.SERVICES_PATH + uuid)
100 .success(function (response) {
101 deferred.resolve({data: response});
103 .error(function(data, status, headers, config) {
104 deferred.reject({message: data, status: status});
107 return deferred.promise;
110 this.getSchedulerChangeManagements = function(){
111 var deferred = $q.defer();
113 $http.get(COMPONENT.GET_SCHEDULER_CHANGE_MANAGEMENTS)
114 .success(function (response) {
115 deferred.resolve({data: response});
117 .error(function(data, status, headers, config) {
118 deferred.reject({message: data, status: status});
121 return deferred.promise;
124 this.postChangeManagementNow = function (requestData, vnfName) {
125 var url = COMPONENT.CHANGE_MANAGEMENT_OPERATION_NO_SCHEDULER.replace('@vnfName', vnfName);
126 return $http.post(url, requestData)
127 .success(function (response) {
128 return {data: response};
130 .catch(function (err) {
135 this.postChangeManagementScaleOutNow = function (requestData, serviceInstanceId, vnfId) {
136 var url = "mso/mso_create_vfmodule_instance/"+serviceInstanceId+"/vnfs/"+vnfId;
137 return $http.post(url, requestData)
138 .success(function (response) {
139 return {data: response};
141 .catch(function (err) {