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);
38 this.getAllVNF = function() {
40 return $http.get('/getAllBackupVnfIds')
41 .then(function(response) {
42 console.log("---validationTestService::getAllVNF::TestResponse---" + JSON.stringify(response));
43 vnflist = response.data;
47 console.log("validationTestService::getAllVNF::Status Code", response.status);
53 this.getAllVnfIds = function() {
55 return $http.get('/getAllVnfIds')
56 .then(function(response) {
57 console.log("---validationTestService::getAllVNF From Restconf::TestResponse---" + JSON.stringify(response));
58 vnflist = response.data;
62 console.log("validationTestService::getAllVNF From Restconf::Status Code", response.status);
68 this.getVersions = function(vnfId) {
75 'Accept': 'application/json'
79 console.log("deviceConfigService::getVersions::config", JSON.stringify(config));
81 var baseUrl = VNF_API_BASE;
84 url: '/configDetailsById/'+vnfId,
87 'Content-Type': 'application/json',
92 .then(function(response) {
93 console.log("---deviceConfigService::getVersions::Response---" + JSON.stringify(response));
97 console.log("--deviceConfigService::getVersions::Status Code--", response.status);
104 this.invokeBackup = function() {
106 return $http.get('/backup')
107 .then(function(response) {
108 console.log("---validationTestService::getAllVNF::TestResponse---" + response);
113 console.log("validationTestService::getAllVNF::Status Code", response);
119 this.getlastupdated = function() {
121 return $http.get('/backuptime')
122 .then(function(response) {
123 console.log("---validationTestService::getBackuptime::---" + response);
129 this.runApplyconfig = function(vnfid, newConfig) {
133 var url='/vnf-list/'+vnfid;
139 'Content-Type': 'application/json'
143 $http.put(url, newConfig, config)
144 .success(function(newConfig) {
145 console.log("---validationTestService::getAllVNF::TestResponse---" ,response);
149 function(newConfig) {
150 console.log("validationTestService::getAllVNF::Status Code", response);