Sean Condon | f4f54a1 | 2018-10-10 23:25:46 +0100 | [diff] [blame] | 1 | /* |
| 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 Condon | aa4366d | 2018-11-02 14:29:01 +0000 | [diff] [blame^] | 16 | import {Component, Input, OnInit} from '@angular/core'; |
| 17 | import { LocationType } from '../backgroundsvg/backgroundsvg.component'; |
| 18 | |
| 19 | /** |
| 20 | * Enum of the topo2CurrentRegion node type from SubRegion below |
| 21 | */ |
| 22 | export enum NodeType { |
| 23 | REGION = 'region', |
| 24 | DEVICE = 'device' |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Enum of the topo2CurrentRegion layerOrder from Region below |
| 29 | */ |
| 30 | export 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 | */ |
| 39 | export interface Location { |
| 40 | locType: LocationType; |
| 41 | latOrY: number; |
| 42 | longOrX: number; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * model of the topo2CurrentRegion props from SubRegion below |
| 47 | */ |
| 48 | export 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 | */ |
| 58 | export 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 | |
| 68 | export enum LinkType { |
| 69 | UiRegionLink, |
| 70 | UiDeviceLink |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * model of the topo2CurrentRegion region rollup from Region below |
| 75 | */ |
| 76 | export 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 | */ |
| 88 | export 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 | */ |
| 99 | export interface DeviceProps { |
| 100 | latitude: number; |
| 101 | longitude: number; |
| 102 | name: string; |
| 103 | locType: LocationType; |
| 104 | } |
| 105 | |
| 106 | export 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 | */ |
| 120 | export 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 | */ |
| 134 | export interface Peer { |
| 135 | peers: SubRegion[]; |
| 136 | } |
Sean Condon | f4f54a1 | 2018-10-10 23:25:46 +0100 | [diff] [blame] | 137 | |
| 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 | }) |
| 146 | export class ForceSvgComponent implements OnInit { |
Sean Condon | aa4366d | 2018-11-02 14:29:01 +0000 | [diff] [blame^] | 147 | @Input() onosInstMastership: string = ''; |
| 148 | regionData: Region; |
Sean Condon | f4f54a1 | 2018-10-10 23:25:46 +0100 | [diff] [blame] | 149 | |
| 150 | constructor() { } |
| 151 | |
| 152 | ngOnInit() { |
| 153 | } |
| 154 | |
| 155 | } |