blob: 218ccca32ffc6ddc9ad49ad4a10fff661c52b3e4 [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
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070018import org.onosproject.event.ListenerService;
Brian O'Connorabafb502014-12-02 22:26:20 -080019import org.onosproject.net.Device;
20import org.onosproject.net.DeviceId;
21import org.onosproject.net.MastershipRole;
22import org.onosproject.net.Port;
23import org.onosproject.net.PortNumber;
tomb36046e2014-08-27 00:22:24 -070024
25import java.util.List;
tome33cc1a2014-08-25 21:59:41 -070026
27/**
28 * Service for interacting with the inventory of infrastructure devices.
29 */
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070030public interface DeviceService
31 extends ListenerService<DeviceEvent, DeviceListener> {
tome33cc1a2014-08-25 21:59:41 -070032
33 /**
tomad2d2092014-09-06 23:24:20 -070034 * Returns the number of infrastructure devices known to the system.
tome33cc1a2014-08-25 21:59:41 -070035 *
tomad2d2092014-09-06 23:24:20 -070036 * @return number of infrastructure devices
tome33cc1a2014-08-25 21:59:41 -070037 */
tomad2d2092014-09-06 23:24:20 -070038 int getDeviceCount();
tome33cc1a2014-08-25 21:59:41 -070039
40 /**
tomedf06bb2014-08-27 16:22:15 -070041 * Returns a collection of the currently known infrastructure
tome33cc1a2014-08-25 21:59:41 -070042 * devices.
43 *
44 * @return collection of devices
45 */
46 Iterable<Device> getDevices();
47
48 /**
samuel738dfaf2015-07-11 11:08:57 +080049 * Returns a collection of the currently known infrastructure
50 * devices by device type.
51 *
52 * @param type device type
53 * @return collection of devices
54 */
55 Iterable<Device> getDevices(Device.Type type);
56
57 /**
Yuta HIGUCHIf1f2ac02014-11-26 14:02:22 -080058 * Returns an iterable collection of all devices
59 * currently available to the system.
60 *
61 * @return device collection
62 */
63 Iterable<Device> getAvailableDevices();
64
65 /**
samuel738dfaf2015-07-11 11:08:57 +080066 * Returns an iterable collection of all devices currently available to the system by device type.
67 *
68 * @param type device type
69 * @return device collection
70 */
71 Iterable<Device> getAvailableDevices(Device.Type type);
72
73 /**
tome33cc1a2014-08-25 21:59:41 -070074 * Returns the device with the specified identifier.
75 *
76 * @param deviceId device identifier
77 * @return device or null if one with the given identifier is not known
78 */
79 Device getDevice(DeviceId deviceId);
80
tomad2d2092014-09-06 23:24:20 -070081 /**
82 * Returns the current mastership role for the specified device.
83 *
84 * @param deviceId device identifier
85 * @return designated mastership role
86 */
Ayaka Koshibe25fd23a2014-10-03 15:50:43 -070087 //XXX do we want this method here when MastershipService already does?
tomad2d2092014-09-06 23:24:20 -070088 MastershipRole getRole(DeviceId deviceId);
89
tome33cc1a2014-08-25 21:59:41 -070090
tomb36046e2014-08-27 00:22:24 -070091 /**
92 * Returns the list of ports associated with the device.
93 *
94 * @param deviceId device identifier
95 * @return list of ports
96 */
97 List<Port> getPorts(DeviceId deviceId);
98
99 /**
sangho538108b2015-04-08 14:29:20 -0700100 * Returns the list of port statistics associated with the device.
101 *
102 * @param deviceId device identitifer
103 * @return list of port statistics
104 */
105 List<PortStatistics> getPortStatistics(DeviceId deviceId);
106
107 /**
Dusan Pajin11ff4a82015-08-20 18:03:05 +0200108 * Returns the list of port delta statistics associated with the device.
109 *
110 * @param deviceId device identitifer
111 * @return list of port statistics
112 */
113 List<PortStatistics> getPortDeltaStatistics(DeviceId deviceId);
114
115 /**
tomb36046e2014-08-27 00:22:24 -0700116 * Returns the port with the specified number and hosted by the given device.
tomff7eb7c2014-09-08 12:49:03 -0700117 *
118 * @param deviceId device identifier
tomb36046e2014-08-27 00:22:24 -0700119 * @param portNumber port number
120 * @return device port
121 */
122 Port getPort(DeviceId deviceId, PortNumber portNumber);
tome33cc1a2014-08-25 21:59:41 -0700123
124 /**
tomff7eb7c2014-09-08 12:49:03 -0700125 * Indicates whether or not the device is presently online and available.
126 *
127 * @param deviceId device identifier
128 * @return true if the device is available
129 */
130 boolean isAvailable(DeviceId deviceId);
131
tome33cc1a2014-08-25 21:59:41 -0700132}