blob: d159f0612a8144ebbff7926b38df0a16d4f532c4 [file] [log] [blame]
Sean Condonf4f54a12018-10-10 23:25:46 +01001/*
2 * Copyright 2018-present Open Networking Foundation
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 */
Sean Condonaa4366d2018-11-02 14:29:01 +000016import {Component, Input, OnInit} from '@angular/core';
17import { LocationType } from '../backgroundsvg/backgroundsvg.component';
18
19/**
20 * Enum of the topo2CurrentRegion node type from SubRegion below
21 */
22export enum NodeType {
23 REGION = 'region',
24 DEVICE = 'device'
25}
26
27/**
28 * Enum of the topo2CurrentRegion layerOrder from Region below
29 */
30export enum LayerOrder {
31 LAYER_OPTICAL = 'opt',
32 LAYER_PACKET = 'pkt',
33 LAYER_DEFAULT = 'def'
34}
35
36/**
37 * model of the topo2CurrentRegion location from SubRegion below
38 */
39export interface Location {
40 locType: LocationType;
41 latOrY: number;
42 longOrX: number;
43}
44
45/**
46 * model of the topo2CurrentRegion props from SubRegion below
47 */
48export interface RegionProps {
49 latitude: number;
50 longitude: number;
51 name: string;
52 peerLocations: string;
53}
54
55/**
56 * model of the topo2CurrentRegion subregion from Region below
57 */
58export interface SubRegion {
59 id: string;
60 location: Location;
61 nDevs: number;
62 nHosts: number;
63 name: string;
64 nodeType: NodeType;
65 props: RegionProps;
66}
67
68export enum LinkType {
69 UiRegionLink,
70 UiDeviceLink
71}
72
73/**
74 * model of the topo2CurrentRegion region rollup from Region below
75 */
76export interface RegionRollup {
77 id: string;
78 epA: string;
79 epB: string;
80 portA: string;
81 portB: string;
82 type: LinkType;
83}
84
85/**
86 * model of the topo2CurrentRegion region link from Region below
87 */
88export interface RegionLink {
89 id: string;
90 epA: string;
91 epB: string;
92 rollup: RegionRollup[];
93 type: LinkType;
94}
95
96/**
97 * model of the topo2CurrentRegion device props from Device below
98 */
99export interface DeviceProps {
100 latitude: number;
101 longitude: number;
102 name: string;
103 locType: LocationType;
104}
105
106export interface Device {
107 id: string;
108 layer: LayerOrder;
109 location: LocationType;
110 master: string;
111 nodeType: NodeType;
112 online: boolean;
113 props: DeviceProps;
114 type: string;
115}
116
117/**
118 * model of the topo2CurrentRegion WebSocket response
119 */
120export interface Region {
121 note?: string;
122 id: string;
123 devices: Device[][];
124 hosts: Object[];
125 links: RegionLink[];
126 layerOrder: LayerOrder[];
127 peerLocations?: Location[];
128 subregions: SubRegion[];
129}
130
131/**
132 * model of the topo2PeerRegions WebSocket response
133 */
134export interface Peer {
135 peers: SubRegion[];
136}
Sean Condonf4f54a12018-10-10 23:25:46 +0100137
138/**
139 * ONOS GUI -- Topology Forces Graph Layer View.
140 */
141@Component({
142 selector: '[onos-forcesvg]',
143 templateUrl: './forcesvg.component.html',
144 styleUrls: ['./forcesvg.component.css']
145})
146export class ForceSvgComponent implements OnInit {
Sean Condonaa4366d2018-11-02 14:29:01 +0000147 @Input() onosInstMastership: string = '';
148 regionData: Region;
Sean Condonf4f54a12018-10-10 23:25:46 +0100149
150 constructor() { }
151
152 ngOnInit() {
153 }
154
155}