Jonathan Hart | eb8c947 | 2015-08-05 07:43:13 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Jonathan Hart | eb8c947 | 2015-08-05 07:43:13 -0700 | [diff] [blame] | 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.incubator.net.intf; |
| 18 | |
Thomas Vachuska | 4c571ae | 2015-09-10 16:31:59 -0700 | [diff] [blame] | 19 | import com.google.common.annotations.Beta; |
Jonathan Hart | eb8c947 | 2015-08-05 07:43:13 -0700 | [diff] [blame] | 20 | import org.onlab.packet.IpAddress; |
| 21 | import org.onlab.packet.VlanId; |
Jonathan Hart | 4b5c6dc | 2015-10-13 14:27:48 -0700 | [diff] [blame] | 22 | import org.onosproject.event.ListenerService; |
Jonathan Hart | eb8c947 | 2015-08-05 07:43:13 -0700 | [diff] [blame] | 23 | import org.onosproject.net.ConnectPoint; |
| 24 | |
| 25 | import java.util.Set; |
| 26 | |
| 27 | /** |
| 28 | * Service for interacting with interfaces. |
| 29 | */ |
Thomas Vachuska | 4c571ae | 2015-09-10 16:31:59 -0700 | [diff] [blame] | 30 | @Beta |
Jonathan Hart | 4b5c6dc | 2015-10-13 14:27:48 -0700 | [diff] [blame] | 31 | public interface InterfaceService |
| 32 | extends ListenerService<InterfaceEvent, InterfaceListener> { |
Jonathan Hart | eb8c947 | 2015-08-05 07:43:13 -0700 | [diff] [blame] | 33 | |
| 34 | /** |
| 35 | * Returns the set of all interfaces in the system. |
| 36 | * |
| 37 | * @return set of interfaces |
| 38 | */ |
| 39 | Set<Interface> getInterfaces(); |
| 40 | |
| 41 | /** |
Jonathan Hart | 43d232e | 2016-02-03 15:34:10 -0800 | [diff] [blame] | 42 | * Returns the interface with the given name. |
| 43 | * |
| 44 | * @param connectPoint connect point of the interface |
| 45 | * @param name name of the interface |
| 46 | * @return interface if it exists, otherwise null |
| 47 | */ |
| 48 | Interface getInterfaceByName(ConnectPoint connectPoint, String name); |
| 49 | |
| 50 | /** |
Jonathan Hart | eb8c947 | 2015-08-05 07:43:13 -0700 | [diff] [blame] | 51 | * Returns the set of interfaces configured on the given port. |
| 52 | * |
| 53 | * @param port connect point |
| 54 | * @return set of interfaces |
| 55 | */ |
| 56 | Set<Interface> getInterfacesByPort(ConnectPoint port); |
| 57 | |
| 58 | /** |
| 59 | * Returns the set of interfaces with the given IP address. |
| 60 | * |
| 61 | * @param ip IP address |
| 62 | * @return set of interfaces |
| 63 | */ |
| 64 | Set<Interface> getInterfacesByIp(IpAddress ip); |
| 65 | |
| 66 | /** |
| 67 | * Returns the set of interfaces in the given VLAN. |
| 68 | * |
| 69 | * @param vlan VLAN ID of the interfaces |
| 70 | * @return set of interfaces |
| 71 | */ |
| 72 | Set<Interface> getInterfacesByVlan(VlanId vlan); |
| 73 | |
| 74 | /** |
| 75 | * Returns an interface that has an address that is in the same subnet as |
| 76 | * the given IP address. |
| 77 | * |
| 78 | * @param ip IP address to find matching subnet interface for |
| 79 | * @return interface |
| 80 | */ |
| 81 | Interface getMatchingInterface(IpAddress ip); |
Charles Chan | b3b09cd | 2017-03-14 12:53:46 -0700 | [diff] [blame^] | 82 | |
| 83 | /** |
| 84 | * Returns all interfaces that have an address that is in the same |
| 85 | * subnet as the given IP address. |
| 86 | * |
| 87 | * @param ip IP address to find matching subnet interface for |
| 88 | * @return a set of interfaces |
| 89 | */ |
| 90 | Set<Interface> getMatchingInterfaces(IpAddress ip); |
Jonathan Hart | eb8c947 | 2015-08-05 07:43:13 -0700 | [diff] [blame] | 91 | } |