blob: d9ce4e56d376c3fcdafe6d661779ff370649b449 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2014-present 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.collect.FluentIterable;
HIGUCHI Yuta5bb99a42015-03-19 16:52:15 -070019
Brian O'Connorabafb502014-12-02 22:26:20 -080020import org.onosproject.net.Device;
samuel738dfaf2015-07-11 11:08:57 +080021import org.onosproject.net.Device.Type;
Brian O'Connorabafb502014-12-02 22:26:20 -080022import 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())
Sho SHIMIZU74626412015-09-11 11:46:27 -070047 .filter(input -> isAvailable(input.id()));
Yuta HIGUCHIf1f2ac02014-11-26 14:02:22 -080048 }
49
50 @Override
tom61359e92014-09-16 15:50:27 -070051 public Device getDevice(DeviceId deviceId) {
52 return null;
53 }
54
55 @Override
56 public MastershipRole getRole(DeviceId deviceId) {
HIGUCHI Yuta5bb99a42015-03-19 16:52:15 -070057 return MastershipRole.NONE;
tom61359e92014-09-16 15:50:27 -070058 }
59
60 @Override
61 public List<Port> getPorts(DeviceId deviceId) {
HIGUCHI Yuta5bb99a42015-03-19 16:52:15 -070062 return Collections.emptyList();
tom61359e92014-09-16 15:50:27 -070063 }
64
65 @Override
sangho538108b2015-04-08 14:29:20 -070066 public List<PortStatistics> getPortStatistics(DeviceId deviceId) {
67 return null;
68 }
69
70 @Override
Dusan Pajin11ff4a82015-08-20 18:03:05 +020071 public List<PortStatistics> getPortDeltaStatistics(DeviceId deviceId) {
72 return null;
73 }
74
75 @Override
tom61359e92014-09-16 15:50:27 -070076 public Port getPort(DeviceId deviceId, PortNumber portNumber) {
77 return null;
78 }
79
80 @Override
81 public boolean isAvailable(DeviceId deviceId) {
82 return false;
83 }
84
85 @Override
86 public void addListener(DeviceListener listener) {
87 }
88
89 @Override
90 public void removeListener(DeviceListener listener) {
91 }
92
samuel738dfaf2015-07-11 11:08:57 +080093 @Override
94 public Iterable<Device> getDevices(Type type) {
95 return Collections.emptyList();
96 }
97
98 @Override
99 public Iterable<Device> getAvailableDevices(Type type) {
100 return Collections.emptyList();
101 }
102
tom61359e92014-09-16 15:50:27 -0700103}