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 | */ |
| 43 | Iterable<ConnectPoint> getEdgePoint(); |
| 44 | |
| 45 | /** |
| 46 | * Returns a collection of all edge point for the specified device. |
| 47 | * |
| 48 | * @return iterable collection of all edge points for the device |
| 49 | */ |
| 50 | Iterable<ConnectPoint> getEdgePoint(DeviceId deviceId); |
| 51 | |
| 52 | /** |
| 53 | * Emits the specified packet, with optional treatment to all edge ports. |
| 54 | * |
| 55 | * @param data packet data |
| 56 | * @param treatment optional traffic treatment to apply to the packet |
| 57 | */ |
| 58 | void emitPacket(ByteBuffer data, Optional<TrafficTreatment> treatment); |
| 59 | |
| 60 | /** |
| 61 | * Emits the specified packet, with optional treatment to all edge ports. |
| 62 | * |
| 63 | * @param deviceId device where to send the packet out |
| 64 | * @param data packet data |
| 65 | * @param treatment optional traffic treatment to apply to the packet |
| 66 | */ |
| 67 | void emitPacket(DeviceId deviceId, ByteBuffer data, |
| 68 | Optional<TrafficTreatment> treatment); |
| 69 | |
| 70 | /** |
| 71 | * Adds a listener for edge port events. |
| 72 | * |
| 73 | * @param listener listener to be added |
| 74 | */ |
| 75 | void addListener(EdgePortListener listener); |
| 76 | |
| 77 | /** |
| 78 | * Removes the listener for edge port events. |
| 79 | * |
| 80 | * @param listener listener to be removed |
| 81 | */ |
| 82 | void removeListener(EdgePortListener listener); |
| 83 | |
| 84 | } |