MaoLu | 819fde2 | 2017-04-20 17:17:49 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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 | |
| 17 | package org.onosproject.drivers.oplink; |
| 18 | |
| 19 | import org.onosproject.net.PortNumber; |
| 20 | |
| 21 | import static com.google.common.base.MoreObjects.toStringHelper; |
| 22 | |
| 23 | /** |
| 24 | * Oplink cross connect data unit. |
| 25 | * The requirement members are input port, output port, wavelength channel and channel attenuation. |
| 26 | */ |
| 27 | public class OplinkCrossConnect { |
| 28 | |
| 29 | private final PortNumber inPort; |
| 30 | private final PortNumber outPort; |
| 31 | private final int channel; |
| 32 | private final int attenuation; |
| 33 | |
| 34 | /** |
| 35 | * OplinkConnection structure. |
| 36 | * @param inPort the input port |
| 37 | * @param outPort the output port |
| 38 | * @param channel the channel |
| 39 | * @param attenuation the attenuation |
| 40 | */ |
| 41 | public OplinkCrossConnect(PortNumber inPort, PortNumber outPort, int channel, int attenuation) { |
| 42 | this.inPort = inPort; |
| 43 | this.outPort = outPort; |
| 44 | this.channel = channel; |
| 45 | this.attenuation = attenuation; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Returns the input port of the cross connect. |
| 50 | * @return input port |
| 51 | */ |
| 52 | public PortNumber getInPort() { |
| 53 | return inPort; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Returns the output port of the cross connect. |
| 58 | * @return output port |
| 59 | */ |
| 60 | public PortNumber getOutPort() { |
| 61 | return outPort; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Returns the channel number of the cross connect. |
| 66 | * @return channel number |
| 67 | */ |
| 68 | public int getChannel() { |
| 69 | return channel; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Returns the channel attenuation of the cross connect. |
| 74 | * @return attenuation |
| 75 | */ |
| 76 | public int getAttenuation() { |
| 77 | return attenuation; |
| 78 | } |
| 79 | |
| 80 | @Override |
| 81 | public String toString() { |
| 82 | return toStringHelper(this) |
| 83 | .add("inPort", inPort) |
| 84 | .add("outPort", outPort) |
| 85 | .add("channel", channel) |
| 86 | .add("attenuation", attenuation) |
| 87 | .toString(); |
| 88 | } |
| 89 | } |