blob: e4432d1e8965895fff7ec9aeb57facf0a73b3bfc [file] [log] [blame]
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -08003 *
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 */
16package org.onosproject.net.driver;
17
18import org.onosproject.net.DeviceId;
19
20import java.util.Set;
21
22/**
23 * Service for obtaining drivers and driver behaviour implementations.
24 */
Thomas Vachuska11b99fc2017-04-27 12:51:04 -070025public interface DriverService extends DriverRegistry {
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080026
27 /**
Thomas Vachuska5c2f8132015-04-08 23:09:08 -070028 * Returns the overall set of drivers being provided.
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080029 *
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080030 * @return provided drivers
31 */
Thomas Vachuska5c2f8132015-04-08 23:09:08 -070032 Set<Driver> getDrivers();
33
34 /**
35 * Returns the set of drivers which support the specified behaviour.
36 *
37 * @param withBehaviour behaviour class to query by
38 * @return provided drivers
39 */
40 Set<Driver> getDrivers(Class<? extends Behaviour> withBehaviour);
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080041
42 /**
Thomas Vachuska164ecf62018-05-08 17:29:55 -070043 * Returns the driver for the specified device. If the network configuration
44 * for the specified device carries the {@code driver} property or if the
45 * device carries the {@code driver} annotation, they will be used to look-up
46 * the driver, in respective order.
Thomas Vachuskaca88bb72015-04-08 19:38:02 -070047 * Otherwise, the device manufacturer, hardware and software version
48 * attributes are used to look-up the driver. First using their literal
49 * values and if no driver is found, using ERE matching against the
50 * driver manufacturer, hardware and software version fields.
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080051 *
Thomas Vachuskaca88bb72015-04-08 19:38:02 -070052 * @param deviceId device identifier
53 * @return driver or null of no matching one is found
54 * @throws org.onlab.util.ItemNotFoundException if device or driver for it
55 * are not found
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080056 */
Thomas Vachuskaca88bb72015-04-08 19:38:02 -070057 Driver getDriver(DeviceId deviceId);
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080058
59 /**
Thomas Vachuskaca88bb72015-04-08 19:38:02 -070060 * Creates a new driver handler for interacting with the specified device.
61 * The driver is looked-up using the same semantics as
62 * {@link #getDriver(DeviceId)} method.
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080063 *
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080064 * @param deviceId device identifier
65 * @param credentials optional login credentials in string form
66 * @return driver handler
Thomas Vachuskaca88bb72015-04-08 19:38:02 -070067 * @throws org.onlab.util.ItemNotFoundException if device or driver for it
68 * are not found
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080069 */
Thomas Vachuskaca88bb72015-04-08 19:38:02 -070070 DriverHandler createHandler(DeviceId deviceId, String... credentials);
71
72 // TODO: Devise a mechanism for retaining DriverData for devices
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080073
74}