blob: d86edb57fe77da18812caf2dc7f8a9567dc043b6 [file] [log] [blame]
Matteo Scandolod2044a42017-08-07 16:08:28 -07001
2/*
3 * Copyright 2017-present Open Networking Foundation
4
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8
9 * http://www.apache.org/licenses/LICENSE-2.0
10
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18
Matteo Scandolo1b9ffac2015-12-14 17:36:09 -080019(function () {
Matteo Scandolo88b220e2016-06-17 11:57:05 -070020 'use strict';
Matteo Scandolo1b9ffac2015-12-14 17:36:09 -080021
22 const meters = [
Matteo Scandolo1b9ffac2015-12-14 17:36:09 -080023 {
Matteo Scandolo9db064f2016-02-08 14:17:42 -080024 service: 'service-a',
25 slice: 'slice-a-1',
26 name: 'network.outgoing.packets.rate',
27 resource_name: 'resource-1'
Matteo Scandolo1b9ffac2015-12-14 17:36:09 -080028 },
29 {
Matteo Scandolo9db064f2016-02-08 14:17:42 -080030 service: 'service-a',
31 slice: 'slice-a-1',
32 name: 'network.incoming.packets.rate',
33 resource_name: 'resource-1'
Matteo Scandolo1b9ffac2015-12-14 17:36:09 -080034 },
35 {
Matteo Scandolo9db064f2016-02-08 14:17:42 -080036 service: 'service-a',
37 slice: 'slice-a-1',
38 name: 'network.incoming.packets.rate',
39 resource_name: 'resource-2'
Matteo Scandolo1b9ffac2015-12-14 17:36:09 -080040 }
41 ];
42
43 const samples = [
44 {
45 meter: 'cpu',
46 resource_name: 'fakeName',
Matteo Scandolo8420f622016-03-24 11:38:50 -070047 resource_id: 'fakeTenant',
Matteo Scandolo1b9ffac2015-12-14 17:36:09 -080048 timestamp: '2015-12-15T00:34:08',
49 volume: 110
50 },
51 {
52 meter: 'cpu',
53 resource_name: 'fakeName',
Matteo Scandolo8420f622016-03-24 11:38:50 -070054 resource_id: 'fakeTenant',
Matteo Scandolo1b9ffac2015-12-14 17:36:09 -080055 timestamp: '2015-12-15T00:44:08',
56 volume: 120
57 },
58 {
59 meter: 'cpu',
60 resource_name: 'anotherName',
Matteo Scandolo8420f622016-03-24 11:38:50 -070061 resource_id: 'anotherTenant',
Matteo Scandolo1b9ffac2015-12-14 17:36:09 -080062 timestamp: '2015-12-15T00:24:08',
63 volume: 210
64 },
65 {
66 meter: 'cpu',
67 resource_name: 'anotherName',
Matteo Scandolo8420f622016-03-24 11:38:50 -070068 resource_id: 'anotherTenant',
Matteo Scandolo1b9ffac2015-12-14 17:36:09 -080069 timestamp: '2015-12-15T00:34:08',
70 volume: 220
71 },
72 {
73 meter: 'cpu',
74 resource_name: 'anotherName',
Matteo Scandolo8420f622016-03-24 11:38:50 -070075 resource_id: 'anotherTenant',
Matteo Scandolo1b9ffac2015-12-14 17:36:09 -080076 timestamp: '2015-12-15T00:44:08',
77 volume: 230
78 },
79 {
80 meter: 'cpu',
81 resource_name: 'thirdName',
Matteo Scandolo8420f622016-03-24 11:38:50 -070082 resource_id: 'thirdTenant',
Matteo Scandolo1b9ffac2015-12-14 17:36:09 -080083 timestamp: '2015-12-15T00:44:08',
84 volume: 310
85 }
86 ];
87
Matteo Scandolo9db064f2016-02-08 14:17:42 -080088 const mapping = [
89 {
90 service: 'service-a',
Matteo Scandolo8420f622016-03-24 11:38:50 -070091 slices: [
Matteo Scandolo9db064f2016-02-08 14:17:42 -080092 {
93 project_id: 'id-a-1',
94 slice: 'slice-a-1'
95 },
96 {
97 project_id: 'id-a-2',
98 slice: 'slice-a-2'
99 }
100 ]
101 },
102 {
103 service: 'service-b',
Matteo Scandolo8420f622016-03-24 11:38:50 -0700104 slices: [
Matteo Scandolo9db064f2016-02-08 14:17:42 -0800105 {
106 project_id: 'id-b-1',
107 slice: 'slice-b-1'
108 },
109 {
110 project_id: 'id-b-2',
111 slice: 'slice-b-2'
112 }
113 ]
114 }
115 ]
116
Matteo Scandolo1b9ffac2015-12-14 17:36:09 -0800117 angular.module('xos.ceilometerDashboard')
118 .run(($httpBackend) => {
119 $httpBackend.whenGET(/metersamples/).respond(samples);
Matteo Scandolo9db064f2016-02-08 14:17:42 -0800120 $httpBackend.whenGET(/xos-slice-service-mapping/).respond(mapping);
Matteo Scandolo1b9ffac2015-12-14 17:36:09 -0800121 $httpBackend.whenGET(/meters/).respond(meters);
122 });
123})();