Thomas Vachuska | a8f4e7d | 2015-01-08 17:31:55 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 3 | * |
| 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 | package org.onosproject.net.driver; |
| 17 | |
| 18 | import org.onosproject.net.DeviceId; |
| 19 | |
| 20 | import java.util.Set; |
| 21 | |
| 22 | /** |
| 23 | * Service for obtaining drivers and driver behaviour implementations. |
| 24 | */ |
| 25 | public interface DriverService { |
| 26 | |
| 27 | /** |
| 28 | * Returns the overall set of drivers being provided, optionally |
| 29 | * filtered to only those that support all specified behaviours. |
| 30 | * |
| 31 | * @param withBehaviours optional behaviour classes to query by |
| 32 | * @return provided drivers |
| 33 | */ |
| 34 | Set<Driver> getDrivers(Class<? extends Behaviour>... withBehaviours); |
| 35 | |
| 36 | /** |
| 37 | * Returns the specified driver. |
| 38 | * |
| 39 | * @param driverName driver name |
| 40 | * @return driver |
| 41 | */ |
| 42 | Driver getDriver(String driverName); |
| 43 | |
| 44 | /** |
| 45 | * Returns the driver that matches the specified primordial device |
| 46 | * discovery information. |
| 47 | * |
| 48 | * @param mfr device manufacturer |
| 49 | * @param hw device hardware name/version |
| 50 | * @param sw device software version |
| 51 | * @return driver or null of no matching one is found |
| 52 | */ |
| 53 | Driver getDriver(String mfr, String hw, String sw); |
| 54 | |
| 55 | /** |
| 56 | * Creates a new driver handler for the specified driver. |
| 57 | * |
| 58 | * @param driverName driver name |
| 59 | * @param deviceId device identifier |
| 60 | * @param credentials optional login credentials in string form |
| 61 | * @return driver handler |
| 62 | */ |
| 63 | DriverHandler createHandler(String driverName, DeviceId deviceId, |
| 64 | String... credentials); |
| 65 | |
| 66 | /** |
| 67 | * Creates a new driver handler for the specified driver data. |
| 68 | * |
| 69 | * @param data driver data |
| 70 | * @param deviceId device identifier |
| 71 | * @param credentials optional login credentials in string form |
| 72 | * @return driver handler |
| 73 | */ |
| 74 | DriverHandler createHandler(DriverData data, DeviceId deviceId, |
| 75 | String... credentials); |
| 76 | |
| 77 | } |