2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright 2018 TechMahindra
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=========================================================
20 myApp.service('deviceConfigService', ['$http','VNF_API_BASE', function($http, VNF_API_BASE) {
23 this.getAllVNFFromRc = function() {
25 return $http.get('/getAllBackupVnfIds')
26 .then(function(response) {
27 console.log("---validationTestService::getAllVNF From Restconf::TestResponse---" + JSON.stringify(response));
28 vnflist = response.data;
32 console.log("validationTestService::getAllVNF From Restconf::Status Code", response.status);
39 this.getAllVNF = function() {
41 return $http.get('/getAllBackupVnfIds')
42 .then(function(response) {
43 console.log("---validationTestService::getAllVNF::TestResponse---" + JSON.stringify(response));
44 vnflist = response.data;
48 console.log("validationTestService::getAllVNF::Status Code", response.status);
54 this.getVersions = function(vnfId) {
57 // data.selectedVnfName = vnfName;
58 // data.selectedVnfType = vnfType;
63 'Accept': 'application/json'
67 console.log("deviceConfigService::getVersions::config", JSON.stringify(config));
69 var baseUrl = VNF_API_BASE;
70 // var baseApi='runtest';
71 // var apiUrl= baseUrl + baseApi;
73 // Call the pre validation service
76 url: '/configDetailsById/'+vnfId,
77 //url: 'sdnc-stubs/getAllConfigForVNF.json',
81 'Content-Type': 'application/json',
86 .then(function(response) {
87 console.log("---deviceConfigService::getVersions::Response---" + JSON.stringify(response));
91 console.log("--deviceConfigService::getVersions::Status Code--", response.status);
98 this.invokeBackup = function() {
100 return $http.get('/backup')
101 .then(function(response) {
102 console.log("---validationTestService::getAllVNF::TestResponse---" + response);
107 console.log("validationTestService::getAllVNF::Status Code", response);
113 this.getlastupdated = function() {
115 return $http.get('/backuptime')
116 .then(function(response) {
117 console.log("---validationTestService::getBackuptime::---" + response);
123 this.runApplyconfig = function(vnfid, newConfig) {
127 var url='/vnf-list/'+vnfid;
133 'Content-Type': 'application/json'
137 $http.put(url, newConfig, config)
138 .success(function(newConfig) {
139 console.log("---validationTestService::getAllVNF::TestResponse---" ,response);
143 function(newConfig) {
144 console.log("validationTestService::getAllVNF::Status Code", response);
147 /*.then(function (response) {
149 { $scope.successMessage1 = "Put Data Method Executed Successfully!";
152 var status= response.status;
154 $window.alert("applyed successfully ");
156 var successMessage1 = "Put Data Method Executed Successfully!";
158 function (response) {
159 var successMessage1 = "Service not Exists";