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