blob: ab6dba5e4b43adb29344f38df6d15aaabdc1eb1c [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Ray Milkey34c95902015-04-15 09:47:53 -07002 * Copyright 2014-2015 Open Networking Laboratory
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -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 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.device;
tome33cc1a2014-08-25 21:59:41 -070017
Brian O'Connorabafb502014-12-02 22:26:20 -080018import org.onosproject.net.Device;
19import org.onosproject.net.DeviceId;
20import org.onosproject.net.MastershipRole;
21import org.onosproject.net.Port;
22import org.onosproject.net.PortNumber;
tomb36046e2014-08-27 00:22:24 -070023
24import java.util.List;
tome33cc1a2014-08-25 21:59:41 -070025
26/**
27 * Service for interacting with the inventory of infrastructure devices.
28 */
29public interface DeviceService {
30
31 /**
tomad2d2092014-09-06 23:24:20 -070032 * Returns the number of infrastructure devices known to the system.
tome33cc1a2014-08-25 21:59:41 -070033 *
tomad2d2092014-09-06 23:24:20 -070034 * @return number of infrastructure devices
tome33cc1a2014-08-25 21:59:41 -070035 */
tomad2d2092014-09-06 23:24:20 -070036 int getDeviceCount();
tome33cc1a2014-08-25 21:59:41 -070037
38 /**
tomedf06bb2014-08-27 16:22:15 -070039 * Returns a collection of the currently known infrastructure
tome33cc1a2014-08-25 21:59:41 -070040 * devices.
41 *
42 * @return collection of devices
43 */
44 Iterable<Device> getDevices();
45
46 /**
samuel738dfaf2015-07-11 11:08:57 +080047 * Returns a collection of the currently known infrastructure
48 * devices by device type.
49 *
50 * @param type device type
51 * @return collection of devices
52 */
53 Iterable<Device> getDevices(Device.Type type);
54
55 /**
Yuta HIGUCHIf1f2ac02014-11-26 14:02:22 -080056 * Returns an iterable collection of all devices
57 * currently available to the system.
58 *
59 * @return device collection
60 */
61 Iterable<Device> getAvailableDevices();
62
63 /**
samuel738dfaf2015-07-11 11:08:57 +080064 * Returns an iterable collection of all devices currently available to the system by device type.
65 *
66 * @param type device type
67 * @return device collection
68 */
69 Iterable<Device> getAvailableDevices(Device.Type type);
70
71 /**
tome33cc1a2014-08-25 21:59:41 -070072 * Returns the device with the specified identifier.
73 *
74 * @param deviceId device identifier
75 * @return device or null if one with the given identifier is not known
76 */
77 Device getDevice(DeviceId deviceId);
78
tomad2d2092014-09-06 23:24:20 -070079 /**
80 * Returns the current mastership role for the specified device.
81 *
82 * @param deviceId device identifier
83 * @return designated mastership role
84 */
Ayaka Koshibe25fd23a2014-10-03 15:50:43 -070085 //XXX do we want this method here when MastershipService already does?
tomad2d2092014-09-06 23:24:20 -070086 MastershipRole getRole(DeviceId deviceId);
87
tome33cc1a2014-08-25 21:59:41 -070088
tomb36046e2014-08-27 00:22:24 -070089 /**
90 * Returns the list of ports associated with the device.
91 *
92 * @param deviceId device identifier
93 * @return list of ports
94 */
95 List<Port> getPorts(DeviceId deviceId);
96
97 /**
sangho538108b2015-04-08 14:29:20 -070098 * Returns the list of port statistics associated with the device.
99 *
100 * @param deviceId device identitifer
101 * @return list of port statistics
102 */
103 List<PortStatistics> getPortStatistics(DeviceId deviceId);
104
105 /**
tomb36046e2014-08-27 00:22:24 -0700106 * Returns the port with the specified number and hosted by the given device.
tomff7eb7c2014-09-08 12:49:03 -0700107 *
108 * @param deviceId device identifier
tomb36046e2014-08-27 00:22:24 -0700109 * @param portNumber port number
110 * @return device port
111 */
112 Port getPort(DeviceId deviceId, PortNumber portNumber);
tome33cc1a2014-08-25 21:59:41 -0700113
114 /**
tomff7eb7c2014-09-08 12:49:03 -0700115 * Indicates whether or not the device is presently online and available.
116 *
117 * @param deviceId device identifier
118 * @return true if the device is available
119 */
120 boolean isAvailable(DeviceId deviceId);
121
122 /**
tome33cc1a2014-08-25 21:59:41 -0700123 * Adds the specified device listener.
124 *
125 * @param listener device listener
126 */
127 void addListener(DeviceListener listener);
128
129 /**
130 * Removes the specified device listener.
131 *
132 * @param listener device listener
133 */
134 void removeListener(DeviceListener listener);
tomb36046e2014-08-27 00:22:24 -0700135
tome33cc1a2014-08-25 21:59:41 -0700136}