blob: 795e4c0aec8e15f7dd87f77587b22b69ac32da5b [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Ray Milkey34c95902015-04-15 09:47:53 -07002 * Copyright 2014-2015 Open Networking Laboratory
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07003 *
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;
samuel738dfaf2015-07-11 11:08:57 +080022import org.onosproject.net.Device.Type;
Brian O'Connorabafb502014-12-02 22:26:20 -080023import org.onosproject.net.DeviceId;
24import org.onosproject.net.MastershipRole;
25import org.onosproject.net.Port;
26import org.onosproject.net.PortNumber;
tom61359e92014-09-16 15:50:27 -070027
HIGUCHI Yuta5bb99a42015-03-19 16:52:15 -070028import java.util.Collections;
tom61359e92014-09-16 15:50:27 -070029import java.util.List;
30
31/**
32 * Test adapter for device service.
33 */
34public class DeviceServiceAdapter implements DeviceService {
35 @Override
36 public int getDeviceCount() {
37 return 0;
38 }
39
40 @Override
41 public Iterable<Device> getDevices() {
HIGUCHI Yuta5bb99a42015-03-19 16:52:15 -070042 return Collections.emptyList();
tom61359e92014-09-16 15:50:27 -070043 }
44
45 @Override
Yuta HIGUCHIf1f2ac02014-11-26 14:02:22 -080046 public Iterable<Device> getAvailableDevices() {
47 return FluentIterable.from(getDevices())
48 .filter(new Predicate<Device>() {
49
50 @Override
51 public boolean apply(Device input) {
52 return isAvailable(input.id());
53 }
54 });
55 }
56
57 @Override
tom61359e92014-09-16 15:50:27 -070058 public Device getDevice(DeviceId deviceId) {
59 return null;
60 }
61
62 @Override
63 public MastershipRole getRole(DeviceId deviceId) {
HIGUCHI Yuta5bb99a42015-03-19 16:52:15 -070064 return MastershipRole.NONE;
tom61359e92014-09-16 15:50:27 -070065 }
66
67 @Override
68 public List<Port> getPorts(DeviceId deviceId) {
HIGUCHI Yuta5bb99a42015-03-19 16:52:15 -070069 return Collections.emptyList();
tom61359e92014-09-16 15:50:27 -070070 }
71
72 @Override
sangho538108b2015-04-08 14:29:20 -070073 public List<PortStatistics> getPortStatistics(DeviceId deviceId) {
74 return null;
75 }
76
77 @Override
Dusan Pajin11ff4a82015-08-20 18:03:05 +020078 public List<PortStatistics> getPortDeltaStatistics(DeviceId deviceId) {
79 return null;
80 }
81
82 @Override
tom61359e92014-09-16 15:50:27 -070083 public Port getPort(DeviceId deviceId, PortNumber portNumber) {
84 return null;
85 }
86
87 @Override
88 public boolean isAvailable(DeviceId deviceId) {
89 return false;
90 }
91
92 @Override
93 public void addListener(DeviceListener listener) {
94 }
95
96 @Override
97 public void removeListener(DeviceListener listener) {
98 }
99
samuel738dfaf2015-07-11 11:08:57 +0800100 @Override
101 public Iterable<Device> getDevices(Type type) {
102 return Collections.emptyList();
103 }
104
105 @Override
106 public Iterable<Device> getAvailableDevices(Type type) {
107 return Collections.emptyList();
108 }
109
tom61359e92014-09-16 15:50:27 -0700110}