blob: c3eb09951729f217bb0d571085e032d9c885f64a [file] [log] [blame]
Thomas Vachuska96d55b12015-05-11 08:52:03 -07001/*
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.incubator.net.config.basics;
17
18import org.onosproject.net.Device;
19import org.onosproject.net.DeviceId;
20
21/**
22 * Basic configuration for network infrastructure devices.
23 */
24public class BasicDeviceConfig extends BasicElementConfig<DeviceId> {
25
26 public static final String TYPE = "type";
27 public static final String DRIVER = "driver";
28
29 /**
30 * Returns the device type.
31 *
32 * @return device type override
33 */
34 public Device.Type type() {
35 return get(TYPE, Device.Type.SWITCH, Device.Type.class);
36 }
37
38 /**
39 * Sets the device type.
40 *
41 * @param type device type override
42 * @return self
43 */
44 public BasicDeviceConfig type(Device.Type type) {
45 return (BasicDeviceConfig) setOrClear(TYPE, type);
46 }
47
48 /**
49 * Returns the device driver name.
50 *
51 * @return driver name of null if not set
52 */
53 public String driver() {
54 return get(DRIVER, subject.toString());
55 }
56
57 /**
58 * Sets the driver name.
59 *
60 * @param driverName new driver name; null to clear
61 * @return self
62 */
63 public BasicElementConfig driver(String driverName) {
64 return (BasicElementConfig) setOrClear(DRIVER, driverName);
65 }
66
67 // TODO: device port meta-data to be configured via BasicPortsConfig
68 // TODO: device credentials/keys
69
70}