blob: 4f72702b46eb1fe8c568bfefb9f1551d45f92f4f [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 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 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.device;
tom61359e92014-09-16 15:50:27 -070017
Bri Prebilic Cole09e464b2015-01-07 17:13:54 -080018import com.google.common.base.Predicate;
19import com.google.common.collect.FluentIterable;
HIGUCHI Yuta5bb99a42015-03-19 16:52:15 -070020
Brian O'Connorabafb502014-12-02 22:26:20 -080021import org.onosproject.net.Device;
22import org.onosproject.net.DeviceId;
23import org.onosproject.net.MastershipRole;
24import org.onosproject.net.Port;
25import org.onosproject.net.PortNumber;
tom61359e92014-09-16 15:50:27 -070026
HIGUCHI Yuta5bb99a42015-03-19 16:52:15 -070027import java.util.Collections;
tom61359e92014-09-16 15:50:27 -070028import java.util.List;
29
30/**
31 * Test adapter for device service.
32 */
33public class DeviceServiceAdapter implements DeviceService {
34 @Override
35 public int getDeviceCount() {
36 return 0;
37 }
38
39 @Override
40 public Iterable<Device> getDevices() {
HIGUCHI Yuta5bb99a42015-03-19 16:52:15 -070041 return Collections.emptyList();
tom61359e92014-09-16 15:50:27 -070042 }
43
44 @Override
Yuta HIGUCHIf1f2ac02014-11-26 14:02:22 -080045 public Iterable<Device> getAvailableDevices() {
46 return FluentIterable.from(getDevices())
47 .filter(new Predicate<Device>() {
48
49 @Override
50 public boolean apply(Device input) {
51 return isAvailable(input.id());
52 }
53 });
54 }
55
56 @Override
tom61359e92014-09-16 15:50:27 -070057 public Device getDevice(DeviceId deviceId) {
58 return null;
59 }
60
61 @Override
62 public MastershipRole getRole(DeviceId deviceId) {
HIGUCHI Yuta5bb99a42015-03-19 16:52:15 -070063 return MastershipRole.NONE;
tom61359e92014-09-16 15:50:27 -070064 }
65
66 @Override
67 public List<Port> getPorts(DeviceId deviceId) {
HIGUCHI Yuta5bb99a42015-03-19 16:52:15 -070068 return Collections.emptyList();
tom61359e92014-09-16 15:50:27 -070069 }
70
71 @Override
sangho538108b2015-04-08 14:29:20 -070072 public List<PortStatistics> getPortStatistics(DeviceId deviceId) {
73 return null;
74 }
75
76 @Override
tom61359e92014-09-16 15:50:27 -070077 public Port getPort(DeviceId deviceId, PortNumber portNumber) {
78 return null;
79 }
80
81 @Override
82 public boolean isAvailable(DeviceId deviceId) {
83 return false;
84 }
85
86 @Override
87 public void addListener(DeviceListener listener) {
88 }
89
90 @Override
91 public void removeListener(DeviceListener listener) {
92 }
93
94}