Sean Condon | 0c577f6 | 2018-11-18 22:40:05 +0000 | [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 | */ |
| 16 | /** |
| 17 | * Enum of the topo2CurrentRegion node type from SubRegion below |
| 18 | */ |
| 19 | import {LocationType} from '../../backgroundsvg/backgroundsvg.component'; |
| 20 | import {Device, Host, SubRegion} from './node'; |
| 21 | import {RegionLink} from './link'; |
| 22 | |
| 23 | export enum NodeType { |
| 24 | REGION = 'region', |
| 25 | DEVICE = 'device', |
| 26 | HOST = 'host', |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Enum of the topo2CurrentRegion layerOrder from Region below |
| 31 | */ |
| 32 | export enum LayerType { |
| 33 | LAYER_OPTICAL = 'opt', |
| 34 | LAYER_PACKET = 'pkt', |
| 35 | LAYER_DEFAULT = 'def' |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * model of the topo2CurrentRegion location from SubRegion below |
| 40 | */ |
| 41 | export interface Location { |
| 42 | locType: LocationType; |
| 43 | latOrY: number; |
| 44 | longOrX: number; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * model of the topo2CurrentRegion props from SubRegion below |
| 49 | */ |
| 50 | export interface RegionProps { |
| 51 | latitude: number; |
| 52 | longitude: number; |
| 53 | name: string; |
| 54 | peerLocations: string; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * model of the topo2CurrentRegion WebSocket response |
| 59 | * |
| 60 | * The Devices are in a 2D array - 1st order is layer type, 2nd order is |
| 61 | * devices in that layer |
| 62 | */ |
| 63 | export interface Region { |
| 64 | note?: string; |
| 65 | id: string; |
| 66 | devices: Device[][]; |
| 67 | hosts: Host[][]; |
| 68 | links: RegionLink[]; |
| 69 | layerOrder: LayerType[]; |
| 70 | peerLocations?: Location[]; |
| 71 | subregions: SubRegion[]; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * model of the topo2PeerRegions WebSocket response |
| 76 | */ |
| 77 | export interface Peer { |
| 78 | peers: SubRegion[]; |
| 79 | } |
| 80 | |