Matteo Scandolo | d2044a4 | 2017-08-07 16:08:28 -0700 | [diff] [blame] | 1 | |
| 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 Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 19 | (function () { |
Matteo Scandolo | 88b220e | 2016-06-17 11:57:05 -0700 | [diff] [blame] | 20 | 'use strict'; |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 21 | |
| 22 | const meters = [ |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 23 | { |
Matteo Scandolo | 9db064f | 2016-02-08 14:17:42 -0800 | [diff] [blame] | 24 | service: 'service-a', |
| 25 | slice: 'slice-a-1', |
| 26 | name: 'network.outgoing.packets.rate', |
| 27 | resource_name: 'resource-1' |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 28 | }, |
| 29 | { |
Matteo Scandolo | 9db064f | 2016-02-08 14:17:42 -0800 | [diff] [blame] | 30 | service: 'service-a', |
| 31 | slice: 'slice-a-1', |
| 32 | name: 'network.incoming.packets.rate', |
| 33 | resource_name: 'resource-1' |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 34 | }, |
| 35 | { |
Matteo Scandolo | 9db064f | 2016-02-08 14:17:42 -0800 | [diff] [blame] | 36 | service: 'service-a', |
| 37 | slice: 'slice-a-1', |
| 38 | name: 'network.incoming.packets.rate', |
| 39 | resource_name: 'resource-2' |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 40 | } |
| 41 | ]; |
| 42 | |
| 43 | const samples = [ |
| 44 | { |
| 45 | meter: 'cpu', |
| 46 | resource_name: 'fakeName', |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 47 | resource_id: 'fakeTenant', |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 48 | timestamp: '2015-12-15T00:34:08', |
| 49 | volume: 110 |
| 50 | }, |
| 51 | { |
| 52 | meter: 'cpu', |
| 53 | resource_name: 'fakeName', |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 54 | resource_id: 'fakeTenant', |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 55 | timestamp: '2015-12-15T00:44:08', |
| 56 | volume: 120 |
| 57 | }, |
| 58 | { |
| 59 | meter: 'cpu', |
| 60 | resource_name: 'anotherName', |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 61 | resource_id: 'anotherTenant', |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 62 | timestamp: '2015-12-15T00:24:08', |
| 63 | volume: 210 |
| 64 | }, |
| 65 | { |
| 66 | meter: 'cpu', |
| 67 | resource_name: 'anotherName', |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 68 | resource_id: 'anotherTenant', |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 69 | timestamp: '2015-12-15T00:34:08', |
| 70 | volume: 220 |
| 71 | }, |
| 72 | { |
| 73 | meter: 'cpu', |
| 74 | resource_name: 'anotherName', |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 75 | resource_id: 'anotherTenant', |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 76 | timestamp: '2015-12-15T00:44:08', |
| 77 | volume: 230 |
| 78 | }, |
| 79 | { |
| 80 | meter: 'cpu', |
| 81 | resource_name: 'thirdName', |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 82 | resource_id: 'thirdTenant', |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 83 | timestamp: '2015-12-15T00:44:08', |
| 84 | volume: 310 |
| 85 | } |
| 86 | ]; |
| 87 | |
Matteo Scandolo | 9db064f | 2016-02-08 14:17:42 -0800 | [diff] [blame] | 88 | const mapping = [ |
| 89 | { |
| 90 | service: 'service-a', |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 91 | slices: [ |
Matteo Scandolo | 9db064f | 2016-02-08 14:17:42 -0800 | [diff] [blame] | 92 | { |
| 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 Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 104 | slices: [ |
Matteo Scandolo | 9db064f | 2016-02-08 14:17:42 -0800 | [diff] [blame] | 105 | { |
| 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 Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 117 | angular.module('xos.ceilometerDashboard') |
| 118 | .run(($httpBackend) => { |
| 119 | $httpBackend.whenGET(/metersamples/).respond(samples); |
Matteo Scandolo | 9db064f | 2016-02-08 14:17:42 -0800 | [diff] [blame] | 120 | $httpBackend.whenGET(/xos-slice-service-mapping/).respond(mapping); |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 121 | $httpBackend.whenGET(/meters/).respond(meters); |
| 122 | }); |
| 123 | })(); |