Thomas Vachuska | 41f4d3e | 2015-06-24 10:57:25 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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.edge; |
| 17 | |
| 18 | import org.onosproject.net.ConnectPoint; |
| 19 | import org.onosproject.net.DeviceId; |
| 20 | import org.onosproject.net.flow.TrafficTreatment; |
| 21 | |
| 22 | import java.nio.ByteBuffer; |
| 23 | import java.util.Optional; |
| 24 | |
| 25 | /** |
| 26 | * Service for interacting with an inventory of network edge ports. |
| 27 | */ |
| 28 | public interface EdgePortService { |
| 29 | |
| 30 | /** |
| 31 | * Indicates whether or not the specified connection point is an edge point. |
| 32 | * |
| 33 | * @param point connection point |
| 34 | * @return true if edge point |
| 35 | */ |
| 36 | boolean isEdgePoint(ConnectPoint point); |
| 37 | |
| 38 | /** |
| 39 | * Returns a collection of all edge point within the current topology. |
| 40 | * |
| 41 | * @return iterable collection of all edge points |
| 42 | */ |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 43 | Iterable<ConnectPoint> getEdgePoints(); |
Thomas Vachuska | 41f4d3e | 2015-06-24 10:57:25 -0700 | [diff] [blame] | 44 | |
| 45 | /** |
| 46 | * Returns a collection of all edge point for the specified device. |
| 47 | * |
Madan Jampani | 0dbac7a | 2015-06-25 10:37:45 -0700 | [diff] [blame] | 48 | * @param deviceId device identifier |
Thomas Vachuska | 41f4d3e | 2015-06-24 10:57:25 -0700 | [diff] [blame] | 49 | * @return iterable collection of all edge points for the device |
| 50 | */ |
Aaron Kruglikov | a2b5915 | 2015-06-24 14:01:41 -0700 | [diff] [blame] | 51 | Iterable<ConnectPoint> getEdgePoints(DeviceId deviceId); |
Thomas Vachuska | 41f4d3e | 2015-06-24 10:57:25 -0700 | [diff] [blame] | 52 | |
| 53 | /** |
| 54 | * Emits the specified packet, with optional treatment to all edge ports. |
| 55 | * |
| 56 | * @param data packet data |
| 57 | * @param treatment optional traffic treatment to apply to the packet |
| 58 | */ |
| 59 | void emitPacket(ByteBuffer data, Optional<TrafficTreatment> treatment); |
| 60 | |
| 61 | /** |
| 62 | * Emits the specified packet, with optional treatment to all edge ports. |
| 63 | * |
| 64 | * @param deviceId device where to send the packet out |
| 65 | * @param data packet data |
| 66 | * @param treatment optional traffic treatment to apply to the packet |
| 67 | */ |
| 68 | void emitPacket(DeviceId deviceId, ByteBuffer data, |
| 69 | Optional<TrafficTreatment> treatment); |
| 70 | |
| 71 | /** |
| 72 | * Adds a listener for edge port events. |
| 73 | * |
| 74 | * @param listener listener to be added |
| 75 | */ |
| 76 | void addListener(EdgePortListener listener); |
| 77 | |
| 78 | /** |
| 79 | * Removes the listener for edge port events. |
| 80 | * |
| 81 | * @param listener listener to be removed |
| 82 | */ |
| 83 | void removeListener(EdgePortListener listener); |
| 84 | |
| 85 | } |