Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 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 | */ |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 16 | package org.onlab.onos.net; |
| 17 | |
Jonathan Hart | b79d641 | 2014-09-19 11:24:06 -0700 | [diff] [blame] | 18 | |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 19 | /** |
| 20 | * Abstraction of a network port. |
| 21 | */ |
tom | 3ea1125 | 2014-10-02 04:32:26 -0700 | [diff] [blame] | 22 | public interface Port extends Annotated { |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 23 | |
Thomas Vachuska | d16ce18 | 2014-10-29 17:25:29 -0700 | [diff] [blame] | 24 | /** Represents coarse port type classification. */ |
| 25 | public enum Type { |
| 26 | /** |
| 27 | * Signifies copper-based connectivity. |
| 28 | */ |
| 29 | COPPER, |
| 30 | |
| 31 | /** |
| 32 | * Signifies optical fiber-based connectivity. |
| 33 | */ |
| 34 | FIBER |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Returns the parent network element to which this port belongs. |
| 39 | * |
| 40 | * @return parent network element |
| 41 | */ |
| 42 | Element element(); |
| 43 | |
tom | ca20e0c | 2014-09-03 23:22:24 -0700 | [diff] [blame] | 44 | /** |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 45 | * Returns the port number. |
| 46 | * |
| 47 | * @return port number |
| 48 | */ |
| 49 | PortNumber number(); |
| 50 | |
| 51 | /** |
tom | ca20e0c | 2014-09-03 23:22:24 -0700 | [diff] [blame] | 52 | * Indicates whether or not the port is currently up and active. |
| 53 | * |
| 54 | * @return true if the port is operational |
| 55 | */ |
| 56 | boolean isEnabled(); |
| 57 | |
| 58 | /** |
Thomas Vachuska | d16ce18 | 2014-10-29 17:25:29 -0700 | [diff] [blame] | 59 | * Returns the port type. |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 60 | * |
Thomas Vachuska | d16ce18 | 2014-10-29 17:25:29 -0700 | [diff] [blame] | 61 | * @return port type |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 62 | */ |
Thomas Vachuska | d16ce18 | 2014-10-29 17:25:29 -0700 | [diff] [blame] | 63 | Type type(); |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 64 | |
Thomas Vachuska | d16ce18 | 2014-10-29 17:25:29 -0700 | [diff] [blame] | 65 | /** |
| 66 | * Returns the current port speed in Mbps. |
| 67 | * |
| 68 | * @return current port speed |
| 69 | */ |
| 70 | long portSpeed(); |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 71 | |
Thomas Vachuska | d16ce18 | 2014-10-29 17:25:29 -0700 | [diff] [blame] | 72 | // TODO: more attributes? |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 73 | } |