blob: 4de235f5171e7e11aad7fad04e5a997e3c4dd81f [file] [log] [blame]
Jonathan Harteb8c9472015-08-05 07:43:13 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Jonathan Harteb8c9472015-08-05 07:43:13 -07003 *
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
17package org.onosproject.incubator.net.intf;
18
Thomas Vachuska4c571ae2015-09-10 16:31:59 -070019import com.google.common.annotations.Beta;
Jonathan Harteb8c9472015-08-05 07:43:13 -070020import org.onlab.packet.IpAddress;
21import org.onlab.packet.VlanId;
Jonathan Hart4b5c6dc2015-10-13 14:27:48 -070022import org.onosproject.event.ListenerService;
Jonathan Harteb8c9472015-08-05 07:43:13 -070023import org.onosproject.net.ConnectPoint;
24
25import java.util.Set;
26
27/**
28 * Service for interacting with interfaces.
29 */
Thomas Vachuska4c571ae2015-09-10 16:31:59 -070030@Beta
Jonathan Hart4b5c6dc2015-10-13 14:27:48 -070031public interface InterfaceService
32 extends ListenerService<InterfaceEvent, InterfaceListener> {
Jonathan Harteb8c9472015-08-05 07:43:13 -070033
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 Hart43d232e2016-02-03 15:34:10 -080042 * 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 Harteb8c9472015-08-05 07:43:13 -070051 * 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 Chanb3b09cd2017-03-14 12:53:46 -070082
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 Harteb8c9472015-08-05 07:43:13 -070091}