blob: ff1d52f3a42abe74767aa9164a68f2d637eca1ee [file] [log] [blame]
Steven Burrows57e24e92016-08-04 18:38:24 +01001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 ONOS GUI -- Topology Region Module.
19 Module that holds the current region in memory
20 */
21
22(function () {
23 'use strict';
24
25 var $log,
26 wss,
27 t2sr,
28 t2ds,
29 t2hs,
30 t2ls;
31
32 var regions;
33
34 function init() {
35 regions = {};
36 }
37
38 function addRegion(data) {
39
40 var region = {
41 subregions: t2sr.createSubRegionCollection(data.subregions),
42 devices: t2ds.createDeviceCollection(data.devices, data),
43 hosts: t2hs.createHostCollection(data.hosts),
44 links: t2ls.createLinkCollection(data.links),
45 };
46
47 $log.debug('Region: ', region);
48 }
49
50 angular.module('ovTopo2')
51 .factory('Topo2RegionService',
52 ['$log', 'WebSocketService', 'Topo2SubRegionService', 'Topo2DeviceService',
53 'Topo2HostService', 'Topo2LinkService',
54
55 function (_$log_, _wss_, _t2sr_, _t2ds_, _t2hs_, _t2ls_) {
56
57 $log = _$log_;
58 wss = _wss_;
59 t2sr = _t2sr_;
60 t2ds = _t2ds_;
61 t2hs = _t2hs_;
62 t2ls = _t2ls_;
63
64 return {
65 init: init,
66
67 addRegion: addRegion,
68 getSubRegions: t2sr.getSubRegions
69 };
70 }]);
71
72})();