summaryrefslogtreecommitdiffstats
path: root/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js
diff options
context:
space:
mode:
authorcyuamber <xuranyjy@chinamobile.com>2019-09-03 10:17:22 +0800
committercyuamber <xuranyjy@chinamobile.com>2019-09-03 10:18:08 +0800
commit3c3840524ee11c1385045e9801918bcb05b71fb5 (patch)
treea159deba4778f796d084b2e3b8d75444244f086d /usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js
parent19abe2af19ba49073949f8254aec897afe7bb303 (diff)
feat: delete useless modules and update tomcat version
Change-Id: I38d0c0b65cf210074c7222a535f1b3d7c150f53d Issue-ID: USECASEUI-307 Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
Diffstat (limited to 'usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js')
-rw-r--r--usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js538
1 files changed, 0 insertions, 538 deletions
diff --git a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js
deleted file mode 100644
index 9f813a36..00000000
--- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js
+++ /dev/null
@@ -1,538 +0,0 @@
-/*
- * Copyright 2016-2017 ZTE Corporation.
- *
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- app.factory("ServiceTemplateService", function($http, $log) {
- var url = '/api/usecaseui-server/v1/uui-lcm';
- var uuiHeaders = JSON.stringify({
- 'Content-Type': 'application/json'
- // 'Authorization':'Basic dXNlY2FzZTp1c2VjYXNl'
- });
- return {
- getAllCustomers: function (processFun) {
- console.log("customers")
- return $http({
- url: url+'/customers',
- method: 'GET',
- data: null,
- headers: uuiHeaders
- }).then(function(response){
- console.log(response)
- var customers = response.data;
- var result = customers.map(function (customer) {
- return {
- name: customer['subscriber-name'],
- id: customer['global-customer-id'],
- };
- });
- processFun(result);
- });
- },
-
- getAllServiceTypes: function (customerId, processFun) {
- return $http({
- url: url+'/customers/' + customerId + '/service-subscriptions',
- method: 'GET',
- data: null,
- headers: uuiHeaders
- }).then(function(response){
- var serviceSubscriptions = response.data;
- var result = serviceSubscriptions.map(function (serviceSubscription) {
- return {
- name: serviceSubscription['service-type'],
- value: serviceSubscription['service-type']
- };
- });
- processFun(result);
- });
- },
-
- getServiceInstances: function (customerId, serviceType, processFun) {
- return $http({
- url: url+'/service-instances?customerId='+customerId+'&serviceType='+serviceType,
- method: 'GET',
- data: null,
- headers: uuiHeaders
- }).then(function(response){
- var serviceInstances = response.data;
- console.log(serviceInstances);
- var result = serviceInstances.map(function (serviceInstance) {
- return {
- serviceInstanceId: serviceInstance['service-instance-id'],
- serviceInstanceName: serviceInstance['service-instance-name'],
- serviceType: serviceInstance['service-type'],
- };
- });
- processFun(result);
- });
- },
-
- getAllServiceTemplates: function (processFun) {
- return $http({
- url: url+'/service-templates',
- method: 'GET',
- data: null,
- headers: uuiHeaders
- }).then(function(response){
- var templates = response.data;
- var result = templates.map(function (template) {
- return {
- name: template.name,
- id: template.uuid,
- invariantUUID: template.invariantUUID,
- version: template.version,
- toscaModelURL: template.toscaModelURL
- };
- });
- processFun(result);
- })
- },
-
- getupdateServiceTemplate:function(serviceInstanceId,processFun){
- return $http({
- url: url+'/xxxxxxx/'+ serviceInstanceId,
- method: 'GET',
- data: null,
- headers: uuiHeaders
- }).then(function(response){
- var template = response.data;
-
- processFun(template);
- })
- },
-
- getTemplateParameters: function (template, processFun) {
- console.log(url+'/service-templates/' + template.id+'?toscaModelPath='+ template.toscaModelURL);
- return $http({
- url: url+'/service-templates/' + template.id+'?toscaModelPath='+ template.toscaModelURL,
- method: 'GET',
- data: null,
- headers: uuiHeaders
- }).then(function(response){
- var inputRsp = response.data;
- console.log(inputRsp);
- processFun(inputRsp);
- });
- },
-
- getComparedTemplateParameters: function (serviceInstanceId,template, processFun) {
- var requestBody = {
- "model-invariant-id-target": template.invariantUUID,
- "model-version-id-target": template.id
- }
- return $http({
- url: url+'/xxxxxxxxx/' + serviceInstanceId,
- method: 'POST',
- data: JSON.stringify(requestBody),
- headers: uuiHeaders
- }).then(function(response){
- var inputRsp = response.data;
- console.log(inputRsp);
- processFun(inputRsp);
- });
- },
-
- getAllVimInfo: function (processFun) {
- return $http({
- url: url+'/locations/',
- method: 'GET',
- data: null,
- headers: uuiHeaders
- }).then(function(response){
- var vimInfos = response.data;
- console.log(vimInfos);
- var result = vimInfos.map(function (vim) {
- return {
- name: vim['cloud-owner'], //complex-name
- value: vim['cloud-owner'] + '_' + vim['cloud-region-id']
- };
- });
- processFun(result);
- });
- },
-
- getAllSdnControllers: function (processFun) {
- return $http({
- url: url+'/sdnc-controllers/',
- method: 'GET',
- data: null,
- headers: uuiHeaders
- }).then(function(response){
- var sdnControllers = response.data;
- console.log(sdnControllers);
- var result = sdnControllers.map(function (sdn) {
- return {
- name: sdn['thirdparty-sdnc-id'],
- value: sdn['thirdparty-sdnc-id']
- };
- });
- processFun(result);
- });
- },
-
- createService: function (customer, serviceType, service, template, successFun, failedFun) {
- var reqPara = [];
- var newreqParas = {};
- service.segments.forEach(function (segment) {
- var reqParas = {};
- var vfLocations = [];
- segment.parameters.forEach(function (parameter) {
- if(parameter.type === 'vf_location') {
- // name is uuid for vf_location
- var loc = {
- vnfProfileId: parameter.name,
- locationConstraints : {
- vimId: parameter.value.value
- }
- };
- vfLocations.push(loc);
- } else if(parameter.type === 'sdn_controller') {
- if(parameter.value === undefined || parameter.value === null) {
- reqParas[parameter.name] = '';
- } else {
- reqParas[parameter.name] = parameter.value.value;
- }
- } else {
- reqParas[parameter.name] = parameter.value;
- }
- });
-
- var para = {
- resourceName: segment.nodeTemplateName,
- resourceInvariantUuid: segment.invariantUUID,//resourceDefId
- resourceUuid: segment.uuid,
- resourceCustomizationUuid: segment.customizationUuid,
- parameters: { //nsParameters
- locationConstraints: vfLocations,
- // additionalParamForNs: reqParas,
- resources:[],
- requestInputs:reqParas
- }
- };
- reqPara.push(para);
- });
-
- var templateName = template.name;
- if( template.version !== undefined && template.version !== null && template.version !== '' ) {
- templateName = templateName + ":" + template.version;
- }
-
- service.parameters.forEach(function(item){
- newreqParas[item.name] = item.value;
- })
-
- var requestBody = {
- service: {
- name: service.serviceName,
- description: service.serviceDescription,
- serviceInvariantUuid: template.invariantUUID, //serviceDefId
- serviceUuid: template.uuid, // uuid ?? templateId
- globalSubscriberId: customer.id,
- serviceType: serviceType.value,
- parameters: {
- // globalSubscriberId: customer.id,
- // subscriberName: customer.name,
- // serviceType: serviceType.value,
- // templateName: templateName,
- locationConstraints:[],
- resources: reqPara,
- requestInputs:newreqParas
- }
- }
- };
-
- console.log(requestBody);
- // console.log(JSON.stringify(requestBody));
- // return false;
- return $http({
- url: url+'/services',
- method: 'POST',
- data: JSON.stringify(requestBody),
- headers: uuiHeaders
- }).then(function(response){
- console.log('create response...');
- console.log(response.data);
-
- var serviceId = response.data.service.serviceId;
- var operationId = response.data.service.operationId;
- successFun(serviceId, operationId);
- });
- },
-
- updateService: function (customer, serviceType,serviceInstanceId, service, template, successFun, failedFun) {
- var reqPara = [];
- var newreqParas = {};
- service.segments.forEach(function (segment) {
- var reqParas = {};
- var vfLocations = [];
- segment.parameters.forEach(function (parameter) {
- if(parameter.type === 'vf_location') {
- // name is uuid for vf_location
- var loc = {
- vnfProfileId: parameter.name,
- locationConstraints : {
- vimId: parameter.value.value
- }
- };
- vfLocations.push(loc);
- } else if(parameter.type === 'sdn_controller') {
- if(parameter.value === undefined || parameter.value === null) {
- reqParas[parameter.name] = '';
- } else {
- reqParas[parameter.name] = parameter.value.value;
- }
- } else {
- reqParas[parameter.name] = parameter.value;
- }
- });
-
- var para = {
- resourceName: segment.nodeTemplateName,
- resourceInvariantUuid: segment.invariantUUID,//resourceDefId
- resourceUuid: segment.uuid,
- resourceCustomizationUuid: segment.customizationUuid,
- parameters: { //nsParameters
- locationConstraints: vfLocations,
- // additionalParamForNs: reqParas,
- resources:[],
- requestInputs:reqParas
- }
- };
- reqPara.push(para);
- });
-
- var templateName = template.name;
- if( template.version !== undefined && template.version !== null && template.version !== '' ) {
- templateName = templateName + ":" + template.version;
- }
-
- service.parameters.forEach(function(item){
- newreqParas[item.name] = item.value;
- })
-
- var requestBody = {
- service: {
- name: service.serviceName,
- description: service.serviceDescription,
- serviceInvariantUuid: template.invariantUUID, //serviceDefId
- serviceUuid: template.uuid, // uuid ?? templateId
- globalSubscriberId: customer.id,
- serviceType: serviceType.value,
- parameters: {
- // globalSubscriberId: customer.id,
- // subscriberName: customer.name,
- // serviceType: serviceType.value,
- // templateName: templateName,
- locationConstraints:[],
- resources: reqPara,
- requestInputs:newreqParas
- }
- }
- };
-
- console.log(requestBody);
- // console.log(JSON.stringify(requestBody));
- return false;
- return $http({
- url: url+ '/services/updateService/' + serviceInstanceId,
- method: 'POST',
- data: JSON.stringify(requestBody),
- headers: uuiHeaders
- }).then(function(response){
- console.log('update response...');
- console.log(response.data);
- // var serviceId = response.data.service.serviceId;
- var operationId = response.data.service.operationId;
- successFun(operationId);
- });
- },
-
- getScaleServiceDialog:function(customer,serviceType,serviceInstanceId,successFun){
- return $http({
- url:url+'/getServiceInstanceById?customerId=' + customer + '&serviceType=' + serviceType + '&serviceId=' + serviceInstanceId,
- method:'GET'
- }).then(function(response){
- successFun(response);
- })
- },
-
- scaleService: function (requestBody, successFun, failedFun) {
-
- console.log(requestBody);
- console.log(JSON.stringify(requestBody));
-
- return $http({
- url: url+'/services/scaleServices/'+requestBody.service.globalSubscriberId,
- method: 'POST',
- data: JSON.stringify(requestBody),
- headers: uuiHeaders
- }).then(function(response){
- // console.log('create response...');
- console.log(response);
- var operationId = response.data.operationId;
- if(operationId == null){
- console.log('error: operationId is null');
- return false;
- }
- successFun( operationId);
- });
- },
-
- deleteService: function (serviceId, customer, serviceType, successFun) {
- var requestBody = {
- globalSubscriberId: customer.id,
- serviceType: serviceType.value
- };
- return $http({
- url: url+'/services/' + serviceId,
- method: 'DELETE',
- data: JSON.stringify(requestBody),
- headers: uuiHeaders
- }).then(function(response){
- console.log('delete response...');
- console.log(response.data);
- successFun(serviceId, response.data.operationId);
- });
- },
-
- queryServiceProgress: function (serviceId, operationId, progressFun) {
- return $http({
- url: url+'/services/' + serviceId + '/operations/' + operationId,
- method: 'GET',
- data: null,
- headers: uuiHeaders
- }).then(function(response){
- console.log('get progress response...');
- console.log(response.data);
- var op = response.data.operationStatus;
- progressFun({
- result: op.result,
- progress : op.progress,
- operationContent: op.operationContent,
- reason: op.reason
- });
- });
- },
-
- getPackages: function (processFun) {
- return $http({
- url: url+'/vf-ns-packages',
- method: 'GET',
- data: null,
- headers: uuiHeaders
- }).then(function(response){
- var packageRsp = response.data;
- var packages = [];
- packageRsp.nsPackage.forEach(function (ns) {
- packages.push({
- uuid: ns.uuid,
- invariantUUID: ns.invariantUUID,
- name: ns.name,
- version: ns.version,
- type: 'NS'
- })
- });
- packageRsp.vnfPackages.forEach(function (vnf) {
- packages.push({
- uuid: vnf.uuid,
- invariantUUID: vnf.invariantUUID,
- name: vnf.name,
- version: vnf.version,
- type: 'VF'
- })
- });
- processFun(packages);
- });
- },
-
- nsPackageOnboard: function (onboardPackage, processFun) {
- console.log('onboard...');
- console.log(onboardPackage);
- var requestBody = {
- csarId: onboardPackage.uuid
- };
- return $http({
- url: url+'/ns-packages',
- method: 'POST',
- data: JSON.stringify(requestBody),
- headers: uuiHeaders
- }).then(function(response){
- console.log('onboard ns package response...');
- console.log(response.data);
- processFun(response.data);
- });
- },
-
- vfPackageOnboard: function (onboardPackage, processFun) {
- console.log('onboard...');
- console.log(onboardPackage);
- var requestBody = {
- csarId: onboardPackage.uuid
- };
- return $http({
- url: url+'/vf-packages',
- method: 'POST',
- data: JSON.stringify(requestBody),
- headers: uuiHeaders
- }).then(function(response){
- console.log('onboard vf package response...');
- console.log(response.data);
- processFun(response.data);
- });
- },
-
- queryVfOnboardProgress: function (jobId, responseId, progressFun) {
- return $http({
- url: url+'/jobs/' + jobId + '?responseId=' + responseId,
- method: 'GET',
- data: null,
- headers: uuiHeaders
- }).then(function(response){
- console.log('get progress response...');
- console.log(response.data);
- progressFun(response.data.responseDescriptor);
- });
- },
-
- nsPackageDelete: function (deletePackage, processFun) {
- console.log('delete package...');
- console.log(deletePackage);
- return $http({
- url: url+'/ns-packages/' + deletePackage.uuid,
- method: 'DELETE',
- data: null,
- headers: uuiHeaders
- }).then(function(response){
- console.log('delete ns package response...');
- console.log(response.data);
- processFun(response.data);
- });
- },
-
- vfPackageDelete: function (deletePackage, processFun) {
- console.log('delete package...');
- console.log(deletePackage);
- return $http({
- url: url+'/vf-packages/' + deletePackage.uuid,
- method: 'DELETE',
- data: null,
- headers: uuiHeaders
- }).then(function(response){
- console.log('delete vf package response...');
- console.log(response.data);
- processFun(response.data);
- });
- }
- };
- });