HIGUCHI Yuta | 95d83e8 | 2016-04-26 12:13:48 -0700 | [diff] [blame] | 1 | /* |
| 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 | package org.onosproject.net.optical; |
| 17 | |
| 18 | import org.onlab.util.Frequency; |
| 19 | import org.onosproject.net.Port; |
| 20 | |
| 21 | import com.google.common.annotations.Beta; |
| 22 | |
| 23 | /** |
| 24 | * OMS port (Optical Multiplexing Section). |
| 25 | * Also referred to as a WDM port or W-port. |
| 26 | * See ITU G.709 "Interfaces for the Optical Transport Network (OTN)" |
| 27 | * |
| 28 | * Assumes we only support fixed grid for now. |
| 29 | */ |
| 30 | @Beta |
| 31 | public interface OmsPort extends Port { |
| 32 | |
| 33 | /** |
| 34 | * Returns the total number of channels on the port. |
| 35 | * |
| 36 | * @return total number of channels |
| 37 | */ |
| 38 | default short totalChannels() { |
| 39 | Frequency diff = maxFrequency().subtract(minFrequency()); |
| 40 | return (short) (diff.asHz() / grid().asHz()); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Returns the minimum frequency. |
| 45 | * |
| 46 | * @return minimum frequency |
| 47 | */ |
| 48 | Frequency minFrequency(); |
| 49 | |
| 50 | /** |
| 51 | * Returns the maximum frequency. |
| 52 | * |
| 53 | * @return maximum frequency |
| 54 | */ |
| 55 | Frequency maxFrequency(); |
| 56 | |
| 57 | /** |
| 58 | * Returns the grid spacing frequency. |
| 59 | * |
| 60 | * @return grid spacing frequency |
| 61 | */ |
| 62 | Frequency grid(); |
| 63 | |
| 64 | } |