blob: a6883d537aa977e55167402c4cc574c10d046081 [file] [log] [blame]
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -08001/*
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 */
16package org.onosproject.net.driver;
17
18import org.onosproject.net.Annotations;
19
20import java.util.Map;
21import java.util.Set;
22
23/**
24 * Representation of a specific family of device drivers. Behaviour configuration
25 * data is stored using {@link org.onosproject.net.Annotations}.
26 */
27public interface Driver extends Annotations {
28
29 /**
30 * Returns the driver name. This is expected to be a reverse-DNS,
31 * Java package-like name.
32 *
33 * @return driver name
34 */
35 String name();
36
37 /**
38 * Returns the device manufacturer name.
39 *
40 * @return manufacturer name
41 */
42 String manufacturer();
43
44 /**
45 * Returns the device hardware version.
46 *
47 * @return hardware version
48 */
49 String hwVersion();
50
51 /**
52 * Returns the device software version.
53 *
54 * @return software version
55 */
56 String swVersion();
57
58 /**
59 * Returns the set of behaviours supported by this driver.
60 *
61 * @return set of device driver behaviours
62 */
63 Set<Class<? extends Behaviour>> behaviours();
64
65 /**
66 * Indicates whether or not the driver supports the specified class
67 * of behaviour.
68 *
69 * @param behaviourClass behaviour class
70 * @return true if behaviour is supported
71 */
72 boolean hasBehaviour(Class<? extends Behaviour> behaviourClass);
73
74 /**
75 * Creates an instance of behaviour primed with the specified driver data.
76 *
77 * @param data driver data context
78 * @param behaviourClass driver behaviour class
79 * @param handler indicates behaviour is intended for handler context
80 * @param <T> type of behaviour
81 * @return behaviour instance
82 */
83 <T extends Behaviour> T createBehaviour(DriverData data, Class<T> behaviourClass,
84 boolean handler);
85
86 /**
87 * Returns the set of annotations as map of key/value properties.
88 *
89 * @return map of properties
90 */
91 Map<String, String> properties();
92
93}