blob: 80996eb678ecbd8bb2c232f9a30f44e821f7ca5b [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2014-present Open Networking Foundation
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;
tom0eb04ca2014-08-25 14:34:51 -070017
Brian O'Connorabafb502014-12-02 22:26:20 -080018import org.onosproject.net.DeviceId;
19import org.onosproject.net.MastershipRole;
20import org.onosproject.net.provider.ProviderService;
tom0eb04ca2014-08-25 14:34:51 -070021
sangho538108b2015-04-08 14:29:20 -070022import java.util.Collection;
tom0eb04ca2014-08-25 14:34:51 -070023import java.util.List;
24
25/**
26 * Service through which device providers can inject device information into
27 * the core.
28 */
tomd7356722014-08-26 01:07:39 -070029public interface DeviceProviderService extends ProviderService<DeviceProvider> {
tom0eb04ca2014-08-25 14:34:51 -070030
31 // TODO: define suspend and remove actions on the mezzanine administrative API
32
33 /**
34 * Signals the core that a device has connected or has been detected somehow.
35 *
Yuta HIGUCHI5c947272014-11-03 21:39:21 -080036 * @param deviceId device identifier
tom0eb04ca2014-08-25 14:34:51 -070037 * @param deviceDescription information about network device
38 */
tomd1c06492014-09-03 11:07:58 -070039 void deviceConnected(DeviceId deviceId, DeviceDescription deviceDescription);
tom0eb04ca2014-08-25 14:34:51 -070040
41 /**
42 * Signals the core that a device has disconnected or is no longer reachable.
43 *
tomd3097b02014-08-26 10:40:29 -070044 * @param deviceId identity of the device to be removed
tom0eb04ca2014-08-25 14:34:51 -070045 */
tomd3097b02014-08-26 10:40:29 -070046 void deviceDisconnected(DeviceId deviceId);
tom0eb04ca2014-08-25 14:34:51 -070047
48 /**
sangyun-hanb885ed02016-10-13 15:49:43 +090049 * Updates information about all ports of a device. It is up to the core to
tom0eb04ca2014-08-25 14:34:51 -070050 * determine what has changed.
51 *
tom32f66842014-08-27 19:27:47 -070052 * @param deviceId identity of the device
53 * @param portDescriptions list of device ports
tom0eb04ca2014-08-25 14:34:51 -070054 */
tom32f66842014-08-27 19:27:47 -070055 void updatePorts(DeviceId deviceId, List<PortDescription> portDescriptions);
tom0eb04ca2014-08-25 14:34:51 -070056
57 /**
Michal Machce774332017-01-25 11:02:55 +010058 * Delete information about a single port of a device.
59 * It is up to the core to determine what has changed.
60 *
61 * @param deviceId identity of the device
62 * @param portDescription device port description
63 */
64 default void deletePort(DeviceId deviceId, PortDescription portDescription) {
65
66 }
67
68 /**
sangyun-hanb885ed02016-10-13 15:49:43 +090069 * Notifies the core about port status change of a single port.
tom0eb04ca2014-08-25 14:34:51 -070070 *
tom32f66842014-08-27 19:27:47 -070071 * @param deviceId identity of the device
72 * @param portDescription description of the port that changed
tom0eb04ca2014-08-25 14:34:51 -070073 */
tom32f66842014-08-27 19:27:47 -070074 void portStatusChanged(DeviceId deviceId, PortDescription portDescription);
tom0eb04ca2014-08-25 14:34:51 -070075
tom3f2bbd72014-09-24 12:07:58 -070076 /**
Ayaka Koshibe3ef2b0d2014-10-31 13:58:27 -070077 * Notifies the core about the result of a RoleRequest sent to a device.
tom3f2bbd72014-09-24 12:07:58 -070078 *
79 * @param deviceId identity of the device
Ayaka Koshibe3ef2b0d2014-10-31 13:58:27 -070080 * @param requested mastership role that was requested by the node
Yuta HIGUCHI5c947272014-11-03 21:39:21 -080081 * @param response mastership role the switch accepted
tom3f2bbd72014-09-24 12:07:58 -070082 */
Ayaka Koshibe3ef2b0d2014-10-31 13:58:27 -070083 void receivedRoleReply(DeviceId deviceId, MastershipRole requested, MastershipRole response);
tom3f2bbd72014-09-24 12:07:58 -070084
sangho538108b2015-04-08 14:29:20 -070085 /**
sangyun-hanb885ed02016-10-13 15:49:43 +090086 * Updates statistics about all ports of a device.
sangho538108b2015-04-08 14:29:20 -070087 *
88 * @param deviceId identity of the device
89 * @param portStatistics list of device port statistics
90 */
91 void updatePortStatistics(DeviceId deviceId, Collection<PortStatistics> portStatistics);
92
tom0eb04ca2014-08-25 14:34:51 -070093}