blob: 3e2f74201f73d732bed68381e22dca54c94b1259 [file] [log] [blame]
Jonathan Harteb8c9472015-08-05 07:43:13 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
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
Ray Milkeyfacf2862017-08-03 11:58:29 -070017package org.onosproject.net.intf;
Jonathan Harteb8c9472015-08-05 07:43:13 -070018
Ray Milkeyfacf2862017-08-03 11:58:29 -070019import java.util.Set;
20
Jonathan Harteb8c9472015-08-05 07:43:13 -070021import org.onlab.packet.IpAddress;
22import org.onlab.packet.VlanId;
Jonathan Hart4b5c6dc2015-10-13 14:27:48 -070023import org.onosproject.event.ListenerService;
Jonathan Harteb8c9472015-08-05 07:43:13 -070024import org.onosproject.net.ConnectPoint;
25
Jonathan Harteb8c9472015-08-05 07:43:13 -070026/**
27 * Service for interacting with interfaces.
28 */
Ray Milkeyfacf2862017-08-03 11:58:29 -070029
Jonathan Hart4b5c6dc2015-10-13 14:27:48 -070030public interface InterfaceService
31 extends ListenerService<InterfaceEvent, InterfaceListener> {
Jonathan Harteb8c9472015-08-05 07:43:13 -070032
33 /**
34 * Returns the set of all interfaces in the system.
35 *
36 * @return set of interfaces
37 */
38 Set<Interface> getInterfaces();
39
40 /**
Jonathan Hart43d232e2016-02-03 15:34:10 -080041 * Returns the interface with the given name.
42 *
43 * @param connectPoint connect point of the interface
44 * @param name name of the interface
45 * @return interface if it exists, otherwise null
46 */
47 Interface getInterfaceByName(ConnectPoint connectPoint, String name);
48
49 /**
Jonathan Harteb8c9472015-08-05 07:43:13 -070050 * Returns the set of interfaces configured on the given port.
51 *
52 * @param port connect point
53 * @return set of interfaces
54 */
55 Set<Interface> getInterfacesByPort(ConnectPoint port);
56
57 /**
58 * Returns the set of interfaces with the given IP address.
59 *
60 * @param ip IP address
61 * @return set of interfaces
62 */
63 Set<Interface> getInterfacesByIp(IpAddress ip);
64
65 /**
66 * Returns the set of interfaces in the given VLAN.
67 *
68 * @param vlan VLAN ID of the interfaces
69 * @return set of interfaces
70 */
71 Set<Interface> getInterfacesByVlan(VlanId vlan);
72
73 /**
74 * Returns an interface that has an address that is in the same subnet as
75 * the given IP address.
76 *
77 * @param ip IP address to find matching subnet interface for
78 * @return interface
79 */
80 Interface getMatchingInterface(IpAddress ip);
Charles Chanb3b09cd2017-03-14 12:53:46 -070081
82 /**
83 * Returns all interfaces that have an address that is in the same
84 * subnet as the given IP address.
85 *
86 * @param ip IP address to find matching subnet interface for
87 * @return a set of interfaces
88 */
89 Set<Interface> getMatchingInterfaces(IpAddress ip);
Jonathan Harteb8c9472015-08-05 07:43:13 -070090}