Sho SHIMIZU | 014c33a | 2015-04-30 11:40:37 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Sho SHIMIZU | 014c33a | 2015-04-30 11:40:37 -0700 | [diff] [blame] | 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 | package org.onosproject.net; |
| 17 | |
| 18 | /** |
| 19 | * Represents ODU (Optical channel Data Unit) signal type. |
| 20 | * |
| 21 | * <p> |
| 22 | * See ITU G.709 "Interfaces for the Optical Transport Network (OTN)" and |
| 23 | * Open Networking Foundation "Optical Transport Protocol Extensions Version 1.0". |
| 24 | * </p> |
| 25 | */ |
| 26 | public enum OduSignalType { |
Toru Furusawa | 72ee30c | 2016-01-08 13:29:04 -0800 | [diff] [blame] | 27 | /** bit rate in Mbps. */ |
| 28 | ODU0(1_250), |
| 29 | ODU1(2_500), |
| 30 | ODU2(10_000), |
| 31 | ODU2e(10_000), |
| 32 | ODU3(40_000), |
| 33 | ODU4(100_000); |
| 34 | |
| 35 | private final long bitRate; |
| 36 | |
| 37 | OduSignalType(long bitRate) { |
| 38 | this.bitRate = bitRate; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Return the bit rate in Mbps of the port. |
| 43 | * @return bit rate |
| 44 | */ |
| 45 | public long bitRate() { |
| 46 | return this.bitRate; |
| 47 | } |
Rimon Ashkenazy | f069970 | 2016-01-17 19:28:49 +0200 | [diff] [blame] | 48 | |
| 49 | /** |
| 50 | * Returns the number of tributary slots of the OduSignalType. |
| 51 | * Each TributarySlot is 1.25Gbps. |
| 52 | * @return number of tributary slots |
| 53 | */ |
| 54 | public int tributarySlots() { |
| 55 | return (int) (this.bitRate() / OduSignalType.ODU0.bitRate()); |
| 56 | } |
| 57 | |
Sho SHIMIZU | 014c33a | 2015-04-30 11:40:37 -0700 | [diff] [blame] | 58 | } |